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