30 #ifndef MBEDTLS_CONFIG_PSA_H
31 #define MBEDTLS_CONFIG_PSA_H
33 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
35 #include "mbedTLS_crypto_config.h"
51 #if defined(PSA_WANT_ALG_ECDSA_ANY) && !defined(PSA_WANT_ALG_ECDSA)
52 #define PSA_WANT_ALG_ECDSA PSA_WANT_ALG_ECDSA_ANY
53 #elif !defined(PSA_WANT_ALG_ECDSA_ANY) && defined(PSA_WANT_ALG_ECDSA)
54 #define PSA_WANT_ALG_ECDSA_ANY PSA_WANT_ALG_ECDSA
57 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
58 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW
59 #elif !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
60 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW PSA_WANT_ALG_RSA_PKCS1V15_SIGN
63 #if defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && !defined(PSA_WANT_ALG_RSA_PSS)
64 #define PSA_WANT_ALG_RSA_PSS PSA_WANT_ALG_RSA_PSS_ANY_SALT
65 #elif !defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && defined(PSA_WANT_ALG_RSA_PSS)
66 #define PSA_WANT_ALG_RSA_PSS_ANY_SALT PSA_WANT_ALG_RSA_PSS
75 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
77 #if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
78 #if !defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
79 #define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
80 #define MBEDTLS_ECDSA_DETERMINISTIC
81 #define MBEDTLS_ECDSA_C
82 #define MBEDTLS_HMAC_DRBG_C
87 #if defined(PSA_WANT_ALG_ECDH)
88 #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
89 #define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
90 #define MBEDTLS_ECDH_C
92 #define MBEDTLS_BIGNUM_C
96 #if defined(PSA_WANT_ALG_ECDSA)
97 #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
98 #define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
99 #define MBEDTLS_ECDSA_C
100 #define MBEDTLS_ECP_C
101 #define MBEDTLS_BIGNUM_C
102 #define MBEDTLS_ASN1_PARSE_C
103 #define MBEDTLS_ASN1_WRITE_C
107 #if defined(PSA_WANT_ALG_HKDF)
108 #if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)
109 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
110 #define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
114 #if defined(PSA_WANT_ALG_HMAC)
115 #if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
116 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
120 #if defined(PSA_WANT_ALG_MD5) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
121 #define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
122 #define MBEDTLS_MD5_C
125 #if defined(PSA_WANT_ALG_RIPEMD160) && !defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
126 #define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
127 #define MBEDTLS_RIPEMD160_C
130 #if defined(PSA_WANT_ALG_RSA_OAEP)
131 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
132 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
133 #define MBEDTLS_RSA_C
134 #define MBEDTLS_BIGNUM_C
135 #define MBEDTLS_OID_C
136 #define MBEDTLS_PKCS1_V21
141 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT)
142 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT)
143 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
144 #define MBEDTLS_RSA_C
145 #define MBEDTLS_BIGNUM_C
146 #define MBEDTLS_OID_C
147 #define MBEDTLS_PKCS1_V15
151 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
152 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
153 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
154 #define MBEDTLS_RSA_C
155 #define MBEDTLS_BIGNUM_C
156 #define MBEDTLS_OID_C
157 #define MBEDTLS_PKCS1_V15
162 #if defined(PSA_WANT_ALG_RSA_PSS)
163 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
164 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
165 #define MBEDTLS_RSA_C
166 #define MBEDTLS_BIGNUM_C
167 #define MBEDTLS_OID_C
168 #define MBEDTLS_PKCS1_V21
173 #if defined(PSA_WANT_ALG_SHA_1) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
174 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
175 #define MBEDTLS_SHA1_C
178 #if defined(PSA_WANT_ALG_SHA_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
179 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
180 #define MBEDTLS_SHA224_C
183 #if defined(PSA_WANT_ALG_SHA_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
184 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
185 #define MBEDTLS_SHA256_C
188 #if defined(PSA_WANT_ALG_SHA_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
189 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
190 #define MBEDTLS_SHA384_C
193 #if defined(PSA_WANT_ALG_SHA_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
194 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
195 #define MBEDTLS_SHA512_C
198 #if defined(PSA_WANT_ALG_TLS12_PRF)
199 #if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
200 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
204 #if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
205 #if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
206 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
210 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
211 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR)
212 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1
213 #define MBEDTLS_ECP_C
214 #define MBEDTLS_BIGNUM_C
218 #if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
219 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
220 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
221 #define MBEDTLS_ECP_C
222 #define MBEDTLS_BIGNUM_C
226 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
227 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR)
228 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1
229 #define MBEDTLS_RSA_C
230 #define MBEDTLS_BIGNUM_C
231 #define MBEDTLS_OID_C
232 #define MBEDTLS_GENPRIME
233 #define MBEDTLS_PK_PARSE_C
234 #define MBEDTLS_PK_WRITE_C
236 #define MBEDTLS_ASN1_PARSE_C
237 #define MBEDTLS_ASN1_WRITE_C
241 #if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
242 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
243 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
244 #define MBEDTLS_RSA_C
245 #define MBEDTLS_BIGNUM_C
246 #define MBEDTLS_OID_C
247 #define MBEDTLS_PK_PARSE_C
248 #define MBEDTLS_PK_WRITE_C
250 #define MBEDTLS_ASN1_PARSE_C
251 #define MBEDTLS_ASN1_WRITE_C
258 #if (defined(PSA_WANT_ALG_CTR) && !defined(MBEDTLS_PSA_ACCEL_ALG_CTR)) || \
259 (defined(PSA_WANT_ALG_CFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_CFB)) || \
260 (defined(PSA_WANT_ALG_OFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_OFB)) || \
261 (defined(PSA_WANT_ALG_XTS) && !defined(MBEDTLS_PSA_ACCEL_ALG_XTS)) || \
262 defined(PSA_WANT_ALG_ECB_NO_PADDING) || \
263 (defined(PSA_WANT_ALG_CBC_NO_PADDING) && \
264 !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \
265 (defined(PSA_WANT_ALG_CBC_PKCS7) && \
266 !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)) || \
267 (defined(PSA_WANT_ALG_CMAC) && !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC))
268 #define PSA_HAVE_SOFT_BLOCK_MODE 1
271 #if (defined(PSA_WANT_ALG_GCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_GCM)) || \
272 (defined(PSA_WANT_ALG_CCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_CCM))
273 #define PSA_HAVE_SOFT_BLOCK_AEAD 1
276 #if defined(PSA_WANT_KEY_TYPE_AES)
277 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
278 #define PSA_HAVE_SOFT_KEY_TYPE_AES 1
280 #if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
281 defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
282 defined(PSA_HAVE_SOFT_BLOCK_AEAD)
283 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
284 #define MBEDTLS_AES_C
288 #if defined(PSA_WANT_KEY_TYPE_ARIA)
289 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
290 #define PSA_HAVE_SOFT_KEY_TYPE_ARIA 1
292 #if defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
293 defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
294 defined(PSA_HAVE_SOFT_BLOCK_AEAD)
295 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1
296 #define MBEDTLS_ARIA_C
300 #if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
301 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
302 #define PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA 1
304 #if defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) || \
305 defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
306 defined(PSA_HAVE_SOFT_BLOCK_AEAD)
307 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
308 #define MBEDTLS_CAMELLIA_C
312 #if defined(PSA_WANT_KEY_TYPE_DES)
313 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES)
314 #define PSA_HAVE_SOFT_KEY_TYPE_DES 1
316 #if defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
317 defined(PSA_HAVE_SOFT_BLOCK_MODE)
318 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
319 #define MBEDTLS_DES_C
323 #if defined(PSA_WANT_KEY_TYPE_CHACHA20)
324 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20)
325 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
326 #define MBEDTLS_CHACHA20_C
333 #if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
334 defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
335 defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
336 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
337 #define PSA_HAVE_SOFT_BLOCK_CIPHER 1
340 #if defined(PSA_WANT_ALG_STREAM_CIPHER)
341 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
344 #if defined(PSA_WANT_ALG_CBC_MAC)
345 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_MAC)
346 #error "CBC-MAC is not yet supported via the PSA API in Mbed TLS."
347 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_MAC 1
351 #if defined(PSA_WANT_ALG_CMAC)
352 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) || \
353 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
354 #define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
355 #define MBEDTLS_CMAC_C
359 #if defined(PSA_WANT_ALG_CTR)
360 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CTR) || \
361 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
362 #define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
363 #define MBEDTLS_CIPHER_MODE_CTR
367 #if defined(PSA_WANT_ALG_CFB)
368 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CFB) || \
369 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
370 #define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
371 #define MBEDTLS_CIPHER_MODE_CFB
375 #if defined(PSA_WANT_ALG_OFB)
376 #if !defined(MBEDTLS_PSA_ACCEL_ALG_OFB) || \
377 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
378 #define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
379 #define MBEDTLS_CIPHER_MODE_OFB
383 #if defined(PSA_WANT_ALG_XTS)
384 #if !defined(MBEDTLS_PSA_ACCEL_ALG_XTS) || \
385 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
386 #define MBEDTLS_PSA_BUILTIN_ALG_XTS 1
387 #define MBEDTLS_CIPHER_MODE_XTS
391 #if defined(PSA_WANT_ALG_ECB_NO_PADDING)
392 #define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
395 #if defined(PSA_WANT_ALG_CBC_NO_PADDING)
396 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING) || \
397 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
398 #define MBEDTLS_CIPHER_MODE_CBC
399 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
403 #if defined(PSA_WANT_ALG_CBC_PKCS7)
404 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7) || \
405 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
406 #define MBEDTLS_CIPHER_MODE_CBC
407 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
408 #define MBEDTLS_CIPHER_PADDING_PKCS7
412 #if defined(PSA_WANT_ALG_CCM)
413 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CCM) || \
414 defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
415 defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
416 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
417 #define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
418 #define MBEDTLS_CCM_C
422 #if defined(PSA_WANT_ALG_GCM)
423 #if !defined(MBEDTLS_PSA_ACCEL_ALG_GCM) || \
424 defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
425 defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \
426 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
427 #define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
428 #define MBEDTLS_GCM_C
432 #if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
433 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305)
434 #if defined(PSA_WANT_KEY_TYPE_CHACHA20)
435 #define MBEDTLS_CHACHAPOLY_C
436 #define MBEDTLS_POLY1305_C
437 #define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
442 #if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
443 #if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256)
444 #define MBEDTLS_ECP_DP_BP256R1_ENABLED
445 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
449 #if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
450 #if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384)
451 #define MBEDTLS_ECP_DP_BP384R1_ENABLED
452 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
456 #if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
457 #if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512)
458 #define MBEDTLS_ECP_DP_BP512R1_ENABLED
459 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
463 #if defined(PSA_WANT_ECC_MONTGOMERY_255)
464 #if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255)
465 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
466 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
470 #if defined(PSA_WANT_ECC_MONTGOMERY_448)
471 #if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448)
472 #define MBEDTLS_ECP_DP_CURVE448_ENABLED
473 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
477 #if defined(PSA_WANT_ECC_SECP_R1_192)
478 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192)
479 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
480 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
484 #if defined(PSA_WANT_ECC_SECP_R1_224)
485 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224)
486 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
487 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
491 #if defined(PSA_WANT_ECC_SECP_R1_256)
492 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256)
493 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
494 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
498 #if defined(PSA_WANT_ECC_SECP_R1_384)
499 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)
500 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
501 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
505 #if defined(PSA_WANT_ECC_SECP_R1_521)
506 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)
507 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED
508 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
512 #if defined(PSA_WANT_ECC_SECP_K1_192)
513 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)
514 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED
515 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
519 #if defined(PSA_WANT_ECC_SECP_K1_224)
520 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224)
525 #error "SECP224K1 is buggy via the PSA API in Mbed TLS."
526 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED
527 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
531 #if defined(PSA_WANT_ECC_SECP_K1_256)
532 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256)
533 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED
534 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
551 #if defined(MBEDTLS_CCM_C)
552 #define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
553 #define PSA_WANT_ALG_CCM 1
556 #if defined(MBEDTLS_CMAC_C)
557 #define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
558 #define PSA_WANT_ALG_CMAC 1
561 #if defined(MBEDTLS_ECDH_C)
562 #define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
563 #define PSA_WANT_ALG_ECDH 1
566 #if defined(MBEDTLS_ECDSA_C)
567 #define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
568 #define PSA_WANT_ALG_ECDSA 1
569 #define PSA_WANT_ALG_ECDSA_ANY 1
572 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
573 #define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
574 #define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1
579 #if defined(MBEDTLS_ECP_C)
580 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1
581 #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1
582 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
583 #define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
586 #if defined(MBEDTLS_GCM_C)
587 #define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
588 #define PSA_WANT_ALG_GCM 1
591 #if defined(MBEDTLS_HKDF_C)
592 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
593 #define PSA_WANT_ALG_HMAC 1
594 #define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
595 #define PSA_WANT_ALG_HKDF 1
598 #if defined(MBEDTLS_MD_C)
599 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
600 #define PSA_WANT_ALG_HMAC 1
601 #define PSA_WANT_KEY_TYPE_HMAC
602 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
603 #define PSA_WANT_ALG_TLS12_PRF 1
604 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
605 #define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
608 #if defined(MBEDTLS_MD5_C)
609 #define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
610 #define PSA_WANT_ALG_MD5 1
613 #if defined(MBEDTLS_RIPEMD160_C)
614 #define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
615 #define PSA_WANT_ALG_RIPEMD160 1
618 #if defined(MBEDTLS_RSA_C)
619 #if defined(MBEDTLS_PKCS1_V15)
620 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
621 #define PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1
622 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
623 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1
624 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW 1
626 #if defined(MBEDTLS_PKCS1_V21)
627 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
628 #define PSA_WANT_ALG_RSA_OAEP 1
629 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
630 #define PSA_WANT_ALG_RSA_PSS 1
632 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1
633 #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
634 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
635 #define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
638 #if defined(MBEDTLS_SHA1_C)
639 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
640 #define PSA_WANT_ALG_SHA_1 1
643 #if defined(MBEDTLS_SHA224_C)
644 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
645 #define PSA_WANT_ALG_SHA_224 1
648 #if defined(MBEDTLS_SHA256_C)
649 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
650 #define PSA_WANT_ALG_SHA_256 1
653 #if defined(MBEDTLS_SHA384_C)
654 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
655 #define PSA_WANT_ALG_SHA_384 1
658 #if defined(MBEDTLS_SHA512_C)
659 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
660 #define PSA_WANT_ALG_SHA_512 1
663 #if defined(MBEDTLS_AES_C)
664 #define PSA_WANT_KEY_TYPE_AES 1
665 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
668 #if defined(MBEDTLS_ARIA_C)
669 #define PSA_WANT_KEY_TYPE_ARIA 1
670 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1
673 #if defined(MBEDTLS_CAMELLIA_C)
674 #define PSA_WANT_KEY_TYPE_CAMELLIA 1
675 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
678 #if defined(MBEDTLS_DES_C)
679 #define PSA_WANT_KEY_TYPE_DES 1
680 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
683 #if defined(MBEDTLS_CHACHA20_C)
684 #define PSA_WANT_KEY_TYPE_CHACHA20 1
685 #define PSA_WANT_ALG_STREAM_CIPHER 1
686 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
687 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
688 #if defined(MBEDTLS_CHACHAPOLY_C)
689 #define PSA_WANT_ALG_CHACHA20_POLY1305 1
690 #define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
694 #if defined(MBEDTLS_CIPHER_MODE_CBC)
695 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
696 #define PSA_WANT_ALG_CBC_NO_PADDING 1
697 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
698 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
699 #define PSA_WANT_ALG_CBC_PKCS7 1
703 #if defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) || \
704 defined(MBEDTLS_ARIA_C) || defined(MBEDTLS_CAMELLIA_C)
705 #define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
706 #define PSA_WANT_ALG_ECB_NO_PADDING 1
709 #if defined(MBEDTLS_CIPHER_MODE_CFB)
710 #define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
711 #define PSA_WANT_ALG_CFB 1
714 #if defined(MBEDTLS_CIPHER_MODE_CTR)
715 #define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
716 #define PSA_WANT_ALG_CTR 1
719 #if defined(MBEDTLS_CIPHER_MODE_OFB)
720 #define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
721 #define PSA_WANT_ALG_OFB 1
724 #if defined(MBEDTLS_CIPHER_MODE_XTS)
725 #define MBEDTLS_PSA_BUILTIN_ALG_XTS 1
726 #define PSA_WANT_ALG_XTS 1
729 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
730 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
731 #define PSA_WANT_ECC_BRAINPOOL_P_R1_256
734 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
735 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
736 #define PSA_WANT_ECC_BRAINPOOL_P_R1_384
739 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
740 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
741 #define PSA_WANT_ECC_BRAINPOOL_P_R1_512
744 #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
745 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
746 #define PSA_WANT_ECC_MONTGOMERY_255
749 #if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
750 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
751 #define PSA_WANT_ECC_MONTGOMERY_448
754 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
755 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
756 #define PSA_WANT_ECC_SECP_R1_192
759 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
760 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
761 #define PSA_WANT_ECC_SECP_R1_224
764 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
765 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
766 #define PSA_WANT_ECC_SECP_R1_256
769 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
770 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
771 #define PSA_WANT_ECC_SECP_R1_384
774 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
775 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
776 #define PSA_WANT_ECC_SECP_R1_521
779 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
780 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
781 #define PSA_WANT_ECC_SECP_K1_192
785 #if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
786 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
787 #define PSA_WANT_ECC_SECP_K1_224
790 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
791 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
792 #define PSA_WANT_ECC_SECP_K1_256
798 #define PSA_WANT_KEY_TYPE_DERIVE 1
799 #define PSA_WANT_KEY_TYPE_RAW_DATA 1
PSA crypto configuration options (set of defines)