| 1 |
|
| 2 |
/* |
| 3 |
* Copyright (c) 2024, Arm Limited. All rights reserved. |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: BSD-3-Clause |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <assert.h> |
| 9 |
#include <stdint.h> |
| 10 |
|
| 11 |
#include <common/desc_image_load.h> |
| 12 |
#include <drivers/measured_boot/rse/dice_prot_env.h> |
| 13 |
|
| 14 |
extern struct dpe_metadata tc_dpe_metadata[]; |
| 15 |
|
| 16 |
int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data) |
| 17 |
{ |
| 18 |
int err; |
| 19 |
|
| 20 |
/* Calculate image hash and record it in the DPE service in RSE. */ |
| 21 |
err = dpe_measure_and_record(tc_dpe_metadata, |
| 22 |
image_data->image_base, |
| 23 |
image_data->image_size, |
| 24 |
image_id); |
| 25 |
if (err != 0) { |
| 26 |
ERROR("%s%s image id %u (%i)\n", |
| 27 |
"Failed to ", "record in DPE", image_id, err); |
| 28 |
} |
| 29 |
|
| 30 |
return err; |
| 31 |
} |
| 32 |
|
| 33 |
int plat_mboot_measure_key(void *pk_oid, void *pk_ptr, unsigned int pk_len) |
| 34 |
{ |
| 35 |
return dpe_set_signer_id(tc_dpe_metadata, pk_oid, pk_ptr, pk_len); |
| 36 |
} |