1 /*
2 * Copyright (c) 2021-2025, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #include <assert.h>
8 #include <stdint.h>
9
10 #include <plat/arm/common/plat_arm.h>
11 #include <plat/common/platform.h>
12
13 #include <common/desc_image_load.h>
14 #include <common/measured_boot.h>
15 #include <drivers/auth/crypto_mod.h>
16 #include <event_measure.h>
17 #include <event_print.h>
18
19 extern event_log_metadata_t fvp_event_log_metadata[];
20
plat_mboot_measure_image(unsigned int image_id,image_info_t * image_data)21 int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data)
22 {
23 const event_log_metadata_t *metadata_ptr;
24 int err;
25
26 metadata_ptr =
27 mboot_find_event_log_metadata(fvp_event_log_metadata, image_id);
28 if (metadata_ptr == NULL) {
29 ERROR("Unable to find metadata for image %u.\n", image_id);
30 return -1;
31 }
32
33 /* Calculate image hash and record data in Event Log */
34 err = event_log_measure_and_record(metadata_ptr->pcr,
35 image_data->image_base,
36 image_data->image_size,
37 metadata_ptr->name,
38 strlen(metadata_ptr->name) + 1U);
39 if (err != 0) {
40 ERROR("%s%s image id %u (%i)\n",
41 "Failed to ", "record in event log", image_id, err);
42 return err;
43 }
44
45 return 0;
46 }
47
plat_mboot_measure_key(const void * pk_oid,const void * pk_ptr,size_t pk_len)48 int plat_mboot_measure_key(const void *pk_oid, const void *pk_ptr,
49 size_t pk_len)
50 {
51 return 0;
52 }
53