blob: 7ab517c18ae3621d378663d82303d38b8ce040fa [file] [log] [blame]
Tamas Ban64c33a12022-01-11 20:24:24 +01001/*
Manish V Badarkhe4699f592023-06-16 12:59:57 +01002 * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
Tamas Ban64c33a12022-01-11 20:24:24 +01003 *
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;
Manish V Badarkhec635adb2023-04-11 12:57:58 +010043 void *pk_oid;
Tamas Ban64c33a12022-01-11 20:24:24 +010044 bool lock_measurement;
45};
46
47/* Functions' declarations */
Manish V Badarkhe4699f592023-06-16 12:59:57 +010048void rss_measured_boot_init(struct rss_mboot_metadata *metadata_ptr);
49int rss_mboot_measure_and_record(struct rss_mboot_metadata *metadata_ptr,
50 uintptr_t data_base, uint32_t data_size,
Tamas Ban64c33a12022-01-11 20:24:24 +010051 uint32_t data_id);
52
Manish V Badarkhe4699f592023-06-16 12:59:57 +010053int rss_mboot_set_signer_id(struct rss_mboot_metadata *metadata_ptr,
Manish V Badarkhec635adb2023-04-11 12:57:58 +010054 const void *pk_oid, const void *pk_ptr,
Manish V Badarkhe4699f592023-06-16 12:59:57 +010055 size_t pk_len);
Tamas Ban64c33a12022-01-11 20:24:24 +010056
57#endif /* RSS_MEASURED_BOOT_H */