blob: 72ac6730489cedd755bc51f959651792a5cfd06a [file] [log] [blame]
Tamas Bana4260892023-06-07 13:35:04 +02001
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 Bandc15bf42024-02-22 11:35:28 +010012#include <drivers/measured_boot/rse/dice_prot_env.h>
Tamas Bana4260892023-06-07 13:35:04 +020013
14extern struct dpe_metadata tc_dpe_metadata[];
15
16int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data)
17{
18 int err;
19
Tamas Bandc15bf42024-02-22 11:35:28 +010020 /* Calculate image hash and record it in the DPE service in RSE. */
Tamas Bana4260892023-06-07 13:35:04 +020021 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
33int 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}