tc_common_measured_boot.c 890 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <stdint.h>
  8. #include <common/desc_image_load.h>
  9. #include <drivers/measured_boot/rse/rse_measured_boot.h>
  10. extern struct rse_mboot_metadata tc_rse_mboot_metadata[];
  11. int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data)
  12. {
  13. int err;
  14. /* Calculate image hash and record data in RSE */
  15. err = rse_mboot_measure_and_record(tc_rse_mboot_metadata,
  16. image_data->image_base,
  17. image_data->image_size,
  18. image_id);
  19. if (err != 0) {
  20. ERROR("%s%s image id %u (%i)\n",
  21. "Failed to ", "record in RSE", image_id, err);
  22. }
  23. return err;
  24. }
  25. int plat_mboot_measure_key(void *pk_oid, void *pk_ptr, unsigned int pk_len)
  26. {
  27. return rse_mboot_set_signer_id(tc_rse_mboot_metadata, pk_oid, pk_ptr,
  28. pk_len);
  29. }