1 /**
2  * This file is intended to be used to build PSA test driver libraries. It is
3  * intended to be appended by the test build system to the crypto_config.h file
4  * of the Mbed TLS library the test library will be linked to. It mirrors the
5  * PSA_ACCEL_* macros defining the cryptographic operations the test library
6  * supports.
7  */
8 
9 #if defined(PSA_WANT_ALG_CBC_NO_PADDING)
10 #if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)
11 #undef MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
12 #else
13 #define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING 1
14 #endif
15 #endif
16 
17 #if defined(PSA_WANT_ALG_CBC_PKCS7)
18 #if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)
19 #undef MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
20 #else
21 #define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7 1
22 #endif
23 #endif
24 
25 #if defined(PSA_WANT_ALG_CFB)
26 #if defined(MBEDTLS_PSA_ACCEL_ALG_CFB)
27 #undef MBEDTLS_PSA_ACCEL_ALG_CFB
28 #else
29 #define MBEDTLS_PSA_ACCEL_ALG_CFB 1
30 #endif
31 #endif
32 
33 #if defined(PSA_WANT_ALG_CTR)
34 #if defined(MBEDTLS_PSA_ACCEL_ALG_CTR)
35 #undef MBEDTLS_PSA_ACCEL_ALG_CTR
36 #else
37 #define MBEDTLS_PSA_ACCEL_ALG_CTR 1
38 #endif
39 #endif
40 
41 #if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
42 #if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
43 #undef MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
44 #else
45 #define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA 1
46 #endif
47 #endif
48 
49 #if defined(PSA_WANT_ALG_ECDSA)
50 #if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
51 #undef MBEDTLS_PSA_ACCEL_ALG_ECDSA
52 #else
53 #define MBEDTLS_PSA_ACCEL_ALG_ECDSA 1
54 #endif
55 #endif
56 
57 #if defined(PSA_WANT_ALG_ECDH)
58 #if defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
59 #undef MBEDTLS_PSA_ACCEL_ALG_ECDH
60 #else
61 #define MBEDTLS_PSA_ACCEL_ALG_ECDH 1
62 #endif
63 #endif
64 
65 #if defined(PSA_WANT_ALG_MD5)
66 #if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
67 #undef MBEDTLS_PSA_ACCEL_ALG_MD5
68 #else
69 #define MBEDTLS_PSA_ACCEL_ALG_MD5 1
70 #endif
71 #endif
72 
73 #if defined(PSA_WANT_ALG_OFB)
74 #if defined(MBEDTLS_PSA_ACCEL_ALG_OFB)
75 #undef MBEDTLS_PSA_ACCEL_ALG_OFB
76 #else
77 #define MBEDTLS_PSA_ACCEL_ALG_OFB 1
78 #endif
79 #endif
80 
81 #if defined(PSA_WANT_ALG_RIPEMD160)
82 #if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
83 #undef MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
84 #else
85 #define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160 1
86 #endif
87 #endif
88 
89 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
90 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
91 #undef MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
92 #else
93 #define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN 1
94 #endif
95 #endif
96 
97 #if defined(PSA_WANT_ALG_RSA_PSS)
98 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
99 #undef MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
100 #else
101 #define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS 1
102 #endif
103 #endif
104 
105 #if defined(PSA_WANT_ALG_SHA_1)
106 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
107 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_1
108 #else
109 #define MBEDTLS_PSA_ACCEL_ALG_SHA_1 1
110 #endif
111 #endif
112 
113 #if defined(PSA_WANT_ALG_SHA_224)
114 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
115 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_224
116 #else
117 #define MBEDTLS_PSA_ACCEL_ALG_SHA_224 1
118 #endif
119 #endif
120 
121 #if defined(PSA_WANT_ALG_SHA_256)
122 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
123 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_256
124 #else
125 #define MBEDTLS_PSA_ACCEL_ALG_SHA_256 1
126 #endif
127 #endif
128 
129 #if defined(PSA_WANT_ALG_SHA_384)
130 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
131 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_384
132 #else
133 #define MBEDTLS_PSA_ACCEL_ALG_SHA_384 1
134 #endif
135 #endif
136 
137 #if defined(PSA_WANT_ALG_SHA_512)
138 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
139 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_512
140 #else
141 #define MBEDTLS_PSA_ACCEL_ALG_SHA_512 1
142 #endif
143 #endif
144 
145 #if defined(PSA_WANT_ALG_XTS)
146 #if defined(MBEDTLS_PSA_ACCEL_ALG_XTS)
147 #undef MBEDTLS_PSA_ACCEL_ALG_XTS
148 #else
149 #define MBEDTLS_PSA_ACCEL_ALG_XTS 1
150 #endif
151 #endif
152 
153 #if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
154 #if defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305)
155 #undef MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305
156 #else
157 #define MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 1
158 #endif
159 #endif
160 
161 #if defined(PSA_WANT_ALG_JPAKE)
162 #if defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE)
163 #undef MBEDTLS_PSA_ACCEL_ALG_JPAKE
164 #else
165 #define MBEDTLS_PSA_ACCEL_ALG_JPAKE 1
166 #endif
167 #endif
168 
169 #if defined(PSA_WANT_KEY_TYPE_AES)
170 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
171 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
172 #else
173 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES 1
174 #endif
175 #endif
176 
177 #if defined(PSA_WANT_KEY_TYPE_ARIA)
178 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
179 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA
180 #else
181 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA 1
182 #endif
183 #endif
184 
185 #if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
186 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
187 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
188 #else
189 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA 1
190 #endif
191 #endif
192 
193 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
194 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR)
195 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR
196 #else
197 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR 1
198 #endif
199 #endif
200 
201 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
202 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR)
203 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR
204 #else
205 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR 1
206 #endif
207 #endif
208 
209 #if defined(PSA_WANT_KEY_TYPE_CHACHA20)
210 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20)
211 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20
212 #else
213 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 1
214 #endif
215 #endif
216 
217 #if defined(PSA_WANT_ALG_TLS12_PRF)
218 #if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
219 #undef MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF
220 #else
221 #define MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF 1
222 #endif
223 #endif
224 
225 #if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
226 #if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
227 #undef MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS
228 #else
229 #define MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS 1
230 #endif
231 #endif
232 
233 #if defined(PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS)
234 #if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS)
235 #undef MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS
236 #else
237 #define MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS 1
238 #endif
239 #endif
240 
241 #define MBEDTLS_PSA_ACCEL_ALG_CBC_MAC 1
242 #define MBEDTLS_PSA_ACCEL_ALG_CCM 1
243 #define MBEDTLS_PSA_ACCEL_ALG_CMAC 1
244 #define MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING 1
245 #define MBEDTLS_PSA_ACCEL_ALG_GCM 1
246 #define MBEDTLS_PSA_ACCEL_ALG_HKDF 1
247 #define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT 1
248 #define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND 1
249 #define MBEDTLS_PSA_ACCEL_ALG_HMAC 1
250 #define MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP 1
251 #define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT 1
252 #define MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER 1
253 
254 #if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) && \
255     defined(MBEDTLS_PSA_ACCEL_ALG_ECDH) && \
256     defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE)
257 #define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 1
258 #define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 1
259 #define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 1
260 #define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 1
261 #define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 1
262 #define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 1
263 #define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 1
264 #define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 1
265 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 1
266 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 1
267 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 1
268 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 1
269 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 1
270 #endif
271 
272 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DERIVE 1
273 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_HMAC 1
274 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DES 1
275 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY 1
276 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RAW_DATA 1
277 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY 1
278