1 /* 2 * Copyright 2024 The ChromiumOS Authors 3 * Use of this source code is governed by a BSD-style license that can be 4 * found in the LICENSE file. 5 */ 6 7 #ifndef __GSC_UTILS_BOOT_PARAM_BOOT_PARAM_TYPES_H 8 #define __GSC_UTILS_BOOT_PARAM_BOOT_PARAM_TYPES_H 9 10 #include <stdbool.h> 11 #include <stddef.h> 12 #include <stdint.h> 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 #define DIGEST_BYTES 32 19 #define ECDSA_POINT_BYTES 32 20 #define ECDSA_SIG_BYTES (2 * ECDSA_POINT_BYTES) /* 32 byte R + 32 byte S */ 21 22 /* Sizes of GGSCBootParam fields */ 23 #define EARLY_ENTROPY_BYTES 64 24 #define KEY_SEED_BYTES 32 25 26 27 /* UDS_ID and CDI_ID sizes */ 28 #define DICE_ID_BYTES 20 29 #define DICE_ID_HEX_BYTES (DICE_ID_BYTES * 2) 30 31 struct slice_mut_s { 32 size_t size; 33 uint8_t *data; 34 }; 35 struct slice_ref_s { 36 const size_t size; 37 const uint8_t *data; 38 }; 39 40 #define digest_as_slice(digest) \ 41 { DIGEST_BYTES, digest } 42 43 #define digest_as_slice_mut(digest) \ 44 { DIGEST_BYTES, digest } 45 46 struct ecdsa_public_s { 47 uint8_t x[ECDSA_POINT_BYTES]; 48 uint8_t y[ECDSA_POINT_BYTES]; 49 }; 50 51 struct dice_config_s { 52 /* APROV status */ 53 uint32_t aprov_status; 54 /* GSCVD version (or 0 where not available) */ 55 uint32_t sec_ver; 56 /* UDS */ 57 uint8_t uds[DIGEST_BYTES]; 58 /* derived from owner seed, changes on owner clear */ 59 uint8_t hidden_digest[DIGEST_BYTES]; 60 /* GSCVD digest (or 0..0 where not available) */ 61 uint8_t code_digest[DIGEST_BYTES]; 62 /* PCR0 value */ 63 uint8_t pcr0[DIGEST_BYTES]; 64 /* PCR10 value */ 65 uint8_t pcr10[DIGEST_BYTES]; 66 }; 67 68 #ifdef __cplusplus 69 } /* extern "C" */ 70 #endif 71 72 #endif /* __GSC_UTILS_BOOT_PARAM_BOOT_PARAM_TYPES_H */ 73