1 
2 /*
3  * Copyright (c) 2022, 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/rss/rss_measured_boot.h>
13 
14 extern struct rss_mboot_metadata tc_rss_mboot_metadata[];
15 
plat_rss_mboot_get_metadata(void)16 struct rss_mboot_metadata *plat_rss_mboot_get_metadata(void)
17 {
18 	return tc_rss_mboot_metadata;
19 }
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 	int err;
24 
25 	/* Calculate image hash and record data in RSS */
26 	err = rss_mboot_measure_and_record(image_data->image_base,
27 					   image_data->image_size,
28 					   image_id);
29 	if (err != 0) {
30 		ERROR("%s%s image id %u (%i)\n",
31 		      "Failed to ", "record in RSS", image_id, err);
32 	}
33 
34 	return err;
35 }
36