blob: 2ceaefdc6689f517a3b0acda2d6d9213cac7784b [file] [log] [blame]
Jamie Fox0e54ebc2019-04-09 14:21:04 +01001/*
Antonio de Angelis04debbd2019-10-14 12:12:52 +01002 * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
Jamie Fox0e54ebc2019-04-09 14:21:04 +01003 *
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)
Antonio de Angelis04debbd2019-10-14 12:12:52 +010027#define psa_key_derivation_get_capacity \
28 PSA_FUNCTION_NAME(psa_key_derivation_get_capacity)
29#define psa_key_derivation_set_capacity \
30 PSA_FUNCTION_NAME(psa_key_derivation_set_capacity)
31#define psa_key_derivation_input_bytes \
32 PSA_FUNCTION_NAME(psa_key_derivation_input_bytes)
33#define psa_key_derivation_output_bytes \
34 PSA_FUNCTION_NAME(psa_key_derivation_output_bytes)
35#define psa_key_derivation_input_key \
36 PSA_FUNCTION_NAME(psa_key_derivation_input_key)
37#define psa_key_derivation_output_key \
38 PSA_FUNCTION_NAME(psa_key_derivation_output_key)
39#define psa_key_derivation_setup \
40 PSA_FUNCTION_NAME(psa_key_derivation_setup)
41#define psa_key_derivation_abort \
42 PSA_FUNCTION_NAME(psa_key_derivation_abort)
43#define psa_key_derivation_key_agreement \
44 PSA_FUNCTION_NAME(psa_key_derivation_key_agreement)
45#define psa_raw_key_agreement \
46 PSA_FUNCTION_NAME(psa_raw_key_agreement)
47#define psa_generate_random \
48 PSA_FUNCTION_NAME(psa_generate_random)
49#define psa_aead_encrypt \
50 PSA_FUNCTION_NAME(psa_aead_encrypt)
51#define psa_aead_decrypt \
52 PSA_FUNCTION_NAME(psa_aead_decrypt)
Jamie Fox0e54ebc2019-04-09 14:21:04 +010053#define psa_open_key \
54 PSA_FUNCTION_NAME(psa_open_key)
Jamie Fox0e54ebc2019-04-09 14:21:04 +010055#define psa_close_key \
56 PSA_FUNCTION_NAME(psa_close_key)
57#define psa_import_key \
58 PSA_FUNCTION_NAME(psa_import_key)
59#define psa_destroy_key \
60 PSA_FUNCTION_NAME(psa_destroy_key)
Antonio de Angelis04debbd2019-10-14 12:12:52 +010061#define psa_get_key_attributes \
62 PSA_FUNCTION_NAME(psa_get_key_attributes)
63#define psa_reset_key_attributes \
64 PSA_FUNCTION_NAME(psa_reset_key_attributes)
Jamie Fox0e54ebc2019-04-09 14:21:04 +010065#define psa_export_key \
66 PSA_FUNCTION_NAME(psa_export_key)
67#define psa_export_public_key \
68 PSA_FUNCTION_NAME(psa_export_public_key)
69#define psa_copy_key \
70 PSA_FUNCTION_NAME(psa_copy_key)
Antonio de Angelis04debbd2019-10-14 12:12:52 +010071#define psa_cipher_operation_init \
72 PSA_FUNCTION_NAME(psa_cipher_operation_init)
73#define psa_cipher_generate_iv \
74 PSA_FUNCTION_NAME(psa_cipher_generate_iv)
75#define psa_cipher_set_iv \
76 PSA_FUNCTION_NAME(psa_cipher_set_iv)
77#define psa_cipher_encrypt_setup \
78 PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
79#define psa_cipher_decrypt_setup \
80 PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
81#define psa_cipher_update \
82 PSA_FUNCTION_NAME(psa_cipher_update)
83#define psa_cipher_finish \
84 PSA_FUNCTION_NAME(psa_cipher_finish)
85#define psa_cipher_abort \
86 PSA_FUNCTION_NAME(psa_cipher_abort)
Jamie Fox0e54ebc2019-04-09 14:21:04 +010087#define psa_hash_operation_init \
88 PSA_FUNCTION_NAME(psa_hash_operation_init)
89#define psa_hash_setup \
90 PSA_FUNCTION_NAME(psa_hash_setup)
91#define psa_hash_update \
92 PSA_FUNCTION_NAME(psa_hash_update)
93#define psa_hash_finish \
94 PSA_FUNCTION_NAME(psa_hash_finish)
95#define psa_hash_verify \
96 PSA_FUNCTION_NAME(psa_hash_verify)
97#define psa_hash_abort \
98 PSA_FUNCTION_NAME(psa_hash_abort)
99#define psa_hash_clone \
100 PSA_FUNCTION_NAME(psa_hash_clone)
Soby Mathew07ef6e42020-07-20 21:09:23 +0100101#define psa_hash_compute \
102 PSA_FUNCTION_NAME(psa_hash_compute)
103#define psa_hash_compare \
104 PSA_FUNCTION_NAME(psa_hash_compare)
Jamie Fox0e54ebc2019-04-09 14:21:04 +0100105#define psa_mac_operation_init \
106 PSA_FUNCTION_NAME(psa_mac_operation_init)
107#define psa_mac_sign_setup \
108 PSA_FUNCTION_NAME(psa_mac_sign_setup)
109#define psa_mac_verify_setup \
110 PSA_FUNCTION_NAME(psa_mac_verify_setup)
111#define psa_mac_update \
112 PSA_FUNCTION_NAME(psa_mac_update)
113#define psa_mac_sign_finish \
114 PSA_FUNCTION_NAME(psa_mac_sign_finish)
115#define psa_mac_verify_finish \
116 PSA_FUNCTION_NAME(psa_mac_verify_finish)
117#define psa_mac_abort \
118 PSA_FUNCTION_NAME(psa_mac_abort)
Antonio de Angelis04debbd2019-10-14 12:12:52 +0100119#define psa_sign_hash \
120 PSA_FUNCTION_NAME(psa_sign_hash)
121#define psa_verify_hash \
122 PSA_FUNCTION_NAME(psa_verify_hash)
Jamie Fox0e54ebc2019-04-09 14:21:04 +0100123#define psa_asymmetric_encrypt \
124 PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
125#define psa_asymmetric_decrypt \
126 PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
Jamie Fox0e54ebc2019-04-09 14:21:04 +0100127#define psa_generate_key \
128 PSA_FUNCTION_NAME(psa_generate_key)
Antonio de Angelis04debbd2019-10-14 12:12:52 +0100129#define psa_set_key_domain_parameters \
130 PSA_FUNCTION_NAME(psa_set_key_domain_parameters)
131#define psa_get_key_domain_parameters \
132 PSA_FUNCTION_NAME(psa_get_key_domain_parameters)
Jamie Fox0e54ebc2019-04-09 14:21:04 +0100133
134#endif /* CRYPTO_SPE_H */