rse_ap_test_stubs.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Copyright (c) 2022, Arm Ltd. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdarg.h>
  7. #include <stdbool.h>
  8. #include <stdio.h>
  9. #include <delegated_attestation.h>
  10. #include <measured_boot.h>
  11. #include <psa/error.h>
  12. psa_status_t
  13. tfm_measured_boot_extend_measurement(uint8_t index,
  14. const uint8_t *signer_id,
  15. size_t signer_id_size,
  16. const uint8_t *version,
  17. size_t version_size,
  18. uint32_t measurement_algo,
  19. const uint8_t *sw_type,
  20. size_t sw_type_size,
  21. const uint8_t *measurement_value,
  22. size_t measurement_value_size,
  23. bool lock_measurement)
  24. {
  25. return rse_measured_boot_extend_measurement(index,
  26. signer_id,
  27. signer_id_size,
  28. version,
  29. version_size,
  30. measurement_algo,
  31. sw_type,
  32. sw_type_size,
  33. measurement_value,
  34. measurement_value_size,
  35. lock_measurement);
  36. }
  37. psa_status_t
  38. tfm_measured_boot_read_measurement(uint8_t index,
  39. uint8_t *signer_id,
  40. size_t signer_id_size,
  41. size_t *signer_id_len,
  42. uint8_t *version,
  43. size_t version_size,
  44. size_t *version_len,
  45. uint32_t *measurement_algo,
  46. uint8_t *sw_type,
  47. size_t sw_type_size,
  48. size_t *sw_type_len,
  49. uint8_t *measurement_value,
  50. size_t measurement_value_size,
  51. size_t *measurement_value_len,
  52. bool *is_locked)
  53. {
  54. return rse_measured_boot_read_measurement(index,
  55. signer_id,
  56. signer_id_size,
  57. signer_id_len,
  58. version,
  59. version_size,
  60. version_len,
  61. measurement_algo,
  62. sw_type,
  63. sw_type_size,
  64. sw_type_len,
  65. measurement_value,
  66. measurement_value_size,
  67. measurement_value_len,
  68. is_locked);
  69. }
  70. psa_status_t
  71. tfm_delegated_attest_get_token(const uint8_t *dak_pub_hash,
  72. size_t dak_pub_hash_size,
  73. uint8_t *token_buf,
  74. size_t token_buf_size,
  75. size_t *token_size)
  76. {
  77. return rse_delegated_attest_get_token(dak_pub_hash,
  78. dak_pub_hash_size,
  79. token_buf,
  80. token_buf_size,
  81. token_size);
  82. }
  83. psa_status_t
  84. tfm_delegated_attest_get_delegated_key(uint8_t ecc_curve,
  85. uint32_t key_bits,
  86. uint8_t *key_buf,
  87. size_t key_buf_size,
  88. size_t *key_size,
  89. uint32_t hash_algo)
  90. {
  91. return rse_delegated_attest_get_delegated_key(ecc_curve,
  92. key_bits,
  93. key_buf,
  94. key_buf_size,
  95. key_size,
  96. hash_algo);
  97. }
  98. int tfm_log_printf(const char *fmt, ...)
  99. {
  100. int count;
  101. va_list ap;
  102. va_start(ap, fmt);
  103. count = vprintf(fmt, ap);
  104. va_end(ap);
  105. return count;
  106. }
  107. void printf_set_color(int color_id)
  108. {
  109. (void)color_id;
  110. }