| 1 | /* |
| 2 | * S/390 DIAGNOSE 508 definitions and structures |
| 3 | * |
| 4 | * Copyright 2025 IBM Corp. |
| 5 | * Author(s): Collin Walling <walling@linux.ibm.com> |
| 6 | * |
| 7 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 8 | */ |
| 9 | |
| 10 | #ifndef S390X_DIAG508_H |
| 11 | #define S390X_DIAG508_H |
| 12 | |
| 13 | #define DIAG_508_SUBC_QUERY_SUBC 0x0000 |
| 14 | #define DIAG_508_SUBC_SIG_VERIF 0x8000 |
| 15 | |
| 16 | #define DIAG_508_RC_OK 0x0001 |
| 17 | #define DIAG_508_RC_NO_CERTS 0x0102 |
| 18 | #define DIAG_508_RC_INVAL_COMP_DATA 0x0202 |
| 19 | #define DIAG_508_RC_INVAL_PKCS7_SIG 0x0302 |
| 20 | #define DIAG_508_RC_FAIL_VERIF 0x0402 |
| 21 | #define DIAG_508_RC_INVAL_LEN 0x0502 |
| 22 | |
| 23 | /* |
| 24 | * Maximum component and signature sizes for current secure boot implementation |
| 25 | * Not architecturally defined and may need to revisit if increased |
| 26 | */ |
| 27 | #define DIAG_508_MAX_COMP_LEN 0x10000000 |
| 28 | #define DIAG_508_MAX_SIG_LEN 4096 |
| 29 | |
| 30 | struct Diag508SigVerifBlock { |
| 31 | uint32_t length; |
| 32 | uint8_t reserved0[3]; |
| 33 | uint8_t version; |
| 34 | uint32_t reserved[2]; |
| 35 | uint8_t cert_store_index; |
| 36 | uint8_t reserved1[7]; |
| 37 | uint64_t cert_len; |
| 38 | uint64_t comp_len; |
| 39 | uint64_t comp_addr; |
| 40 | uint64_t sig_len; |
| 41 | uint64_t sig_addr; |
| 42 | }; |
| 43 | typedef struct Diag508SigVerifBlock Diag508SigVerifBlock; |
| 44 | |
| 45 | #endif |