blob: b8cf8dae9079bbcf5d6b10998d374d1f785be26d [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"
27#define RSS_MBOOT_FW_CONFIG_STRING "FW_CONFIG"
28#define RSS_MBOOT_TB_FW_CONFIG_STRING "TB_FW_CONFIG"
29#define RSS_MBOOT_RMM_STRING "RMM"
30
31
32struct rss_mboot_metadata {
33 unsigned int id;
34 uint8_t slot;
35 uint8_t signer_id[SIGNER_ID_MAX_SIZE];
36 size_t signer_id_size;
37 uint8_t version[VERSION_MAX_SIZE];
38 size_t version_size;
39 uint8_t sw_type[SW_TYPE_MAX_SIZE];
40 size_t sw_type_size;
41 bool lock_measurement;
42};
43
44/* Functions' declarations */
45void rss_measured_boot_init(void);
46struct rss_mboot_metadata *plat_rss_mboot_get_metadata(void);
47int rss_mboot_measure_and_record(uintptr_t data_base, uint32_t data_size,
48 uint32_t data_id);
49
50/* TODO: These metadata are currently not available during TF-A boot */
51int rss_mboot_set_signer_id(unsigned int img_id, const void *pk_ptr, size_t pk_len);
52
53#endif /* RSS_MEASURED_BOOT_H */