blob: fe885765c45170213065e4f208921d168ce8ad86 [file] [log] [blame]
Tamas Ban64c33a12022-01-11 20:24:24 +01001/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
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 Banb0f83252022-02-11 09:49:36 +010027#define RSS_MBOOT_HW_CONFIG_STRING "HW_CONFIG"
Tamas Ban64c33a12022-01-11 20:24:24 +010028#define RSS_MBOOT_FW_CONFIG_STRING "FW_CONFIG"
29#define RSS_MBOOT_TB_FW_CONFIG_STRING "TB_FW_CONFIG"
Tamas Banb0f83252022-02-11 09:49:36 +010030#define RSS_MBOOT_SOC_FW_CONFIG_STRING "SOC_FW_CONFIG"
Tamas Ban64c33a12022-01-11 20:24:24 +010031#define RSS_MBOOT_RMM_STRING "RMM"
32
33
34struct 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;
43 bool lock_measurement;
44};
45
46/* Functions' declarations */
47void rss_measured_boot_init(void);
48struct rss_mboot_metadata *plat_rss_mboot_get_metadata(void);
49int rss_mboot_measure_and_record(uintptr_t data_base, uint32_t data_size,
50 uint32_t data_id);
51
52/* TODO: These metadata are currently not available during TF-A boot */
53int rss_mboot_set_signer_id(unsigned int img_id, const void *pk_ptr, size_t pk_len);
54
55#endif /* RSS_MEASURED_BOOT_H */