Tamas Ban | a426089 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 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> |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 12 | #include <drivers/measured_boot/rse/dice_prot_env.h> |
Tamas Ban | a426089 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 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 | |
Tamas Ban | dc15bf4 | 2024-02-22 11:35:28 +0100 | [diff] [blame] | 20 | /* Calculate image hash and record it in the DPE service in RSE. */ |
Tamas Ban | a426089 | 2023-06-07 13:35:04 +0200 | [diff] [blame] | 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 | } |