2 * \file mbedtls/config_psa.h
3 * \brief PSA crypto configuration options (set of defines)
5 * This set of compile-time options takes settings defined in
6 * include/mbedtls/config.h and include/psa/crypto_config.h and uses
7 * those definitions to define symbols used in the library code.
9 * Users and integrators should not edit this file, please edit
10 * include/mbedtls/config.h for MBETLS_XXX settings or
11 * include/psa/crypto_config.h for PSA_WANT_XXX settings.
14 * Copyright The Mbed TLS Contributors
15 * SPDX-License-Identifier: Apache-2.0
17 * Licensed under the Apache License, Version 2.0 (the "License"); you may
18 * not use this file except in compliance with the License.
19 * You may obtain a copy of the License at
21 * http://www.apache.org/licenses/LICENSE-2.0
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
30 #ifndef MBEDTLS_CONFIG_PSA_H
31 #define MBEDTLS_CONFIG_PSA_H
33 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
34 #include "psa/crypto_config.h"
35 #endif /* 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
50 #endif /* !MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA */
51 #endif /* PSA_WANT_ALG_DETERMINISTIC_ECDSA */
53 #if defined(PSA_WANT_ALG_ECDH)
54 #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
55 #define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
56 #define MBEDTLS_ECDH_C
58 #define MBEDTLS_BIGNUM_C
59 #endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDH */
60 #endif /* PSA_WANT_ALG_ECDH */
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
66 #endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDSA */
67 #endif /* PSA_WANT_ALG_ECDSA */
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
73 #endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF */
74 #endif /* PSA_WANT_ALG_HKDF */
76 #if defined(PSA_WANT_ALG_HMAC)
77 #if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
78 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
79 #endif /* !MBEDTLS_PSA_ACCEL_ALG_HMAC */
80 #endif /* PSA_WANT_ALG_HMAC */
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
105 #define MBEDTLS_RSA_C
106 #define MBEDTLS_BIGNUM_C
107 #define MBEDTLS_OID_C
108 #define MBEDTLS_PKCS1_V21
110 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP */
111 #endif /* PSA_WANT_ALG_RSA_OAEP */
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
116 #define MBEDTLS_RSA_C
117 #define MBEDTLS_BIGNUM_C
118 #define MBEDTLS_OID_C
119 #define MBEDTLS_PKCS1_V15
120 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT */
121 #endif /* PSA_WANT_ALG_RSA_PKCS1V15_CRYPT */
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
126 #define MBEDTLS_RSA_C
127 #define MBEDTLS_BIGNUM_C
128 #define MBEDTLS_OID_C
129 #define MBEDTLS_PKCS1_V15
131 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN */
132 #endif /* PSA_WANT_ALG_RSA_PKCS1V15_SIGN */
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
137 #define MBEDTLS_RSA_C
138 #define MBEDTLS_BIGNUM_C
139 #define MBEDTLS_OID_C
140 #define MBEDTLS_PKCS1_V21
142 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PSS */
143 #endif /* PSA_WANT_ALG_RSA_PSS */
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
173 #endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF */
174 #endif /* PSA_WANT_ALG_TLS12_PRF */
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
179 #endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS */
180 #endif /* PSA_WANT_ALG_TLS12_PSK_TO_MS */
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
185 #define MBEDTLS_ECP_C
186 #define MBEDTLS_BIGNUM_C
187 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR */
188 #endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR */
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
193 #define MBEDTLS_ECP_C
194 #define MBEDTLS_BIGNUM_C
195 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY */
196 #endif /* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */
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
201 #define MBEDTLS_RSA_C
202 #define MBEDTLS_BIGNUM_C
203 #define MBEDTLS_OID_C
204 #define MBEDTLS_GENPRIME
205 #define MBEDTLS_PK_PARSE_C
206 #define MBEDTLS_PK_WRITE_C
208 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR */
209 #endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR */
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
214 #define MBEDTLS_RSA_C
215 #define MBEDTLS_BIGNUM_C
216 #define MBEDTLS_OID_C
217 #define MBEDTLS_PK_PARSE_C
218 #define MBEDTLS_PK_WRITE_C
220 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY */
221 #endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY */
223 /* If any of the block modes are requested that don't have an
224 * associated HW assist, define PSA_HAVE_SOFT_BLOCK_MODE for checking
225 * in the block cipher key types. */
226 #if (defined(PSA_WANT_ALG_CTR) && !defined(MBEDTLS_PSA_ACCEL_ALG_CTR)) || \
227 (defined(PSA_WANT_ALG_CFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_CFB)) || \
228 (defined(PSA_WANT_ALG_OFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_OFB)) || \
229 (defined(PSA_WANT_ALG_XTS) && !defined(MBEDTLS_PSA_ACCEL_ALG_XTS)) || \
230 defined(PSA_WANT_ALG_ECB_NO_PADDING) || \
231 (defined(PSA_WANT_ALG_CBC_NO_PADDING) && \
232 !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \
233 (defined(PSA_WANT_ALG_CBC_PKCS7) && \
234 !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7))
235 #define PSA_HAVE_SOFT_BLOCK_MODE 1
238 #if defined(PSA_WANT_KEY_TYPE_AES)
239 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
240 #define PSA_HAVE_SOFT_KEY_TYPE_AES 1
241 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_AES */
242 #if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
243 defined(PSA_HAVE_SOFT_BLOCK_MODE)
244 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
245 #define MBEDTLS_AES_C
246 #endif /* PSA_HAVE_SOFT_KEY_TYPE_AES || PSA_HAVE_SOFT_BLOCK_MODE */
247 #endif /* PSA_WANT_KEY_TYPE_AES */
249 #if defined(PSA_WANT_KEY_TYPE_ARC4)
250 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARC4)
251 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARC4 1
252 #define MBEDTLS_ARC4_C
253 #endif /*!MBEDTLS_PSA_ACCEL_KEY_TYPE_ARC4 */
254 #endif /* PSA_WANT_KEY_TYPE_ARC4 */
256 #if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
257 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
258 #define PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA 1
259 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA */
260 #if defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) || \
261 defined(PSA_HAVE_SOFT_BLOCK_MODE)
262 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
263 #define MBEDTLS_CAMELLIA_C
264 #endif /* PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA || PSA_HAVE_SOFT_BLOCK_MODE */
265 #endif /* PSA_WANT_KEY_TYPE_CAMELLIA */
267 #if defined(PSA_WANT_KEY_TYPE_DES)
268 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES)
269 #define PSA_HAVE_SOFT_KEY_TYPE_DES 1
270 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DES */
271 #if defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
272 defined(PSA_HAVE_SOFT_BLOCK_MODE)
273 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
274 #define MBEDTLS_DES_C
275 #endif /*PSA_HAVE_SOFT_KEY_TYPE_DES || PSA_HAVE_SOFT_BLOCK_MODE */
276 #endif /* PSA_WANT_KEY_TYPE_DES */
278 #if defined(PSA_WANT_KEY_TYPE_CHACHA20)
279 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20)
280 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
281 #define MBEDTLS_CHACHA20_C
282 #endif /*!MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 */
283 #endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
285 /* If any of the software block ciphers are selected, define
286 * PSA_HAVE_SOFT_BLOCK_CIPHER, which can be used in any of these
288 #if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
289 defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \
290 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
291 #define PSA_HAVE_SOFT_BLOCK_CIPHER 1
294 #if defined(PSA_WANT_ALG_STREAM_CIPHER)
295 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
296 #endif /* PSA_WANT_ALG_STREAM_CIPHER */
298 #if defined(PSA_WANT_ALG_CTR)
299 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CTR) || \
300 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
301 #define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
302 #define MBEDTLS_CIPHER_MODE_CTR
304 #endif /* PSA_WANT_ALG_CTR */
306 #if defined(PSA_WANT_ALG_CFB)
307 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CFB) || \
308 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
309 #define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
310 #define MBEDTLS_CIPHER_MODE_CFB
312 #endif /* PSA_WANT_ALG_CFB */
314 #if defined(PSA_WANT_ALG_OFB)
315 #if !defined(MBEDTLS_PSA_ACCEL_ALG_OFB) || \
316 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
317 #define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
318 #define MBEDTLS_CIPHER_MODE_OFB
320 #endif /* PSA_WANT_ALG_OFB */
322 #if defined(PSA_WANT_ALG_XTS)
323 #if !defined(MBEDTLS_PSA_ACCEL_ALG_XTS) || \
324 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
325 #define MBEDTLS_PSA_BUILTIN_ALG_XTS 1
326 #define MBEDTLS_CIPHER_MODE_XTS
328 #endif /* PSA_WANT_ALG_XTS */
330 #if defined(PSA_WANT_ALG_ECB_NO_PADDING)
331 #define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
334 #if defined(PSA_WANT_ALG_CBC_NO_PADDING)
335 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING) || \
336 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
337 #define MBEDTLS_CIPHER_MODE_CBC
338 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
340 #endif /* PSA_WANT_ALG_CBC_NO_PADDING */
342 #if defined(PSA_WANT_ALG_CBC_PKCS7)
343 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7) || \
344 defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
345 #define MBEDTLS_CIPHER_MODE_CBC
346 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
347 #define MBEDTLS_CIPHER_PADDING_PKCS7
349 #endif /* PSA_WANT_ALG_CBC_PKCS7 */
351 #if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
352 #if defined(PSA_WANT_KEY_TYPE_CHACHA20)
353 #define MBEDTLS_CHACHAPOLY_C
354 #define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
355 #endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
356 #endif /* PSA_WANT_ALG_CHACHA20_POLY1305 */
358 #else /* MBEDTLS_PSA_CRYPTO_CONFIG */
361 * Ensure PSA_WANT_* defines are setup properly if MBEDTLS_PSA_CRYPTO_CONFIG
365 #if defined(MBEDTLS_ECDH_C)
366 #define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
367 #define PSA_WANT_ALG_ECDH 1
368 #endif /* MBEDTLS_ECDH_C */
370 #if defined(MBEDTLS_ECDSA_C)
371 #define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1
372 #define PSA_WANT_ALG_ECDSA 1
374 // Only add in DETERMINISTIC support if ECDSA is also enabled
375 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
376 #define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1
377 #define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1
378 #endif /* MBEDTLS_ECDSA_DETERMINISTIC */
380 #endif /* MBEDTLS_ECDSA_C */
382 #if defined(MBEDTLS_ECP_C)
383 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1
384 #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1
385 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1
386 #define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
387 #endif /* MBEDTLS_ECP_C */
389 #if defined(MBEDTLS_HKDF_C)
390 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
391 #define PSA_WANT_ALG_HMAC 1
392 #define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
393 #define PSA_WANT_ALG_HKDF 1
394 #endif /* MBEDTLS_HKDF_C */
396 #if defined(MBEDTLS_MD_C)
397 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
398 #define PSA_WANT_ALG_HMAC 1
399 #define PSA_WANT_KEY_TYPE_HMAC
400 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
401 #define PSA_WANT_ALG_TLS12_PRF 1
402 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
403 #define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
404 #endif /* MBEDTLS_MD_C */
406 #if defined(MBEDTLS_MD2_C)
407 #define MBEDTLS_PSA_BUILTIN_ALG_MD2 1
408 #define PSA_WANT_ALG_MD2 1
411 #if defined(MBEDTLS_MD4_C)
412 #define MBEDTLS_PSA_BUILTIN_ALG_MD4 1
413 #define PSA_WANT_ALG_MD4 1
416 #if defined(MBEDTLS_MD5_C)
417 #define MBEDTLS_PSA_BUILTIN_ALG_MD5 1
418 #define PSA_WANT_ALG_MD5 1
421 #if defined(MBEDTLS_RIPEMD160_C)
422 #define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1
423 #define PSA_WANT_ALG_RIPEMD160 1
426 #if defined(MBEDTLS_RSA_C)
427 #if defined(MBEDTLS_PKCS1_V15)
428 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1
429 #define PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1
430 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1
431 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1
432 #endif /* MBEDTLSS_PKCS1_V15 */
433 #if defined(MBEDTLS_PKCS1_V21)
434 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1
435 #define PSA_WANT_ALG_RSA_OAEP 1
436 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1
437 #define PSA_WANT_ALG_RSA_PSS 1
438 #endif /* MBEDTLS_PKCS1_V21 */
439 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1
440 #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
441 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1
442 #define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
443 #endif /* MBEDTLS_RSA_C */
445 #if defined(MBEDTLS_SHA1_C)
446 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1
447 #define PSA_WANT_ALG_SHA_1 1
450 #if defined(MBEDTLS_SHA256_C)
451 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1
452 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
453 #define PSA_WANT_ALG_SHA_224 1
454 #define PSA_WANT_ALG_SHA_256 1
457 #if defined(MBEDTLS_SHA512_C)
458 #if !defined(MBEDTLS_SHA512_NO_SHA384)
459 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1
460 #define PSA_WANT_ALG_SHA_384 1
462 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1
463 #define PSA_WANT_ALG_SHA_512 1
466 #if defined(MBEDTLS_AES_C)
467 #define PSA_WANT_KEY_TYPE_AES 1
468 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
471 #if defined(MBEDTLS_ARC4_C)
472 #define PSA_WANT_KEY_TYPE_ARC4 1
473 #define PSA_WANT_ALG_STREAM_CIPHER 1
474 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARC4 1
475 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
478 #if defined(MBEDTLS_CAMELLIA_C)
479 #define PSA_WANT_KEY_TYPE_CAMELLIA 1
480 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
483 #if defined(MBEDTLS_DES_C)
484 #define PSA_WANT_KEY_TYPE_DES 1
485 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1
488 #if defined(MBEDTLS_CHACHA20_C)
489 #define PSA_WANT_KEY_TYPE_CHACHA20 1
490 #define PSA_WANT_ALG_STREAM_CIPHER 1
491 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1
492 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
493 #if defined(MBEDTLS_CHACHAPOLY_C)
494 #define PSA_WANT_ALG_CHACHA20_POLY1305 1
495 #define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1
499 #if defined(MBEDTLS_CIPHER_MODE_CBC)
500 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1
501 #define PSA_WANT_ALG_CBC_NO_PADDING 1
502 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
503 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1
504 #define PSA_WANT_ALG_CBC_PKCS7 1
508 #if defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) || \
509 defined(MBEDTLS_CAMELLIA_C)
510 #define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
511 #define PSA_WANT_ALG_ECB_NO_PADDING 1
514 #if defined(MBEDTLS_CIPHER_MODE_CFB)
515 #define MBEDTLS_PSA_BUILTIN_ALG_CFB 1
516 #define PSA_WANT_ALG_CFB 1
519 #if defined(MBEDTLS_CIPHER_MODE_CTR)
520 #define MBEDTLS_PSA_BUILTIN_ALG_CTR 1
521 #define PSA_WANT_ALG_CTR 1
524 #if defined(MBEDTLS_CIPHER_MODE_OFB)
525 #define MBEDTLS_PSA_BUILTIN_ALG_OFB 1
526 #define PSA_WANT_ALG_OFB 1
529 #if defined(MBEDTLS_CIPHER_MODE_XTS)
530 #define MBEDTLS_PSA_BUILTIN_ALG_XTS 1
531 #define PSA_WANT_ALG_XTS 1
534 #endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
536 /* These features are always enabled. */
537 #define PSA_WANT_KEY_TYPE_DERIVE 1
538 #define PSA_WANT_KEY_TYPE_RAW_DATA 1
544 #endif /* MBEDTLS_CONFIG_PSA_H */