tc_common_dpe.c 856 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2024, 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/dice_prot_env.h>
  10. extern struct dpe_metadata tc_dpe_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 it in the DPE service in RSE. */
  15. err = dpe_measure_and_record(tc_dpe_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 DPE", 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 dpe_set_signer_id(tc_dpe_metadata, pk_oid, pk_ptr, pk_len);
  28. }