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 #include "psa/crypto_legacy.h"
10 
11 #if defined(PSA_WANT_ALG_CBC_NO_PADDING)
12 #if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)
13 #undef MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
14 #else
15 #define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING 1
16 #endif
17 #endif
18 
19 #if defined(PSA_WANT_ALG_CBC_PKCS7)
20 #if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)
21 #undef MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
22 #else
23 #define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7 1
24 #endif
25 #endif
26 
27 #if defined(PSA_WANT_ALG_CFB)
28 #if defined(MBEDTLS_PSA_ACCEL_ALG_CFB)
29 #undef MBEDTLS_PSA_ACCEL_ALG_CFB
30 #else
31 #define MBEDTLS_PSA_ACCEL_ALG_CFB 1
32 #endif
33 #endif
34 
35 #if defined(PSA_WANT_ALG_CTR)
36 #if defined(MBEDTLS_PSA_ACCEL_ALG_CTR)
37 #undef MBEDTLS_PSA_ACCEL_ALG_CTR
38 #else
39 #define MBEDTLS_PSA_ACCEL_ALG_CTR 1
40 #endif
41 #endif
42 
43 #if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
44 #if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
45 #undef MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
46 #else
47 #define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA 1
48 #endif
49 #endif
50 
51 #if defined(PSA_WANT_ALG_ECDSA)
52 #if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
53 #undef MBEDTLS_PSA_ACCEL_ALG_ECDSA
54 #else
55 #define MBEDTLS_PSA_ACCEL_ALG_ECDSA 1
56 #endif
57 #endif
58 
59 #if defined(PSA_WANT_ALG_ECDH)
60 #if defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
61 #undef MBEDTLS_PSA_ACCEL_ALG_ECDH
62 #else
63 #define MBEDTLS_PSA_ACCEL_ALG_ECDH 1
64 #endif
65 #endif
66 
67 #if defined(PSA_WANT_ALG_FFDH)
68 #if defined(MBEDTLS_PSA_ACCEL_ALG_FFDH)
69 #undef MBEDTLS_PSA_ACCEL_ALG_FFDH
70 #else
71 #define MBEDTLS_PSA_ACCEL_ALG_FFDH 1
72 #endif
73 #endif
74 
75 #if defined(PSA_WANT_ALG_MD5)
76 #if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
77 #undef MBEDTLS_PSA_ACCEL_ALG_MD5
78 #else
79 #define MBEDTLS_PSA_ACCEL_ALG_MD5 1
80 #endif
81 #endif
82 
83 #if defined(PSA_WANT_ALG_OFB)
84 #if defined(MBEDTLS_PSA_ACCEL_ALG_OFB)
85 #undef MBEDTLS_PSA_ACCEL_ALG_OFB
86 #else
87 #define MBEDTLS_PSA_ACCEL_ALG_OFB 1
88 #endif
89 #endif
90 
91 #if defined(PSA_WANT_ALG_RIPEMD160)
92 #if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
93 #undef MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
94 #else
95 #define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160 1
96 #endif
97 #endif
98 
99 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
100 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
101 #undef MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
102 #else
103 #define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN 1
104 #endif
105 #endif
106 
107 #if defined(PSA_WANT_ALG_RSA_PSS)
108 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
109 #undef MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
110 #else
111 #define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS 1
112 #endif
113 #endif
114 
115 #if defined(PSA_WANT_ALG_SHA_1)
116 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
117 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_1
118 #else
119 #define MBEDTLS_PSA_ACCEL_ALG_SHA_1 1
120 #endif
121 #endif
122 
123 #if defined(PSA_WANT_ALG_SHA_224)
124 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
125 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_224
126 #else
127 #define MBEDTLS_PSA_ACCEL_ALG_SHA_224 1
128 #endif
129 #endif
130 
131 #if defined(PSA_WANT_ALG_SHA_256)
132 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
133 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_256
134 #else
135 #define MBEDTLS_PSA_ACCEL_ALG_SHA_256 1
136 #endif
137 #endif
138 
139 #if defined(PSA_WANT_ALG_SHA_384)
140 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
141 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_384
142 #else
143 #define MBEDTLS_PSA_ACCEL_ALG_SHA_384 1
144 #endif
145 #endif
146 
147 #if defined(PSA_WANT_ALG_SHA_512)
148 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
149 #undef MBEDTLS_PSA_ACCEL_ALG_SHA_512
150 #else
151 #define MBEDTLS_PSA_ACCEL_ALG_SHA_512 1
152 #endif
153 #endif
154 
155 #if defined(PSA_WANT_ALG_SHA3_224)
156 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224)
157 #undef MBEDTLS_PSA_ACCEL_ALG_SHA3_224
158 #else
159 #define MBEDTLS_PSA_ACCEL_ALG_SHA3_224 1
160 #endif
161 #endif
162 
163 #if defined(PSA_WANT_ALG_SHA3_256)
164 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256)
165 #undef MBEDTLS_PSA_ACCEL_ALG_SHA3_256
166 #else
167 #define MBEDTLS_PSA_ACCEL_ALG_SHA3_256 1
168 #endif
169 #endif
170 
171 #if defined(PSA_WANT_ALG_SHA3_384)
172 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384)
173 #undef MBEDTLS_PSA_ACCEL_ALG_SHA3_384
174 #else
175 #define MBEDTLS_PSA_ACCEL_ALG_SHA3_384 1
176 #endif
177 #endif
178 
179 #if defined(PSA_WANT_ALG_SHA3_512)
180 #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512)
181 #undef MBEDTLS_PSA_ACCEL_ALG_SHA3_512
182 #else
183 #define MBEDTLS_PSA_ACCEL_ALG_SHA3_512 1
184 #endif
185 #endif
186 
187 #if defined(PSA_WANT_ALG_XTS)
188 #if defined(MBEDTLS_PSA_ACCEL_ALG_XTS)
189 #undef MBEDTLS_PSA_ACCEL_ALG_XTS
190 #else
191 #define MBEDTLS_PSA_ACCEL_ALG_XTS 1
192 #endif
193 #endif
194 
195 #if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
196 #if defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305)
197 #undef MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305
198 #else
199 #define MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 1
200 #endif
201 #endif
202 
203 #if defined(PSA_WANT_ALG_JPAKE)
204 #if defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE)
205 #undef MBEDTLS_PSA_ACCEL_ALG_JPAKE
206 #else
207 #define MBEDTLS_PSA_ACCEL_ALG_JPAKE 1
208 #endif
209 #endif
210 
211 #if defined(PSA_WANT_KEY_TYPE_AES)
212 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
213 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
214 #else
215 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES 1
216 #endif
217 #endif
218 
219 #if defined(PSA_WANT_KEY_TYPE_ARIA)
220 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
221 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA
222 #else
223 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA 1
224 #endif
225 #endif
226 
227 #if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
228 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
229 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
230 #else
231 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA 1
232 #endif
233 #endif
234 
235 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC)
236 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC)
237 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC
238 #else
239 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
240 #endif
241 #endif
242 
243 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
244 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
245 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT
246 #else
247 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
248 #endif
249 #endif
250 
251 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
252 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
253 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT
254 #else
255 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
256 #endif
257 #endif
258 
259 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
260 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
261 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE
262 #else
263 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1
264 #endif
265 #endif
266 
267 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
268 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
269 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE
270 #else
271 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1
272 #endif
273 #endif
274 
275 #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC)
276 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC)
277 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC
278 #else
279 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC 1
280 #endif
281 #endif
282 
283 #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT)
284 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT)
285 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT
286 #else
287 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
288 #endif
289 #endif
290 
291 #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT)
292 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT)
293 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT
294 #else
295 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
296 #endif
297 #endif
298 
299 #if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE)
300 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE)
301 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE
302 #else
303 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
304 #endif
305 #endif
306 
307 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC)
308 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC)
309 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC
310 #else
311 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
312 #endif
313 #endif
314 
315 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
316 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
317 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT
318 #else
319 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
320 #endif
321 #endif
322 
323 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
324 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
325 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT
326 #else
327 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
328 #endif
329 #endif
330 
331 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
332 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
333 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE
334 #else
335 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
336 #endif
337 #endif
338 
339 #if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
340 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
341 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY
342 #else
343 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY 1
344 #endif
345 #endif
346 
347 #if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
348 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
349 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY
350 #else
351 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY 1
352 #endif
353 #endif
354 
355 #if defined(PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY)
356 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY)
357 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY
358 #else
359 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY 1
360 #endif
361 #endif
362 
363 #if defined(PSA_WANT_KEY_TYPE_CHACHA20)
364 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20)
365 #undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20
366 #else
367 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 1
368 #endif
369 #endif
370 
371 
372 #if defined(PSA_WANT_ALG_TLS12_PRF)
373 #if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
374 #undef MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF
375 #else
376 #define MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF 1
377 #endif
378 #endif
379 
380 #if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
381 #if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
382 #undef MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS
383 #else
384 #define MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS 1
385 #endif
386 #endif
387 
388 #if defined(PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS)
389 #if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS)
390 #undef MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS
391 #else
392 #define MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS 1
393 #endif
394 #endif
395 
396 #define MBEDTLS_PSA_ACCEL_ALG_CBC_MAC 1
397 #define MBEDTLS_PSA_ACCEL_ALG_CCM 1
398 #define MBEDTLS_PSA_ACCEL_ALG_CMAC 1
399 #define MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING 1
400 #define MBEDTLS_PSA_ACCEL_ALG_GCM 1
401 #define MBEDTLS_PSA_ACCEL_ALG_HKDF 1
402 #define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT 1
403 #define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND 1
404 #define MBEDTLS_PSA_ACCEL_ALG_HMAC 1
405 #define MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP 1
406 #define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT 1
407 #define MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER 1
408 
409 #if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) && \
410     defined(MBEDTLS_PSA_ACCEL_ALG_ECDH) && \
411     defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE)
412 #define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 1
413 #define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 1
414 #define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 1
415 #define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 1
416 #define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 1
417 #define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 1
418 #define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 1
419 #define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 1
420 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 1
421 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 1
422 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 1
423 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 1
424 #define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 1
425 #endif
426 
427 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DERIVE 1
428 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_HMAC 1
429 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_DES 1
430 #define MBEDTLS_PSA_ACCEL_KEY_TYPE_RAW_DATA 1
431