blob: 400fe7dff01e2ba1e9088773c2a9cd52afbd73c7 [file] [log] [blame]
Jamie Fox0e54ebc2019-04-09 14:21:04 +01001/*
2 * Copyright (c) 2019, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8/**
9 * \file crypto_spe.h
10 *
11 * \brief When Mbed Crypto is built with the MBEDTLS_PSA_CRYPTO_SPM option
12 * enabled, this header is included by all .c files in Mbed Crypto that
13 * use PSA Crypto function names. This avoids duplication of symbols
14 * between TF-M and Mbed Crypto.
15 *
16 * \note This file should be included before including any PSA Crypto headers
17 * from Mbed Crypto.
18 */
19
20#ifndef CRYPTO_SPE_H
21#define CRYPTO_SPE_H
22
23#define PSA_FUNCTION_NAME(x) mbedcrypto__ ## x
24
25#define psa_crypto_init \
26 PSA_FUNCTION_NAME(psa_crypto_init)
27#define psa_key_policy_init \
28 PSA_FUNCTION_NAME(psa_key_policy_init)
29#define psa_key_policy_set_usage \
30 PSA_FUNCTION_NAME(psa_key_policy_set_usage)
31#define psa_key_policy_get_usage \
32 PSA_FUNCTION_NAME(psa_key_policy_get_usage)
33#define psa_key_policy_get_algorithm \
34 PSA_FUNCTION_NAME(psa_key_policy_get_algorithm)
35#define psa_set_key_policy \
36 PSA_FUNCTION_NAME(psa_set_key_policy)
37#define psa_get_key_policy \
38 PSA_FUNCTION_NAME(psa_get_key_policy)
39#define psa_get_key_lifetime \
40 PSA_FUNCTION_NAME(psa_get_key_lifetime)
41#define psa_allocate_key \
42 PSA_FUNCTION_NAME(psa_allocate_key)
43#define psa_open_key \
44 PSA_FUNCTION_NAME(psa_open_key)
45#define psa_create_key \
46 PSA_FUNCTION_NAME(psa_create_key)
47#define psa_close_key \
48 PSA_FUNCTION_NAME(psa_close_key)
49#define psa_import_key \
50 PSA_FUNCTION_NAME(psa_import_key)
51#define psa_destroy_key \
52 PSA_FUNCTION_NAME(psa_destroy_key)
53#define psa_get_key_information \
54 PSA_FUNCTION_NAME(psa_get_key_information)
55#define psa_export_key \
56 PSA_FUNCTION_NAME(psa_export_key)
57#define psa_export_public_key \
58 PSA_FUNCTION_NAME(psa_export_public_key)
59#define psa_copy_key \
60 PSA_FUNCTION_NAME(psa_copy_key)
61#define psa_hash_operation_init \
62 PSA_FUNCTION_NAME(psa_hash_operation_init)
63#define psa_hash_setup \
64 PSA_FUNCTION_NAME(psa_hash_setup)
65#define psa_hash_update \
66 PSA_FUNCTION_NAME(psa_hash_update)
67#define psa_hash_finish \
68 PSA_FUNCTION_NAME(psa_hash_finish)
69#define psa_hash_verify \
70 PSA_FUNCTION_NAME(psa_hash_verify)
71#define psa_hash_abort \
72 PSA_FUNCTION_NAME(psa_hash_abort)
73#define psa_hash_clone \
74 PSA_FUNCTION_NAME(psa_hash_clone)
75#define psa_mac_operation_init \
76 PSA_FUNCTION_NAME(psa_mac_operation_init)
77#define psa_mac_sign_setup \
78 PSA_FUNCTION_NAME(psa_mac_sign_setup)
79#define psa_mac_verify_setup \
80 PSA_FUNCTION_NAME(psa_mac_verify_setup)
81#define psa_mac_update \
82 PSA_FUNCTION_NAME(psa_mac_update)
83#define psa_mac_sign_finish \
84 PSA_FUNCTION_NAME(psa_mac_sign_finish)
85#define psa_mac_verify_finish \
86 PSA_FUNCTION_NAME(psa_mac_verify_finish)
87#define psa_mac_abort \
88 PSA_FUNCTION_NAME(psa_mac_abort)
89#define psa_cipher_operation_init \
90 PSA_FUNCTION_NAME(psa_cipher_operation_init)
91#define psa_cipher_encrypt_setup \
92 PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
93#define psa_cipher_decrypt_setup \
94 PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
95#define psa_cipher_generate_iv \
96 PSA_FUNCTION_NAME(psa_cipher_generate_iv)
97#define psa_cipher_set_iv \
98 PSA_FUNCTION_NAME(psa_cipher_set_iv)
99#define psa_cipher_update \
100 PSA_FUNCTION_NAME(psa_cipher_update)
101#define psa_cipher_finish \
102 PSA_FUNCTION_NAME(psa_cipher_finish)
103#define psa_cipher_abort \
104 PSA_FUNCTION_NAME(psa_cipher_abort)
105#define psa_aead_encrypt \
106 PSA_FUNCTION_NAME(psa_aead_encrypt)
107#define psa_aead_decrypt \
108 PSA_FUNCTION_NAME(psa_aead_decrypt)
109#define psa_asymmetric_sign \
110 PSA_FUNCTION_NAME(psa_asymmetric_sign)
111#define psa_asymmetric_verify \
112 PSA_FUNCTION_NAME(psa_asymmetric_verify)
113#define psa_asymmetric_encrypt \
114 PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
115#define psa_asymmetric_decrypt \
116 PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
117#define psa_crypto_generator_init \
118 PSA_FUNCTION_NAME(psa_crypto_generator_init)
119#define psa_get_generator_capacity \
120 PSA_FUNCTION_NAME(psa_get_generator_capacity)
121#define psa_generator_read \
122 PSA_FUNCTION_NAME(psa_generator_read)
123#define psa_generator_import_key \
124 PSA_FUNCTION_NAME(psa_generator_import_key)
125#define psa_generator_abort \
126 PSA_FUNCTION_NAME(psa_generator_abort)
127#define psa_key_derivation \
128 PSA_FUNCTION_NAME(psa_key_derivation)
129#define psa_key_agreement \
130 PSA_FUNCTION_NAME(psa_key_agreement)
131#define psa_generate_random \
132 PSA_FUNCTION_NAME(psa_generate_random)
133#define psa_generate_key \
134 PSA_FUNCTION_NAME(psa_generate_key)
135
136#endif /* CRYPTO_SPE_H */