1*91f16700Schasinglulu /* 2*91f16700Schasinglulu * Copyright (c) 2022-2023, Arm Limited. All rights reserved. 3*91f16700Schasinglulu * 4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu */ 6*91f16700Schasinglulu 7*91f16700Schasinglulu #ifndef RSS_MEASURED_BOOT_H 8*91f16700Schasinglulu #define RSS_MEASURED_BOOT_H 9*91f16700Schasinglulu 10*91f16700Schasinglulu #include <stdint.h> 11*91f16700Schasinglulu 12*91f16700Schasinglulu #include <common/debug.h> 13*91f16700Schasinglulu #include <measured_boot.h> 14*91f16700Schasinglulu 15*91f16700Schasinglulu #define RSS_MBOOT_INVALID_ID UINT32_MAX 16*91f16700Schasinglulu 17*91f16700Schasinglulu /* 18*91f16700Schasinglulu * Each boot measurement has some metadata (i.e. a string) that identifies 19*91f16700Schasinglulu * what was measured and how. The sw_type field of the rss_mboot_metadata 20*91f16700Schasinglulu * structure represents the role of the software component that was measured. 21*91f16700Schasinglulu * The below macros define strings suitable for the sw_type. 22*91f16700Schasinglulu * The key thing is to choose meaningful strings so that when the attestation 23*91f16700Schasinglulu * token is verified, then the different components can be identified. 24*91f16700Schasinglulu */ 25*91f16700Schasinglulu #define RSS_MBOOT_BL2_STRING "BL_2" 26*91f16700Schasinglulu #define RSS_MBOOT_BL31_STRING "SECURE_RT_EL3" 27*91f16700Schasinglulu #define RSS_MBOOT_HW_CONFIG_STRING "HW_CONFIG" 28*91f16700Schasinglulu #define RSS_MBOOT_FW_CONFIG_STRING "FW_CONFIG" 29*91f16700Schasinglulu #define RSS_MBOOT_TB_FW_CONFIG_STRING "TB_FW_CONFIG" 30*91f16700Schasinglulu #define RSS_MBOOT_SOC_FW_CONFIG_STRING "SOC_FW_CONFIG" 31*91f16700Schasinglulu #define RSS_MBOOT_RMM_STRING "RMM" 32*91f16700Schasinglulu 33*91f16700Schasinglulu 34*91f16700Schasinglulu struct rss_mboot_metadata { 35*91f16700Schasinglulu unsigned int id; 36*91f16700Schasinglulu uint8_t slot; 37*91f16700Schasinglulu uint8_t signer_id[SIGNER_ID_MAX_SIZE]; 38*91f16700Schasinglulu size_t signer_id_size; 39*91f16700Schasinglulu uint8_t version[VERSION_MAX_SIZE]; 40*91f16700Schasinglulu size_t version_size; 41*91f16700Schasinglulu uint8_t sw_type[SW_TYPE_MAX_SIZE]; 42*91f16700Schasinglulu size_t sw_type_size; 43*91f16700Schasinglulu void *pk_oid; 44*91f16700Schasinglulu bool lock_measurement; 45*91f16700Schasinglulu }; 46*91f16700Schasinglulu 47*91f16700Schasinglulu /* Functions' declarations */ 48*91f16700Schasinglulu void rss_measured_boot_init(struct rss_mboot_metadata *metadata_ptr); 49*91f16700Schasinglulu int rss_mboot_measure_and_record(struct rss_mboot_metadata *metadata_ptr, 50*91f16700Schasinglulu uintptr_t data_base, uint32_t data_size, 51*91f16700Schasinglulu uint32_t data_id); 52*91f16700Schasinglulu 53*91f16700Schasinglulu int rss_mboot_set_signer_id(struct rss_mboot_metadata *metadata_ptr, 54*91f16700Schasinglulu const void *pk_oid, const void *pk_ptr, 55*91f16700Schasinglulu size_t pk_len); 56*91f16700Schasinglulu 57*91f16700Schasinglulu #endif /* RSS_MEASURED_BOOT_H */ 58