measured_boot.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef PSA_MEASURED_BOOT_H
  8. #define PSA_MEASURED_BOOT_H
  9. #include <stdbool.h>
  10. #include <stddef.h>
  11. #include <stdint.h>
  12. #include "psa/error.h"
  13. /**
  14. * Extends and stores a measurement to the requested slot.
  15. *
  16. * index Slot number in which measurement is to be stored
  17. * signer_id Pointer to signer_id buffer.
  18. * signer_id_size Size of the signer_id in bytes.
  19. * version Pointer to version buffer.
  20. * version_size Size of the version string in bytes.
  21. * measurement_algo Algorithm identifier used for measurement.
  22. * sw_type Pointer to sw_type buffer.
  23. * sw_type_size Size of the sw_type string in bytes.
  24. * measurement_value Pointer to measurement_value buffer.
  25. * measurement_value_size Size of the measurement_value in bytes.
  26. * lock_measurement Boolean flag requesting whether the measurement
  27. * is to be locked.
  28. *
  29. * PSA_SUCCESS:
  30. * - Success.
  31. * PSA_ERROR_INVALID_ARGUMENT:
  32. * - The size of any argument is invalid OR
  33. * - Input Measurement value is NULL OR
  34. * - Input Signer ID is NULL OR
  35. * - Requested slot index is invalid.
  36. * PSA_ERROR_BAD_STATE:
  37. * - Request to lock, when slot is already locked.
  38. * PSA_ERROR_NOT_PERMITTED:
  39. * - When the requested slot is not accessible to the caller.
  40. */
  41. /* Not a standard PSA API, just an extension therefore use the 'rse_' prefix
  42. * rather than the usual 'psa_'.
  43. */
  44. psa_status_t
  45. rse_measured_boot_extend_measurement(uint8_t index,
  46. const uint8_t *signer_id,
  47. size_t signer_id_size,
  48. const uint8_t *version,
  49. size_t version_size,
  50. uint32_t measurement_algo,
  51. const uint8_t *sw_type,
  52. size_t sw_type_size,
  53. const uint8_t *measurement_value,
  54. size_t measurement_value_size,
  55. bool lock_measurement);
  56. /**
  57. * Retrieves a measurement from the requested slot.
  58. *
  59. * index Slot number from which measurement is to be
  60. * retrieved.
  61. * signer_id Pointer to signer_id buffer.
  62. * signer_id_size Size of the signer_id buffer in bytes.
  63. * signer_id_len On success, number of bytes that make up
  64. * signer_id.
  65. * version Pointer to version buffer.
  66. * version_size Size of the version buffer in bytes.
  67. * version_len On success, number of bytes that makeup the
  68. * version.
  69. * measurement_algo Pointer to measurement_algo.
  70. * sw_type Pointer to sw_type buffer.
  71. * sw_type_size Size of the sw_type buffer in bytes.
  72. * sw_type_len On success, number of bytes that makeup the
  73. * sw_type.
  74. * measurement_value Pointer to measurement_value buffer.
  75. * measurement_value_size Size of the measurement_value buffer in bytes.
  76. * measurement_value_len On success, number of bytes that make up the
  77. * measurement_value.
  78. * is_locked Pointer to lock status of requested measurement
  79. * slot.
  80. *
  81. * PSA_SUCCESS
  82. * - Success.
  83. * PSA_ERROR_INVALID_ARGUMENT
  84. * - The size of at least one of the output buffers is incorrect or the
  85. * requested slot index is invalid.
  86. * PSA_ERROR_DOES_NOT_EXIST
  87. * - The requested slot is empty, does not contain a measurement.
  88. */
  89. psa_status_t rse_measured_boot_read_measurement(uint8_t index,
  90. uint8_t *signer_id,
  91. size_t signer_id_size,
  92. size_t *signer_id_len,
  93. uint8_t *version,
  94. size_t version_size,
  95. size_t *version_len,
  96. uint32_t *measurement_algo,
  97. uint8_t *sw_type,
  98. size_t sw_type_size,
  99. size_t *sw_type_len,
  100. uint8_t *measurement_value,
  101. size_t measurement_value_size,
  102. size_t *measurement_value_len,
  103. bool *is_locked);
  104. #endif /* PSA_MEASURED_BOOT_H */