dice_prot_env.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef DICE_PROT_ENV_H
  7. #define DICE_PROT_ENV_H
  8. #include <stdbool.h>
  9. #include <stddef.h>
  10. #include <stdint.h>
  11. #include <drivers/measured_boot/metadata.h>
  12. #define DPE_INVALID_ID UINT32_MAX
  13. struct dpe_metadata {
  14. unsigned int id;
  15. uint32_t cert_id;
  16. uint8_t signer_id[SIGNER_ID_MAX_SIZE];
  17. size_t signer_id_size;
  18. uint8_t version[VERSION_MAX_SIZE];
  19. size_t version_size;
  20. uint8_t sw_type[SW_TYPE_MAX_SIZE];
  21. size_t sw_type_size;
  22. bool allow_new_context_to_derive;
  23. bool retain_parent_context;
  24. bool create_certificate;
  25. int target_locality;
  26. void *pk_oid;
  27. };
  28. void dpe_init(struct dpe_metadata *metadata);
  29. /* Returns 0 in case of success otherwise -1. */
  30. int dpe_measure_and_record(struct dpe_metadata *metadata,
  31. uintptr_t data_base, uint32_t data_size,
  32. uint32_t data_id);
  33. int dpe_set_signer_id(struct dpe_metadata *metadata,
  34. const void *pk_oid, const void *pk_ptr, size_t pk_len);
  35. /* Child components inherit their first valid context handle from their parents.
  36. * How to share context handle is platform specific.
  37. */
  38. void plat_dpe_share_context_handle(int *ctx_handle, int *parent_ctx_handle);
  39. void plat_dpe_get_context_handle(int *ctx_handle);
  40. #endif /* DICE_PROT_ENV_H */