1 /** 2 * \file mbedtls/config_psa.h 3 * \brief PSA crypto configuration options (set of defines) 4 * 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. 8 * 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. 12 */ 13 /* 14 * Copyright The Mbed TLS Contributors 15 * SPDX-License-Identifier: Apache-2.0 16 * 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 20 * 21 * http://www.apache.org/licenses/LICENSE-2.0 22 * 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. 28 */ 29 30 #ifndef MBEDTLS_CONFIG_PSA_H 31 #define MBEDTLS_CONFIG_PSA_H 32 33 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) 34 #include "psa/crypto_config.h" 35 #endif /* defined(MBEDTLS_PSA_CRYPTO_CONFIG) */ 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 42 43 /****************************************************************/ 44 /* De facto synonyms */ 45 /****************************************************************/ 46 47 #if defined(PSA_WANT_ALG_ECDSA_ANY) && !defined(PSA_WANT_ALG_ECDSA) 48 #define PSA_WANT_ALG_ECDSA PSA_WANT_ALG_ECDSA_ANY 49 #elif !defined(PSA_WANT_ALG_ECDSA_ANY) && defined(PSA_WANT_ALG_ECDSA) 50 #define PSA_WANT_ALG_ECDSA_ANY PSA_WANT_ALG_ECDSA 51 #endif 52 53 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) 54 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW 55 #elif !defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW) && defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) 56 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW PSA_WANT_ALG_RSA_PKCS1V15_SIGN 57 #endif 58 59 #if defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && !defined(PSA_WANT_ALG_RSA_PSS) 60 #define PSA_WANT_ALG_RSA_PSS PSA_WANT_ALG_RSA_PSS_ANY_SALT 61 #elif !defined(PSA_WANT_ALG_RSA_PSS_ANY_SALT) && defined(PSA_WANT_ALG_RSA_PSS) 62 #define PSA_WANT_ALG_RSA_PSS_ANY_SALT PSA_WANT_ALG_RSA_PSS 63 #endif 64 65 66 67 /****************************************************************/ 68 /* Require built-in implementations based on PSA requirements */ 69 /****************************************************************/ 70 71 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) 72 73 #if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) 74 #if !defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA) 75 #define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1 76 #define MBEDTLS_ECDSA_DETERMINISTIC 77 #define MBEDTLS_ECDSA_C 78 #define MBEDTLS_HMAC_DRBG_C 79 #define MBEDTLS_MD_C 80 #endif /* !MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA */ 81 #endif /* PSA_WANT_ALG_DETERMINISTIC_ECDSA */ 82 83 #if defined(PSA_WANT_ALG_ECDH) 84 #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDH) 85 #define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1 86 #define MBEDTLS_ECDH_C 87 #define MBEDTLS_ECP_C 88 #define MBEDTLS_BIGNUM_C 89 #endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDH */ 90 #endif /* PSA_WANT_ALG_ECDH */ 91 92 #if defined(PSA_WANT_ALG_ECDSA) 93 #if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) 94 #define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1 95 #define MBEDTLS_ECDSA_C 96 #define MBEDTLS_ECP_C 97 #define MBEDTLS_BIGNUM_C 98 #define MBEDTLS_ASN1_PARSE_C 99 #define MBEDTLS_ASN1_WRITE_C 100 #endif /* !MBEDTLS_PSA_ACCEL_ALG_ECDSA */ 101 #endif /* PSA_WANT_ALG_ECDSA */ 102 103 #if defined(PSA_WANT_ALG_HKDF) 104 #if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF) 105 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1 106 #define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1 107 #endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF */ 108 #endif /* PSA_WANT_ALG_HKDF */ 109 110 #if defined(PSA_WANT_ALG_HMAC) 111 #if !defined(MBEDTLS_PSA_ACCEL_ALG_HMAC) 112 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1 113 #endif /* !MBEDTLS_PSA_ACCEL_ALG_HMAC */ 114 #endif /* PSA_WANT_ALG_HMAC */ 115 116 #if defined(PSA_WANT_ALG_MD2) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD2) 117 #define MBEDTLS_PSA_BUILTIN_ALG_MD2 1 118 #define MBEDTLS_MD2_C 119 #endif 120 121 #if defined(PSA_WANT_ALG_MD4) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD4) 122 #define MBEDTLS_PSA_BUILTIN_ALG_MD4 1 123 #define MBEDTLS_MD4_C 124 #endif 125 126 #if defined(PSA_WANT_ALG_MD5) && !defined(MBEDTLS_PSA_ACCEL_ALG_MD5) 127 #define MBEDTLS_PSA_BUILTIN_ALG_MD5 1 128 #define MBEDTLS_MD5_C 129 #endif 130 131 #if defined(PSA_WANT_ALG_RIPEMD160) && !defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160) 132 #define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1 133 #define MBEDTLS_RIPEMD160_C 134 #endif 135 136 #if defined(PSA_WANT_ALG_RSA_OAEP) 137 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP) 138 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1 139 #define MBEDTLS_RSA_C 140 #define MBEDTLS_BIGNUM_C 141 #define MBEDTLS_OID_C 142 #define MBEDTLS_PKCS1_V21 143 #define MBEDTLS_MD_C 144 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP */ 145 #endif /* PSA_WANT_ALG_RSA_OAEP */ 146 147 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) 148 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT) 149 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1 150 #define MBEDTLS_RSA_C 151 #define MBEDTLS_BIGNUM_C 152 #define MBEDTLS_OID_C 153 #define MBEDTLS_PKCS1_V15 154 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT */ 155 #endif /* PSA_WANT_ALG_RSA_PKCS1V15_CRYPT */ 156 157 #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) 158 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) 159 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1 160 #define MBEDTLS_RSA_C 161 #define MBEDTLS_BIGNUM_C 162 #define MBEDTLS_OID_C 163 #define MBEDTLS_PKCS1_V15 164 #define MBEDTLS_MD_C 165 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN */ 166 #endif /* PSA_WANT_ALG_RSA_PKCS1V15_SIGN */ 167 168 #if defined(PSA_WANT_ALG_RSA_PSS) 169 #if !defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS) 170 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1 171 #define MBEDTLS_RSA_C 172 #define MBEDTLS_BIGNUM_C 173 #define MBEDTLS_OID_C 174 #define MBEDTLS_PKCS1_V21 175 #define MBEDTLS_MD_C 176 #endif /* !MBEDTLS_PSA_ACCEL_ALG_RSA_PSS */ 177 #endif /* PSA_WANT_ALG_RSA_PSS */ 178 179 #if defined(PSA_WANT_ALG_SHA_1) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1) 180 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1 181 #define MBEDTLS_SHA1_C 182 #endif 183 184 #if defined(PSA_WANT_ALG_SHA_224) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224) 185 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1 186 #define MBEDTLS_SHA256_C 187 #endif 188 189 #if defined(PSA_WANT_ALG_SHA_256) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256) 190 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1 191 #define MBEDTLS_SHA256_C 192 #endif 193 194 #if defined(PSA_WANT_ALG_SHA_384) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384) 195 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1 196 #define MBEDTLS_SHA512_C 197 #endif 198 199 #if defined(PSA_WANT_ALG_SHA_512) && !defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512) 200 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1 201 #define MBEDTLS_SHA512_C 202 #endif 203 204 #if defined(PSA_WANT_ALG_TLS12_PRF) 205 #if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF) 206 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1 207 #endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF */ 208 #endif /* PSA_WANT_ALG_TLS12_PRF */ 209 210 #if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS) 211 #if !defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS) 212 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1 213 #endif /* !MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS */ 214 #endif /* PSA_WANT_ALG_TLS12_PSK_TO_MS */ 215 216 #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) 217 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) 218 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1 219 #define MBEDTLS_ECP_C 220 #define MBEDTLS_BIGNUM_C 221 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR */ 222 #endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR */ 223 224 #if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) 225 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY) 226 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1 227 #define MBEDTLS_ECP_C 228 #define MBEDTLS_BIGNUM_C 229 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY */ 230 #endif /* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */ 231 232 #if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) 233 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) 234 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1 235 #define MBEDTLS_RSA_C 236 #define MBEDTLS_BIGNUM_C 237 #define MBEDTLS_OID_C 238 #define MBEDTLS_GENPRIME 239 #define MBEDTLS_PK_PARSE_C 240 #define MBEDTLS_PK_WRITE_C 241 #define MBEDTLS_PK_C 242 #define MBEDTLS_ASN1_PARSE_C 243 #define MBEDTLS_ASN1_WRITE_C 244 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR */ 245 #endif /* PSA_WANT_KEY_TYPE_RSA_KEY_PAIR */ 246 247 #if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) 248 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY) 249 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1 250 #define MBEDTLS_RSA_C 251 #define MBEDTLS_BIGNUM_C 252 #define MBEDTLS_OID_C 253 #define MBEDTLS_PK_PARSE_C 254 #define MBEDTLS_PK_WRITE_C 255 #define MBEDTLS_PK_C 256 #define MBEDTLS_ASN1_PARSE_C 257 #define MBEDTLS_ASN1_WRITE_C 258 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY */ 259 #endif /* PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY */ 260 261 /* If any of the block modes are requested that don't have an 262 * associated HW assist, define PSA_HAVE_SOFT_BLOCK_MODE for checking 263 * in the block cipher key types. */ 264 #if (defined(PSA_WANT_ALG_CTR) && !defined(MBEDTLS_PSA_ACCEL_ALG_CTR)) || \ 265 (defined(PSA_WANT_ALG_CFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_CFB)) || \ 266 (defined(PSA_WANT_ALG_OFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_OFB)) || \ 267 (defined(PSA_WANT_ALG_XTS) && !defined(MBEDTLS_PSA_ACCEL_ALG_XTS)) || \ 268 defined(PSA_WANT_ALG_ECB_NO_PADDING) || \ 269 (defined(PSA_WANT_ALG_CBC_NO_PADDING) && \ 270 !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \ 271 (defined(PSA_WANT_ALG_CBC_PKCS7) && \ 272 !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)) || \ 273 (defined(PSA_WANT_ALG_CMAC) && !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC)) 274 #define PSA_HAVE_SOFT_BLOCK_MODE 1 275 #endif 276 277 #if (defined(PSA_WANT_ALG_GCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_GCM)) || \ 278 (defined(PSA_WANT_ALG_CCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_CCM)) 279 #define PSA_HAVE_SOFT_BLOCK_AEAD 1 280 #endif 281 282 #if defined(PSA_WANT_KEY_TYPE_AES) 283 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES) 284 #define PSA_HAVE_SOFT_KEY_TYPE_AES 1 285 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_AES */ 286 #if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \ 287 defined(PSA_HAVE_SOFT_BLOCK_MODE) || \ 288 defined(PSA_HAVE_SOFT_BLOCK_AEAD) 289 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1 290 #define MBEDTLS_AES_C 291 #endif /* PSA_HAVE_SOFT_KEY_TYPE_AES || PSA_HAVE_SOFT_BLOCK_MODE */ 292 #endif /* PSA_WANT_KEY_TYPE_AES */ 293 294 #if defined(PSA_WANT_KEY_TYPE_ARC4) 295 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARC4) 296 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARC4 1 297 #define MBEDTLS_ARC4_C 298 #endif /*!MBEDTLS_PSA_ACCEL_KEY_TYPE_ARC4 */ 299 #endif /* PSA_WANT_KEY_TYPE_ARC4 */ 300 301 #if defined(PSA_WANT_KEY_TYPE_ARIA) 302 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA) 303 #define PSA_HAVE_SOFT_KEY_TYPE_ARIA 1 304 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA */ 305 #if defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \ 306 defined(PSA_HAVE_SOFT_BLOCK_MODE) || \ 307 defined(PSA_HAVE_SOFT_BLOCK_AEAD) 308 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1 309 #define MBEDTLS_ARIA_C 310 #endif /* PSA_HAVE_SOFT_KEY_TYPE_ARIA || PSA_HAVE_SOFT_BLOCK_MODE */ 311 #endif /* PSA_WANT_KEY_TYPE_ARIA */ 312 313 #if defined(PSA_WANT_KEY_TYPE_CAMELLIA) 314 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA) 315 #define PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA 1 316 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA */ 317 #if defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) || \ 318 defined(PSA_HAVE_SOFT_BLOCK_MODE) || \ 319 defined(PSA_HAVE_SOFT_BLOCK_AEAD) 320 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1 321 #define MBEDTLS_CAMELLIA_C 322 #endif /* PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA || PSA_HAVE_SOFT_BLOCK_MODE */ 323 #endif /* PSA_WANT_KEY_TYPE_CAMELLIA */ 324 325 #if defined(PSA_WANT_KEY_TYPE_DES) 326 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES) 327 #define PSA_HAVE_SOFT_KEY_TYPE_DES 1 328 #endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_DES */ 329 #if defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \ 330 defined(PSA_HAVE_SOFT_BLOCK_MODE) 331 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1 332 #define MBEDTLS_DES_C 333 #endif /*PSA_HAVE_SOFT_KEY_TYPE_DES || PSA_HAVE_SOFT_BLOCK_MODE */ 334 #endif /* PSA_WANT_KEY_TYPE_DES */ 335 336 #if defined(PSA_WANT_KEY_TYPE_CHACHA20) 337 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20) 338 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1 339 #define MBEDTLS_CHACHA20_C 340 #endif /*!MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 */ 341 #endif /* PSA_WANT_KEY_TYPE_CHACHA20 */ 342 343 /* If any of the software block ciphers are selected, define 344 * PSA_HAVE_SOFT_BLOCK_CIPHER, which can be used in any of these 345 * situations. */ 346 #if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \ 347 defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \ 348 defined(PSA_HAVE_SOFT_KEY_TYPE_DES) || \ 349 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) 350 #define PSA_HAVE_SOFT_BLOCK_CIPHER 1 351 #endif 352 353 #if defined(PSA_WANT_ALG_STREAM_CIPHER) 354 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1 355 #endif /* PSA_WANT_ALG_STREAM_CIPHER */ 356 357 #if defined(PSA_WANT_ALG_CBC_MAC) 358 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_MAC) 359 #error "CBC-MAC is not yet supported via the PSA API in Mbed TLS." 360 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_MAC 1 361 #endif /* !MBEDTLS_PSA_ACCEL_ALG_CBC_MAC */ 362 #endif /* PSA_WANT_ALG_CBC_MAC */ 363 364 #if defined(PSA_WANT_ALG_CMAC) 365 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) || \ 366 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 367 #define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1 368 #define MBEDTLS_CMAC_C 369 #endif /* !MBEDTLS_PSA_ACCEL_ALG_CMAC */ 370 #endif /* PSA_WANT_ALG_CMAC */ 371 372 #if defined(PSA_WANT_ALG_CTR) 373 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CTR) || \ 374 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 375 #define MBEDTLS_PSA_BUILTIN_ALG_CTR 1 376 #define MBEDTLS_CIPHER_MODE_CTR 377 #endif 378 #endif /* PSA_WANT_ALG_CTR */ 379 380 #if defined(PSA_WANT_ALG_CFB) 381 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CFB) || \ 382 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 383 #define MBEDTLS_PSA_BUILTIN_ALG_CFB 1 384 #define MBEDTLS_CIPHER_MODE_CFB 385 #endif 386 #endif /* PSA_WANT_ALG_CFB */ 387 388 #if defined(PSA_WANT_ALG_OFB) 389 #if !defined(MBEDTLS_PSA_ACCEL_ALG_OFB) || \ 390 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 391 #define MBEDTLS_PSA_BUILTIN_ALG_OFB 1 392 #define MBEDTLS_CIPHER_MODE_OFB 393 #endif 394 #endif /* PSA_WANT_ALG_OFB */ 395 396 #if defined(PSA_WANT_ALG_XTS) 397 #if !defined(MBEDTLS_PSA_ACCEL_ALG_XTS) || \ 398 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 399 #define MBEDTLS_PSA_BUILTIN_ALG_XTS 1 400 #define MBEDTLS_CIPHER_MODE_XTS 401 #endif 402 #endif /* PSA_WANT_ALG_XTS */ 403 404 #if defined(PSA_WANT_ALG_ECB_NO_PADDING) 405 #define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1 406 #endif 407 408 #if defined(PSA_WANT_ALG_CBC_NO_PADDING) 409 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING) || \ 410 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 411 #define MBEDTLS_CIPHER_MODE_CBC 412 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1 413 #endif 414 #endif /* PSA_WANT_ALG_CBC_NO_PADDING */ 415 416 #if defined(PSA_WANT_ALG_CBC_PKCS7) 417 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7) || \ 418 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) 419 #define MBEDTLS_CIPHER_MODE_CBC 420 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1 421 #define MBEDTLS_CIPHER_PADDING_PKCS7 422 #endif 423 #endif /* PSA_WANT_ALG_CBC_PKCS7 */ 424 425 #if defined(PSA_WANT_ALG_CCM) 426 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CCM) || \ 427 defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \ 428 defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \ 429 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) 430 #define MBEDTLS_PSA_BUILTIN_ALG_CCM 1 431 #define MBEDTLS_CCM_C 432 #endif 433 #endif /* PSA_WANT_ALG_CCM */ 434 435 #if defined(PSA_WANT_ALG_GCM) 436 #if !defined(MBEDTLS_PSA_ACCEL_ALG_GCM) || \ 437 defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \ 438 defined(PSA_HAVE_SOFT_KEY_TYPE_ARIA) || \ 439 defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) 440 #define MBEDTLS_PSA_BUILTIN_ALG_GCM 1 441 #define MBEDTLS_GCM_C 442 #endif 443 #endif /* PSA_WANT_ALG_GCM */ 444 445 #if defined(PSA_WANT_ALG_CHACHA20_POLY1305) 446 #if !defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305) 447 #if defined(PSA_WANT_KEY_TYPE_CHACHA20) 448 #define MBEDTLS_CHACHAPOLY_C 449 #define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1 450 #endif /* PSA_WANT_KEY_TYPE_CHACHA20 */ 451 #endif /* !MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 */ 452 #endif /* PSA_WANT_ALG_CHACHA20_POLY1305 */ 453 454 #if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256) 455 #if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256) 456 #define MBEDTLS_ECP_DP_BP256R1_ENABLED 457 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1 458 #endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 */ 459 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_256 */ 460 461 #if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384) 462 #if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384) 463 #define MBEDTLS_ECP_DP_BP384R1_ENABLED 464 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1 465 #endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 */ 466 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_384 */ 467 468 #if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512) 469 #if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512) 470 #define MBEDTLS_ECP_DP_BP512R1_ENABLED 471 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1 472 #endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 */ 473 #endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_512 */ 474 475 #if defined(PSA_WANT_ECC_MONTGOMERY_255) 476 #if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255) 477 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED 478 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1 479 #endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 */ 480 #endif /* PSA_WANT_ECC_MONTGOMERY_255 */ 481 482 #if defined(PSA_WANT_ECC_MONTGOMERY_448) 483 #if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448) 484 /* 485 * Curve448 is not yet supported via the PSA API in Mbed TLS 486 * (https://github.com/ARMmbed/mbedtls/issues/4249). 487 */ 488 #error "Curve448 is not yet supported via the PSA API in Mbed TLS." 489 #define MBEDTLS_ECP_DP_CURVE448_ENABLED 490 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1 491 #endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 */ 492 #endif /* PSA_WANT_ECC_MONTGOMERY_448 */ 493 494 #if defined(PSA_WANT_ECC_SECP_R1_192) 495 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192) 496 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED 497 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1 498 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 */ 499 #endif /* PSA_WANT_ECC_SECP_R1_192 */ 500 501 #if defined(PSA_WANT_ECC_SECP_R1_224) 502 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224) 503 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED 504 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1 505 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 */ 506 #endif /* PSA_WANT_ECC_SECP_R1_224 */ 507 508 #if defined(PSA_WANT_ECC_SECP_R1_256) 509 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256) 510 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED 511 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1 512 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 */ 513 #endif /* PSA_WANT_ECC_SECP_R1_256 */ 514 515 #if defined(PSA_WANT_ECC_SECP_R1_384) 516 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384) 517 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED 518 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1 519 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 */ 520 #endif /* PSA_WANT_ECC_SECP_R1_384 */ 521 522 #if defined(PSA_WANT_ECC_SECP_R1_521) 523 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521) 524 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED 525 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1 526 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 */ 527 #endif /* PSA_WANT_ECC_SECP_R1_521 */ 528 529 #if defined(PSA_WANT_ECC_SECP_K1_192) 530 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192) 531 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED 532 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1 533 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 */ 534 #endif /* PSA_WANT_ECC_SECP_K1_192 */ 535 536 #if defined(PSA_WANT_ECC_SECP_K1_224) 537 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224) 538 /* 539 * SECP224K1 is buggy via the PSA API in Mbed TLS 540 * (https://github.com/ARMmbed/mbedtls/issues/3541). 541 */ 542 #error "SECP224K1 is buggy via the PSA API in Mbed TLS." 543 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED 544 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1 545 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 */ 546 #endif /* PSA_WANT_ECC_SECP_K1_224 */ 547 548 #if defined(PSA_WANT_ECC_SECP_K1_256) 549 #if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256) 550 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED 551 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1 552 #endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 */ 553 #endif /* PSA_WANT_ECC_SECP_K1_256 */ 554 555 556 557 /****************************************************************/ 558 /* Infer PSA requirements from Mbed TLS capabilities */ 559 /****************************************************************/ 560 561 #else /* MBEDTLS_PSA_CRYPTO_CONFIG */ 562 563 /* 564 * Ensure PSA_WANT_* defines are setup properly if MBEDTLS_PSA_CRYPTO_CONFIG 565 * is not defined 566 */ 567 568 #if defined(MBEDTLS_CCM_C) 569 #define MBEDTLS_PSA_BUILTIN_ALG_CCM 1 570 #define PSA_WANT_ALG_CCM 1 571 #endif /* MBEDTLS_CCM_C */ 572 573 #if defined(MBEDTLS_CMAC_C) 574 #define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1 575 #define PSA_WANT_ALG_CMAC 1 576 #endif /* MBEDTLS_CMAC_C */ 577 578 #if defined(MBEDTLS_ECDH_C) 579 #define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1 580 #define PSA_WANT_ALG_ECDH 1 581 #endif /* MBEDTLS_ECDH_C */ 582 583 #if defined(MBEDTLS_ECDSA_C) 584 #define MBEDTLS_PSA_BUILTIN_ALG_ECDSA 1 585 #define PSA_WANT_ALG_ECDSA 1 586 #define PSA_WANT_ALG_ECDSA_ANY 1 587 588 // Only add in DETERMINISTIC support if ECDSA is also enabled 589 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) 590 #define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA 1 591 #define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1 592 #endif /* MBEDTLS_ECDSA_DETERMINISTIC */ 593 594 #endif /* MBEDTLS_ECDSA_C */ 595 596 #if defined(MBEDTLS_ECP_C) 597 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR 1 598 #define PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1 599 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY 1 600 #define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1 601 #endif /* MBEDTLS_ECP_C */ 602 603 #if defined(MBEDTLS_GCM_C) 604 #define MBEDTLS_PSA_BUILTIN_ALG_GCM 1 605 #define PSA_WANT_ALG_GCM 1 606 #endif /* MBEDTLS_GCM_C */ 607 608 #if defined(MBEDTLS_HKDF_C) 609 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1 610 #define PSA_WANT_ALG_HMAC 1 611 #define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1 612 #define PSA_WANT_ALG_HKDF 1 613 #endif /* MBEDTLS_HKDF_C */ 614 615 #if defined(MBEDTLS_MD_C) 616 #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1 617 #define PSA_WANT_ALG_HMAC 1 618 #define PSA_WANT_KEY_TYPE_HMAC 619 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1 620 #define PSA_WANT_ALG_TLS12_PRF 1 621 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1 622 #define PSA_WANT_ALG_TLS12_PSK_TO_MS 1 623 #endif /* MBEDTLS_MD_C */ 624 625 #if defined(MBEDTLS_MD2_C) 626 #define MBEDTLS_PSA_BUILTIN_ALG_MD2 1 627 #define PSA_WANT_ALG_MD2 1 628 #endif 629 630 #if defined(MBEDTLS_MD4_C) 631 #define MBEDTLS_PSA_BUILTIN_ALG_MD4 1 632 #define PSA_WANT_ALG_MD4 1 633 #endif 634 635 #if defined(MBEDTLS_MD5_C) 636 #define MBEDTLS_PSA_BUILTIN_ALG_MD5 1 637 #define PSA_WANT_ALG_MD5 1 638 #endif 639 640 #if defined(MBEDTLS_RIPEMD160_C) 641 #define MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160 1 642 #define PSA_WANT_ALG_RIPEMD160 1 643 #endif 644 645 #if defined(MBEDTLS_RSA_C) 646 #if defined(MBEDTLS_PKCS1_V15) 647 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT 1 648 #define PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1 649 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN 1 650 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1 651 #define PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW 1 652 #endif /* MBEDTLS_PKCS1_V15 */ 653 #if defined(MBEDTLS_PKCS1_V21) 654 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP 1 655 #define PSA_WANT_ALG_RSA_OAEP 1 656 #define MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS 1 657 #define PSA_WANT_ALG_RSA_PSS 1 658 #endif /* MBEDTLS_PKCS1_V21 */ 659 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR 1 660 #define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1 661 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY 1 662 #define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1 663 #endif /* MBEDTLS_RSA_C */ 664 665 #if defined(MBEDTLS_SHA1_C) 666 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_1 1 667 #define PSA_WANT_ALG_SHA_1 1 668 #endif 669 670 #if defined(MBEDTLS_SHA256_C) 671 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_224 1 672 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1 673 #define PSA_WANT_ALG_SHA_224 1 674 #define PSA_WANT_ALG_SHA_256 1 675 #endif 676 677 #if defined(MBEDTLS_SHA512_C) 678 #if !defined(MBEDTLS_SHA512_NO_SHA384) 679 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_384 1 680 #define PSA_WANT_ALG_SHA_384 1 681 #endif 682 #define MBEDTLS_PSA_BUILTIN_ALG_SHA_512 1 683 #define PSA_WANT_ALG_SHA_512 1 684 #endif 685 686 #if defined(MBEDTLS_AES_C) 687 #define PSA_WANT_KEY_TYPE_AES 1 688 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1 689 #endif 690 691 #if defined(MBEDTLS_ARC4_C) 692 #define PSA_WANT_KEY_TYPE_ARC4 1 693 #define PSA_WANT_ALG_STREAM_CIPHER 1 694 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARC4 1 695 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1 696 #endif 697 698 #if defined(MBEDTLS_ARIA_C) 699 #define PSA_WANT_KEY_TYPE_ARIA 1 700 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARIA 1 701 #endif 702 703 #if defined(MBEDTLS_CAMELLIA_C) 704 #define PSA_WANT_KEY_TYPE_CAMELLIA 1 705 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1 706 #endif 707 708 #if defined(MBEDTLS_DES_C) 709 #define PSA_WANT_KEY_TYPE_DES 1 710 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES 1 711 #endif 712 713 #if defined(MBEDTLS_CHACHA20_C) 714 #define PSA_WANT_KEY_TYPE_CHACHA20 1 715 #define PSA_WANT_ALG_STREAM_CIPHER 1 716 #define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20 1 717 #define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1 718 #if defined(MBEDTLS_CHACHAPOLY_C) 719 #define PSA_WANT_ALG_CHACHA20_POLY1305 1 720 #define MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305 1 721 #endif 722 #endif 723 724 #if defined(MBEDTLS_CIPHER_MODE_CBC) 725 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING 1 726 #define PSA_WANT_ALG_CBC_NO_PADDING 1 727 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7) 728 #define MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7 1 729 #define PSA_WANT_ALG_CBC_PKCS7 1 730 #endif 731 #endif 732 733 #if defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) || \ 734 defined(MBEDTLS_ARIA_C) || defined(MBEDTLS_CAMELLIA_C) 735 #define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1 736 #define PSA_WANT_ALG_ECB_NO_PADDING 1 737 #endif 738 739 #if defined(MBEDTLS_CIPHER_MODE_CFB) 740 #define MBEDTLS_PSA_BUILTIN_ALG_CFB 1 741 #define PSA_WANT_ALG_CFB 1 742 #endif 743 744 #if defined(MBEDTLS_CIPHER_MODE_CTR) 745 #define MBEDTLS_PSA_BUILTIN_ALG_CTR 1 746 #define PSA_WANT_ALG_CTR 1 747 #endif 748 749 #if defined(MBEDTLS_CIPHER_MODE_OFB) 750 #define MBEDTLS_PSA_BUILTIN_ALG_OFB 1 751 #define PSA_WANT_ALG_OFB 1 752 #endif 753 754 #if defined(MBEDTLS_CIPHER_MODE_XTS) 755 #define MBEDTLS_PSA_BUILTIN_ALG_XTS 1 756 #define PSA_WANT_ALG_XTS 1 757 #endif 758 759 #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) 760 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1 761 #define PSA_WANT_ECC_BRAINPOOL_P_R1_256 762 #endif 763 764 #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) 765 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1 766 #define PSA_WANT_ECC_BRAINPOOL_P_R1_384 767 #endif 768 769 #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) 770 #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1 771 #define PSA_WANT_ECC_BRAINPOOL_P_R1_512 772 #endif 773 774 #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) 775 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1 776 #define PSA_WANT_ECC_MONTGOMERY_255 777 #endif 778 779 /* Curve448 is not yet supported via the PSA API (https://github.com/ARMmbed/mbedtls/issues/4249) */ 780 #if 0 && defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) 781 #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1 782 #define PSA_WANT_ECC_MONTGOMERY_448 783 #endif 784 785 #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) 786 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1 787 #define PSA_WANT_ECC_SECP_R1_192 788 #endif 789 790 #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) 791 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1 792 #define PSA_WANT_ECC_SECP_R1_224 793 #endif 794 795 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) 796 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1 797 #define PSA_WANT_ECC_SECP_R1_256 798 #endif 799 800 #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) 801 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1 802 #define PSA_WANT_ECC_SECP_R1_384 803 #endif 804 805 #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) 806 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1 807 #define PSA_WANT_ECC_SECP_R1_521 808 #endif 809 810 #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) 811 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1 812 #define PSA_WANT_ECC_SECP_K1_192 813 #endif 814 815 /* SECP224K1 is buggy via the PSA API (https://github.com/ARMmbed/mbedtls/issues/3541) */ 816 #if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) 817 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1 818 #define PSA_WANT_ECC_SECP_K1_224 819 #endif 820 821 #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) 822 #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1 823 #define PSA_WANT_ECC_SECP_K1_256 824 #endif 825 826 #endif /* MBEDTLS_PSA_CRYPTO_CONFIG */ 827 828 /* These features are always enabled. */ 829 #define PSA_WANT_KEY_TYPE_DERIVE 1 830 #define PSA_WANT_KEY_TYPE_RAW_DATA 1 831 832 #ifdef __cplusplus 833 } 834 #endif 835 836 #endif /* MBEDTLS_CONFIG_PSA_H */ 837