Browse Source
* changes: fix(psa): extend measured boot logging fix(rss): determine the size of sw_type in RSS mboot metadata fix(psa): align with original API in tf-m-extras fix(rss): clear the message buffer feat(tc): enable RSS backend based measured boot feat(tc): increase maximum BL1/BL2/BL31 sizespull/1988/merge
Sandrine Bailleux
2 years ago
committed by
TrustedFirmware Code Review
9 changed files with 210 additions and 25 deletions
@ -0,0 +1,55 @@ |
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <stdint.h> |
|||
|
|||
#include <drivers/arm/rss_comms.h> |
|||
#include <drivers/measured_boot/rss/rss_measured_boot.h> |
|||
#include <lib/psa/measured_boot.h> |
|||
|
|||
#include <plat/arm/common/plat_arm.h> |
|||
#include <platform_def.h> |
|||
|
|||
/* Table with platform specific image IDs and metadata. Intentionally not a
|
|||
* const struct, some members might set by bootloaders during trusted boot. |
|||
*/ |
|||
struct rss_mboot_metadata tc_rss_mboot_metadata[] = { |
|||
{ |
|||
.id = FW_CONFIG_ID, |
|||
.slot = U(6), |
|||
.signer_id_size = SIGNER_ID_MIN_SIZE, |
|||
.sw_type = RSS_MBOOT_FW_CONFIG_STRING, |
|||
.lock_measurement = true }, |
|||
{ |
|||
.id = TB_FW_CONFIG_ID, |
|||
.slot = U(7), |
|||
.signer_id_size = SIGNER_ID_MIN_SIZE, |
|||
.sw_type = RSS_MBOOT_TB_FW_CONFIG_STRING, |
|||
.lock_measurement = true }, |
|||
{ |
|||
.id = BL2_IMAGE_ID, |
|||
.slot = U(8), |
|||
.signer_id_size = SIGNER_ID_MIN_SIZE, |
|||
.sw_type = RSS_MBOOT_BL2_STRING, |
|||
.lock_measurement = true }, |
|||
|
|||
{ |
|||
.id = RSS_MBOOT_INVALID_ID } |
|||
}; |
|||
|
|||
void bl1_plat_mboot_init(void) |
|||
{ |
|||
/* Initialize the communication channel between AP and RSS */ |
|||
(void)rss_comms_init(PLAT_RSS_AP_SND_MHU_BASE, |
|||
PLAT_RSS_AP_RCV_MHU_BASE); |
|||
|
|||
rss_measured_boot_init(); |
|||
} |
|||
|
|||
void bl1_plat_mboot_finish(void) |
|||
{ |
|||
/* Nothing to do. */ |
|||
} |
@ -0,0 +1,54 @@ |
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <stdint.h> |
|||
|
|||
#include <drivers/arm/rss_comms.h> |
|||
#include <drivers/measured_boot/rss/rss_measured_boot.h> |
|||
#include <lib/psa/measured_boot.h> |
|||
|
|||
#include <plat/common/common_def.h> |
|||
#include <platform_def.h> |
|||
|
|||
/* TC specific table with image IDs and metadata. Intentionally not a
|
|||
* const struct, some members might set by bootloaders during trusted boot. |
|||
*/ |
|||
struct rss_mboot_metadata tc_rss_mboot_metadata[] = { |
|||
{ |
|||
.id = BL31_IMAGE_ID, |
|||
.slot = U(9), |
|||
.signer_id_size = SIGNER_ID_MIN_SIZE, |
|||
.sw_type = RSS_MBOOT_BL31_STRING, |
|||
.lock_measurement = true }, |
|||
{ |
|||
.id = HW_CONFIG_ID, |
|||
.slot = U(10), |
|||
.signer_id_size = SIGNER_ID_MIN_SIZE, |
|||
.sw_type = RSS_MBOOT_HW_CONFIG_STRING, |
|||
.lock_measurement = true }, |
|||
{ |
|||
.id = SOC_FW_CONFIG_ID, |
|||
.slot = U(11), |
|||
.signer_id_size = SIGNER_ID_MIN_SIZE, |
|||
.sw_type = RSS_MBOOT_SOC_FW_CONFIG_STRING, |
|||
.lock_measurement = true }, |
|||
{ |
|||
.id = RSS_MBOOT_INVALID_ID } |
|||
}; |
|||
|
|||
void bl2_plat_mboot_init(void) |
|||
{ |
|||
/* Initialize the communication channel between AP and RSS */ |
|||
(void)rss_comms_init(PLAT_RSS_AP_SND_MHU_BASE, |
|||
PLAT_RSS_AP_RCV_MHU_BASE); |
|||
|
|||
rss_measured_boot_init(); |
|||
} |
|||
|
|||
void bl2_plat_mboot_finish(void) |
|||
{ |
|||
/* Nothing to do. */ |
|||
} |
@ -0,0 +1,35 @@ |
|||
|
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <assert.h> |
|||
#include <stdint.h> |
|||
|
|||
#include <common/desc_image_load.h> |
|||
#include <drivers/measured_boot/rss/rss_measured_boot.h> |
|||
|
|||
extern struct rss_mboot_metadata tc_rss_mboot_metadata[]; |
|||
|
|||
struct rss_mboot_metadata *plat_rss_mboot_get_metadata(void) |
|||
{ |
|||
return tc_rss_mboot_metadata; |
|||
} |
|||
|
|||
int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data) |
|||
{ |
|||
int err; |
|||
|
|||
/* Calculate image hash and record data in RSS */ |
|||
err = rss_mboot_measure_and_record(image_data->image_base, |
|||
image_data->image_size, |
|||
image_id); |
|||
if (err != 0) { |
|||
ERROR("%s%s image id %u (%i)\n", |
|||
"Failed to ", "record in RSS", image_id, err); |
|||
} |
|||
|
|||
return err; |
|||
} |
Loading…
Reference in new issue