On 2/12/2026 12:43 PM, Zhuoying Cai wrote:
From: Collin Walling<[email protected]>

DIAG 508 subcode 1 performs signature-verification on signed components.
A signed component may be a Linux kernel image, or any other signed
binary. **Verification of initrd is not supported.**

The instruction call expects two item-pairs: an address of a device
component, an address of the analogous signature file (in PKCS#7 DER format),
and their respective lengths. All of this data should be encapsulated
within a Diag508SigVerifBlock.

The DIAG handler will read from the provided addresses
to retrieve the necessary data, parse the signature file, then
perform the signature-verification. Because there is no way to
correlate a specific certificate to a component, each certificate
in the store is tried until either verification succeeds, or all
certs have been exhausted.

A return code of 1 indicates success, and the index and length of the
corresponding certificate will be set in the Diag508SigVerifBlock.
The following values indicate failure:

        0x0102: no certificates are available in the store
        0x0202: component data is invalid
        0x0302: PKCS#7 format signature is invalid
        0x0402: signature-verification failed
        0x0502: length of Diag508SigVerifBlock is invalid

Signed-off-by: Collin Walling<[email protected]>
Signed-off-by: Zhuoying Cai<[email protected]>
Reviewed-by: Thomas Huth<[email protected]>
---
  docs/specs/s390x-secure-ipl.rst |  17 +++++
  include/hw/s390x/ipl/diag508.h  |  30 +++++++++
  target/s390x/diag.c             | 111 +++++++++++++++++++++++++++++++-
  3 files changed, 157 insertions(+), 1 deletion(-)

Reviewed-by: Farhan Ali<[email protected]>



Reply via email to