crypto_spe.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Copyright The Mbed TLS Contributors
  3. * SPDX-License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. /**
  19. * \file crypto_spe.h
  20. *
  21. * \brief When Mbed Crypto is built with the MBEDTLS_PSA_CRYPTO_SPM option
  22. * enabled, this header is included by all .c files in Mbed Crypto that
  23. * use PSA Crypto function names. This avoids duplication of symbols
  24. * between TF-M and Mbed Crypto.
  25. *
  26. * \note This file should be included before including any PSA Crypto headers
  27. * from Mbed Crypto.
  28. */
  29. #ifndef CRYPTO_SPE_H
  30. #define CRYPTO_SPE_H
  31. #define PSA_FUNCTION_NAME(x) mbedcrypto__ ## x
  32. #define psa_crypto_init \
  33. PSA_FUNCTION_NAME(psa_crypto_init)
  34. #define psa_key_derivation_get_capacity \
  35. PSA_FUNCTION_NAME(psa_key_derivation_get_capacity)
  36. #define psa_key_derivation_set_capacity \
  37. PSA_FUNCTION_NAME(psa_key_derivation_set_capacity)
  38. #define psa_key_derivation_input_bytes \
  39. PSA_FUNCTION_NAME(psa_key_derivation_input_bytes)
  40. #define psa_key_derivation_output_bytes \
  41. PSA_FUNCTION_NAME(psa_key_derivation_output_bytes)
  42. #define psa_key_derivation_input_key \
  43. PSA_FUNCTION_NAME(psa_key_derivation_input_key)
  44. #define psa_key_derivation_output_key \
  45. PSA_FUNCTION_NAME(psa_key_derivation_output_key)
  46. #define psa_key_derivation_setup \
  47. PSA_FUNCTION_NAME(psa_key_derivation_setup)
  48. #define psa_key_derivation_abort \
  49. PSA_FUNCTION_NAME(psa_key_derivation_abort)
  50. #define psa_key_derivation_key_agreement \
  51. PSA_FUNCTION_NAME(psa_key_derivation_key_agreement)
  52. #define psa_raw_key_agreement \
  53. PSA_FUNCTION_NAME(psa_raw_key_agreement)
  54. #define psa_generate_random \
  55. PSA_FUNCTION_NAME(psa_generate_random)
  56. #define psa_aead_encrypt \
  57. PSA_FUNCTION_NAME(psa_aead_encrypt)
  58. #define psa_aead_decrypt \
  59. PSA_FUNCTION_NAME(psa_aead_decrypt)
  60. #define psa_open_key \
  61. PSA_FUNCTION_NAME(psa_open_key)
  62. #define psa_close_key \
  63. PSA_FUNCTION_NAME(psa_close_key)
  64. #define psa_import_key \
  65. PSA_FUNCTION_NAME(psa_import_key)
  66. #define psa_destroy_key \
  67. PSA_FUNCTION_NAME(psa_destroy_key)
  68. #define psa_get_key_attributes \
  69. PSA_FUNCTION_NAME(psa_get_key_attributes)
  70. #define psa_reset_key_attributes \
  71. PSA_FUNCTION_NAME(psa_reset_key_attributes)
  72. #define psa_export_key \
  73. PSA_FUNCTION_NAME(psa_export_key)
  74. #define psa_export_public_key \
  75. PSA_FUNCTION_NAME(psa_export_public_key)
  76. #define psa_purge_key \
  77. PSA_FUNCTION_NAME(psa_purge_key)
  78. #define psa_copy_key \
  79. PSA_FUNCTION_NAME(psa_copy_key)
  80. #define psa_cipher_operation_init \
  81. PSA_FUNCTION_NAME(psa_cipher_operation_init)
  82. #define psa_cipher_generate_iv \
  83. PSA_FUNCTION_NAME(psa_cipher_generate_iv)
  84. #define psa_cipher_set_iv \
  85. PSA_FUNCTION_NAME(psa_cipher_set_iv)
  86. #define psa_cipher_encrypt_setup \
  87. PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
  88. #define psa_cipher_decrypt_setup \
  89. PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
  90. #define psa_cipher_update \
  91. PSA_FUNCTION_NAME(psa_cipher_update)
  92. #define psa_cipher_finish \
  93. PSA_FUNCTION_NAME(psa_cipher_finish)
  94. #define psa_cipher_abort \
  95. PSA_FUNCTION_NAME(psa_cipher_abort)
  96. #define psa_hash_operation_init \
  97. PSA_FUNCTION_NAME(psa_hash_operation_init)
  98. #define psa_hash_setup \
  99. PSA_FUNCTION_NAME(psa_hash_setup)
  100. #define psa_hash_update \
  101. PSA_FUNCTION_NAME(psa_hash_update)
  102. #define psa_hash_finish \
  103. PSA_FUNCTION_NAME(psa_hash_finish)
  104. #define psa_hash_verify \
  105. PSA_FUNCTION_NAME(psa_hash_verify)
  106. #define psa_hash_abort \
  107. PSA_FUNCTION_NAME(psa_hash_abort)
  108. #define psa_hash_clone \
  109. PSA_FUNCTION_NAME(psa_hash_clone)
  110. #define psa_hash_compute \
  111. PSA_FUNCTION_NAME(psa_hash_compute)
  112. #define psa_hash_compare \
  113. PSA_FUNCTION_NAME(psa_hash_compare)
  114. #define psa_mac_operation_init \
  115. PSA_FUNCTION_NAME(psa_mac_operation_init)
  116. #define psa_mac_sign_setup \
  117. PSA_FUNCTION_NAME(psa_mac_sign_setup)
  118. #define psa_mac_verify_setup \
  119. PSA_FUNCTION_NAME(psa_mac_verify_setup)
  120. #define psa_mac_update \
  121. PSA_FUNCTION_NAME(psa_mac_update)
  122. #define psa_mac_sign_finish \
  123. PSA_FUNCTION_NAME(psa_mac_sign_finish)
  124. #define psa_mac_verify_finish \
  125. PSA_FUNCTION_NAME(psa_mac_verify_finish)
  126. #define psa_mac_abort \
  127. PSA_FUNCTION_NAME(psa_mac_abort)
  128. #define psa_sign_hash \
  129. PSA_FUNCTION_NAME(psa_sign_hash)
  130. #define psa_verify_hash \
  131. PSA_FUNCTION_NAME(psa_verify_hash)
  132. #define psa_asymmetric_encrypt \
  133. PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
  134. #define psa_asymmetric_decrypt \
  135. PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
  136. #define psa_generate_key \
  137. PSA_FUNCTION_NAME(psa_generate_key)
  138. #endif /* CRYPTO_SPE_H */