crypto_spe.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. /**
  8. * \file crypto_spe.h
  9. *
  10. * \brief When Mbed Crypto is built with the MBEDTLS_PSA_CRYPTO_SPM option
  11. * enabled, this header is included by all .c files in Mbed Crypto that
  12. * use PSA Crypto function names. This avoids duplication of symbols
  13. * between TF-M and Mbed Crypto.
  14. *
  15. * \note This file should be included before including any PSA Crypto headers
  16. * from Mbed Crypto.
  17. */
  18. #ifndef CRYPTO_SPE_H
  19. #define CRYPTO_SPE_H
  20. #define PSA_FUNCTION_NAME(x) mbedcrypto__ ## x
  21. #define psa_crypto_init \
  22. PSA_FUNCTION_NAME(psa_crypto_init)
  23. #define psa_key_derivation_get_capacity \
  24. PSA_FUNCTION_NAME(psa_key_derivation_get_capacity)
  25. #define psa_key_derivation_set_capacity \
  26. PSA_FUNCTION_NAME(psa_key_derivation_set_capacity)
  27. #define psa_key_derivation_input_bytes \
  28. PSA_FUNCTION_NAME(psa_key_derivation_input_bytes)
  29. #define psa_key_derivation_output_bytes \
  30. PSA_FUNCTION_NAME(psa_key_derivation_output_bytes)
  31. #define psa_key_derivation_input_key \
  32. PSA_FUNCTION_NAME(psa_key_derivation_input_key)
  33. #define psa_key_derivation_output_key \
  34. PSA_FUNCTION_NAME(psa_key_derivation_output_key)
  35. #define psa_key_derivation_setup \
  36. PSA_FUNCTION_NAME(psa_key_derivation_setup)
  37. #define psa_key_derivation_abort \
  38. PSA_FUNCTION_NAME(psa_key_derivation_abort)
  39. #define psa_key_derivation_key_agreement \
  40. PSA_FUNCTION_NAME(psa_key_derivation_key_agreement)
  41. #define psa_raw_key_agreement \
  42. PSA_FUNCTION_NAME(psa_raw_key_agreement)
  43. #define psa_generate_random \
  44. PSA_FUNCTION_NAME(psa_generate_random)
  45. #define psa_aead_encrypt \
  46. PSA_FUNCTION_NAME(psa_aead_encrypt)
  47. #define psa_aead_decrypt \
  48. PSA_FUNCTION_NAME(psa_aead_decrypt)
  49. #define psa_open_key \
  50. PSA_FUNCTION_NAME(psa_open_key)
  51. #define psa_close_key \
  52. PSA_FUNCTION_NAME(psa_close_key)
  53. #define psa_import_key \
  54. PSA_FUNCTION_NAME(psa_import_key)
  55. #define psa_destroy_key \
  56. PSA_FUNCTION_NAME(psa_destroy_key)
  57. #define psa_get_key_attributes \
  58. PSA_FUNCTION_NAME(psa_get_key_attributes)
  59. #define psa_reset_key_attributes \
  60. PSA_FUNCTION_NAME(psa_reset_key_attributes)
  61. #define psa_export_key \
  62. PSA_FUNCTION_NAME(psa_export_key)
  63. #define psa_export_public_key \
  64. PSA_FUNCTION_NAME(psa_export_public_key)
  65. #define psa_purge_key \
  66. PSA_FUNCTION_NAME(psa_purge_key)
  67. #define psa_copy_key \
  68. PSA_FUNCTION_NAME(psa_copy_key)
  69. #define psa_cipher_operation_init \
  70. PSA_FUNCTION_NAME(psa_cipher_operation_init)
  71. #define psa_cipher_generate_iv \
  72. PSA_FUNCTION_NAME(psa_cipher_generate_iv)
  73. #define psa_cipher_set_iv \
  74. PSA_FUNCTION_NAME(psa_cipher_set_iv)
  75. #define psa_cipher_encrypt_setup \
  76. PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
  77. #define psa_cipher_decrypt_setup \
  78. PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
  79. #define psa_cipher_update \
  80. PSA_FUNCTION_NAME(psa_cipher_update)
  81. #define psa_cipher_finish \
  82. PSA_FUNCTION_NAME(psa_cipher_finish)
  83. #define psa_cipher_abort \
  84. PSA_FUNCTION_NAME(psa_cipher_abort)
  85. #define psa_hash_operation_init \
  86. PSA_FUNCTION_NAME(psa_hash_operation_init)
  87. #define psa_hash_setup \
  88. PSA_FUNCTION_NAME(psa_hash_setup)
  89. #define psa_hash_update \
  90. PSA_FUNCTION_NAME(psa_hash_update)
  91. #define psa_hash_finish \
  92. PSA_FUNCTION_NAME(psa_hash_finish)
  93. #define psa_hash_verify \
  94. PSA_FUNCTION_NAME(psa_hash_verify)
  95. #define psa_hash_abort \
  96. PSA_FUNCTION_NAME(psa_hash_abort)
  97. #define psa_hash_clone \
  98. PSA_FUNCTION_NAME(psa_hash_clone)
  99. #define psa_hash_compute \
  100. PSA_FUNCTION_NAME(psa_hash_compute)
  101. #define psa_hash_compare \
  102. PSA_FUNCTION_NAME(psa_hash_compare)
  103. #define psa_mac_operation_init \
  104. PSA_FUNCTION_NAME(psa_mac_operation_init)
  105. #define psa_mac_sign_setup \
  106. PSA_FUNCTION_NAME(psa_mac_sign_setup)
  107. #define psa_mac_verify_setup \
  108. PSA_FUNCTION_NAME(psa_mac_verify_setup)
  109. #define psa_mac_update \
  110. PSA_FUNCTION_NAME(psa_mac_update)
  111. #define psa_mac_sign_finish \
  112. PSA_FUNCTION_NAME(psa_mac_sign_finish)
  113. #define psa_mac_verify_finish \
  114. PSA_FUNCTION_NAME(psa_mac_verify_finish)
  115. #define psa_mac_abort \
  116. PSA_FUNCTION_NAME(psa_mac_abort)
  117. #define psa_sign_hash \
  118. PSA_FUNCTION_NAME(psa_sign_hash)
  119. #define psa_verify_hash \
  120. PSA_FUNCTION_NAME(psa_verify_hash)
  121. #define psa_asymmetric_encrypt \
  122. PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
  123. #define psa_asymmetric_decrypt \
  124. PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
  125. #define psa_generate_key \
  126. PSA_FUNCTION_NAME(psa_generate_key)
  127. #endif /* CRYPTO_SPE_H */