30#ifndef MBEDTLS_CONFIG_PSA_H
31#define MBEDTLS_CONFIG_PSA_H
33#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
41#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
43#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
44#if !defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
45#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
46#define MBEDTLS_ECDSA_DETERMINISTIC
47#define MBEDTLS_ECDSA_C
48#define MBEDTLS_HMAC_DRBG_C
53#if defined(PSA_WANT_ALG_ECDH)
54#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
55#define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
58#define MBEDTLS_BIGNUM_C
62#if defined(PSA_WANT_ALG_ECDSA)
63#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
64#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
65#define MBEDTLS_ECDSA_C
69#if defined(PSA_WANT_ALG_HKDF)
70#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)
71#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
72#define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
76#if defined(PSA_WANT_ALG_HMAC)
77#if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
78#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
82#if defined(PSA_WANT_ALG_MD2) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD2)
83#define MBEDTLS_PSA_BUILTIN_ALG_MD2 1
87#if defined(PSA_WANT_ALG_MD4) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD4)
88#define MBEDTLS_PSA_BUILTIN_ALG_MD4 1
92#if defined(PSA_WANT_ALG_MD5) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
93#define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
97#if defined(PSA_WANT_ALG_RIPEMD160) && !defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
98#define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
99#define MBEDTLS_RIPEMD160_C
102#if defined(PSA_WANT_ALG_RSA_OAEP)
103#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
104#define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
106#define MBEDTLS_BIGNUM_C
108#define MBEDTLS_PKCS1_V21
113#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT)
114#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT)
115#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
117#define MBEDTLS_BIGNUM_C
119#define MBEDTLS_PKCS1_V15
123#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
124#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
125#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
127#define MBEDTLS_BIGNUM_C
129#define MBEDTLS_PKCS1_V15
134#if defined(PSA_WANT_ALG_RSA_PSS)
135#if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
136#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
138#define MBEDTLS_BIGNUM_C
140#define MBEDTLS_PKCS1_V21
145#if defined(PSA_WANT_ALG_SHA_1) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
146#define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
147#define MBEDTLS_SHA1_C
150#if defined(PSA_WANT_ALG_SHA_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
151#define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
152#define MBEDTLS_SHA256_C
155#if defined(PSA_WANT_ALG_SHA_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
156#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
157#define MBEDTLS_SHA256_C
160#if defined(PSA_WANT_ALG_SHA_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
161#define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
162#define MBEDTLS_SHA512_C
165#if defined(PSA_WANT_ALG_SHA_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
166#define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
167#define MBEDTLS_SHA512_C
170#if defined(PSA_WANT_ALG_TLS12_PRF)
171#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
172#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
176#if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
177#if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
178#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
182#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
183#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR)
184#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1
186#define MBEDTLS_BIGNUM_C
190#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
191#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
192#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
194#define MBEDTLS_BIGNUM_C
198#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
199#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR)
200#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1
202#define MBEDTLS_BIGNUM_C
204#define MBEDTLS_GENPRIME
205#define MBEDTLS_PK_PARSE_C
206#define MBEDTLS_PK_WRITE_C
211#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
212#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
213#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
215#define MBEDTLS_BIGNUM_C
217#define MBEDTLS_PK_PARSE_C
218#define MBEDTLS_PK_WRITE_C
230#if defined(MBEDTLS_ECDH_C)
231#define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
232#define PSA_WANT_ALG_ECDH 1
235#if defined(MBEDTLS_ECDSA_C)
236#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
237#define PSA_WANT_ALG_ECDSA 1
240#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
241#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
242#define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1
247#if defined(MBEDTLS_ECP_C)
248#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1
249#define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1
250#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
251#define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
254#if defined(MBEDTLS_HKDF_C)
255#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
256#define PSA_WANT_ALG_HMAC 1
257#define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
258#define PSA_WANT_ALG_HKDF 1
261#if defined(MBEDTLS_MD_C)
262#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
263#define PSA_WANT_ALG_HMAC 1
264#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
265#define PSA_WANT_ALG_TLS12_PRF 1
266#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
267#define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
270#if defined(MBEDTLS_MD2_C)
271#define MBEDTLS_PSA_BUILTIN_ALG_MD2 1
272#define PSA_WANT_ALG_MD2 1
275#if defined(MBEDTLS_MD4_C)
276#define MBEDTLS_PSA_BUILTIN_ALG_MD4 1
277#define PSA_WANT_ALG_MD4 1
280#if defined(MBEDTLS_MD5_C)
281#define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
282#define PSA_WANT_ALG_MD5 1
285#if defined(MBEDTLS_RIPEMD160_C)
286#define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
287#define PSA_WANT_ALG_RIPEMD160 1
290#if defined(MBEDTLS_RSA_C)
291#if defined(MBEDTLS_PKCS1_V15)
292#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
293#define PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1
294#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
295#define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1
297#if defined(MBEDTLS_PKCS1_V21)
298#define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
299#define PSA_WANT_ALG_RSA_OAEP 1
300#define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
301#define PSA_WANT_ALG_RSA_PSS 1
303#if defined(MBEDTLS_GENPRIME)
304#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1
305#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
307#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
308#define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
311#if defined(MBEDTLS_SHA1_C)
312#define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
313#define PSA_WANT_ALG_SHA_1 1
316#if defined(MBEDTLS_SHA256_C)
317#define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
318#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
319#define PSA_WANT_ALG_SHA_256 1
322#if defined(MBEDTLS_SHA512_C)
323#if !defined(MBEDTLS_SHA512_NO_SHA384)
324#define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
325#define PSA_WANT_ALG_SHA_384 1
327#define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
328#define PSA_WANT_ALG_SHA_512 1
PSA crypto configuration options (set of defines)