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