Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 1 | /** |
| 2 | * \file mbedtls/config_adjust_legacy_crypto.h |
| 3 | * \brief Adjust legacy configuration configuration |
| 4 | * |
| 5 | * Automatically enable certain dependencies. Generally, MBEDLTS_xxx |
| 6 | * configurations need to be explicitly enabled by the user: enabling |
| 7 | * MBEDTLS_xxx_A but not MBEDTLS_xxx_B when A requires B results in a |
| 8 | * compilation error. However, we do automatically enable certain options |
| 9 | * in some circumstances. One case is if MBEDTLS_xxx_B is an internal option |
| 10 | * used to identify parts of a module that are used by other module, and we |
| 11 | * don't want to make the symbol MBEDTLS_xxx_B part of the public API. |
| 12 | * Another case is if A didn't depend on B in earlier versions, and we |
| 13 | * want to use B in A but we need to preserve backward compatibility with |
| 14 | * configurations that explicitly activate MBEDTLS_xxx_A but not |
| 15 | * MBEDTLS_xxx_B. |
| 16 | */ |
| 17 | /* |
| 18 | * Copyright The Mbed TLS Contributors |
Dave Rodgman | 16799db | 2023-11-02 19:47:20 +0000 | [diff] [blame] | 19 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #ifndef MBEDTLS_CONFIG_ADJUST_LEGACY_CRYPTO_H |
| 23 | #define MBEDTLS_CONFIG_ADJUST_LEGACY_CRYPTO_H |
| 24 | |
Valerio Setti | dbfd6a9 | 2023-11-16 08:21:14 +0100 | [diff] [blame^] | 25 | /* GCM_C and CCM_C can either depend on (in order of preference) CIPHER_C or |
| 26 | * BLOCK_CIPHER_C. If the former is not defined, auto-enable the latter. */ |
Manuel Pégourié-Gonnard | 5f3361c | 2023-11-10 12:24:11 +0100 | [diff] [blame] | 27 | #if (defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C)) && \ |
| 28 | !defined(MBEDTLS_CIPHER_C) |
| 29 | #define MBEDTLS_BLOCK_CIPHER_C |
| 30 | #endif |
| 31 | |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 32 | /* Auto-enable MBEDTLS_MD_LIGHT based on MBEDTLS_MD_C. |
| 33 | * This allows checking for MD_LIGHT rather than MD_LIGHT || MD_C. |
| 34 | */ |
| 35 | #if defined(MBEDTLS_MD_C) |
| 36 | #define MBEDTLS_MD_LIGHT |
| 37 | #endif |
| 38 | |
| 39 | /* Auto-enable MBEDTLS_MD_LIGHT if needed by a module that didn't require it |
| 40 | * in a previous release, to ensure backwards compatibility. |
| 41 | */ |
| 42 | #if defined(MBEDTLS_ECJPAKE_C) || \ |
| 43 | defined(MBEDTLS_PEM_PARSE_C) || \ |
| 44 | defined(MBEDTLS_ENTROPY_C) || \ |
| 45 | defined(MBEDTLS_PK_C) || \ |
| 46 | defined(MBEDTLS_PKCS12_C) || \ |
| 47 | defined(MBEDTLS_RSA_C) || \ |
| 48 | defined(MBEDTLS_SSL_TLS_C) || \ |
| 49 | defined(MBEDTLS_X509_USE_C) || \ |
| 50 | defined(MBEDTLS_X509_CREATE_C) |
| 51 | #define MBEDTLS_MD_LIGHT |
| 52 | #endif |
| 53 | |
Valerio Setti | 85d2a98 | 2023-10-06 16:04:49 +0200 | [diff] [blame] | 54 | #if defined(MBEDTLS_MD_LIGHT) |
| 55 | /* |
| 56 | * - MBEDTLS_MD_CAN_xxx is defined if the md module can perform xxx. |
| 57 | * - MBEDTLS_MD_xxx_VIA_PSA is defined if the md module may perform xxx via PSA |
| 58 | * (see below). |
| 59 | * - MBEDTLS_MD_SOME_PSA is defined if at least one algorithm may be performed |
| 60 | * via PSA (see below). |
| 61 | * - MBEDTLS_MD_SOME_LEGACY is defined if at least one algorithm may be performed |
| 62 | * via a direct legacy call (see below). |
| 63 | * |
| 64 | * The md module performs an algorithm via PSA if there is a PSA hash |
| 65 | * accelerator and the PSA driver subsytem is initialized at the time the |
| 66 | * operation is started, and makes a direct legacy call otherwise. |
| 67 | */ |
| 68 | |
| 69 | /* PSA accelerated implementations */ |
| 70 | #if defined(MBEDTLS_PSA_CRYPTO_C) |
| 71 | |
| 72 | #if defined(MBEDTLS_PSA_ACCEL_ALG_MD5) |
| 73 | #define MBEDTLS_MD_CAN_MD5 |
| 74 | #define MBEDTLS_MD_MD5_VIA_PSA |
| 75 | #define MBEDTLS_MD_SOME_PSA |
| 76 | #endif |
| 77 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1) |
| 78 | #define MBEDTLS_MD_CAN_SHA1 |
| 79 | #define MBEDTLS_MD_SHA1_VIA_PSA |
| 80 | #define MBEDTLS_MD_SOME_PSA |
| 81 | #endif |
| 82 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224) |
| 83 | #define MBEDTLS_MD_CAN_SHA224 |
| 84 | #define MBEDTLS_MD_SHA224_VIA_PSA |
| 85 | #define MBEDTLS_MD_SOME_PSA |
| 86 | #endif |
| 87 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256) |
| 88 | #define MBEDTLS_MD_CAN_SHA256 |
| 89 | #define MBEDTLS_MD_SHA256_VIA_PSA |
| 90 | #define MBEDTLS_MD_SOME_PSA |
| 91 | #endif |
| 92 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384) |
| 93 | #define MBEDTLS_MD_CAN_SHA384 |
| 94 | #define MBEDTLS_MD_SHA384_VIA_PSA |
| 95 | #define MBEDTLS_MD_SOME_PSA |
| 96 | #endif |
| 97 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512) |
| 98 | #define MBEDTLS_MD_CAN_SHA512 |
| 99 | #define MBEDTLS_MD_SHA512_VIA_PSA |
| 100 | #define MBEDTLS_MD_SOME_PSA |
| 101 | #endif |
| 102 | #if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160) |
| 103 | #define MBEDTLS_MD_CAN_RIPEMD160 |
| 104 | #define MBEDTLS_MD_RIPEMD160_VIA_PSA |
| 105 | #define MBEDTLS_MD_SOME_PSA |
| 106 | #endif |
| 107 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224) |
| 108 | #define MBEDTLS_MD_CAN_SHA3_224 |
| 109 | #define MBEDTLS_MD_SHA3_224_VIA_PSA |
| 110 | #define MBEDTLS_MD_SOME_PSA |
| 111 | #endif |
| 112 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256) |
| 113 | #define MBEDTLS_MD_CAN_SHA3_256 |
| 114 | #define MBEDTLS_MD_SHA3_256_VIA_PSA |
| 115 | #define MBEDTLS_MD_SOME_PSA |
| 116 | #endif |
| 117 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384) |
| 118 | #define MBEDTLS_MD_CAN_SHA3_384 |
| 119 | #define MBEDTLS_MD_SHA3_384_VIA_PSA |
| 120 | #define MBEDTLS_MD_SOME_PSA |
| 121 | #endif |
| 122 | #if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512) |
| 123 | #define MBEDTLS_MD_CAN_SHA3_512 |
| 124 | #define MBEDTLS_MD_SHA3_512_VIA_PSA |
| 125 | #define MBEDTLS_MD_SOME_PSA |
| 126 | #endif |
| 127 | #endif /* MBEDTLS_PSA_CRYPTO_C */ |
| 128 | |
| 129 | /* Built-in implementations */ |
| 130 | #if defined(MBEDTLS_MD5_C) |
| 131 | #define MBEDTLS_MD_CAN_MD5 |
| 132 | #define MBEDTLS_MD_SOME_LEGACY |
| 133 | #endif |
| 134 | #if defined(MBEDTLS_SHA1_C) |
| 135 | #define MBEDTLS_MD_CAN_SHA1 |
| 136 | #define MBEDTLS_MD_SOME_LEGACY |
| 137 | #endif |
| 138 | #if defined(MBEDTLS_SHA224_C) |
| 139 | #define MBEDTLS_MD_CAN_SHA224 |
| 140 | #define MBEDTLS_MD_SOME_LEGACY |
| 141 | #endif |
| 142 | #if defined(MBEDTLS_SHA256_C) |
| 143 | #define MBEDTLS_MD_CAN_SHA256 |
| 144 | #define MBEDTLS_MD_SOME_LEGACY |
| 145 | #endif |
| 146 | #if defined(MBEDTLS_SHA384_C) |
| 147 | #define MBEDTLS_MD_CAN_SHA384 |
| 148 | #define MBEDTLS_MD_SOME_LEGACY |
| 149 | #endif |
| 150 | #if defined(MBEDTLS_SHA512_C) |
| 151 | #define MBEDTLS_MD_CAN_SHA512 |
| 152 | #define MBEDTLS_MD_SOME_LEGACY |
| 153 | #endif |
| 154 | #if defined(MBEDTLS_SHA3_C) |
| 155 | #define MBEDTLS_MD_CAN_SHA3_224 |
| 156 | #define MBEDTLS_MD_CAN_SHA3_256 |
| 157 | #define MBEDTLS_MD_CAN_SHA3_384 |
| 158 | #define MBEDTLS_MD_CAN_SHA3_512 |
| 159 | #define MBEDTLS_MD_SOME_LEGACY |
| 160 | #endif |
| 161 | #if defined(MBEDTLS_RIPEMD160_C) |
| 162 | #define MBEDTLS_MD_CAN_RIPEMD160 |
| 163 | #define MBEDTLS_MD_SOME_LEGACY |
| 164 | #endif |
| 165 | |
| 166 | #endif /* MBEDTLS_MD_LIGHT */ |
| 167 | |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 168 | /* MBEDTLS_ECP_LIGHT is auto-enabled by the following symbols: |
| 169 | * - MBEDTLS_ECP_C because now it consists of MBEDTLS_ECP_LIGHT plus functions |
| 170 | * for curve arithmetic. As a consequence if MBEDTLS_ECP_C is required for |
| 171 | * some reason, then MBEDTLS_ECP_LIGHT should be enabled as well. |
| 172 | * - MBEDTLS_PK_PARSE_EC_EXTENDED and MBEDTLS_PK_PARSE_EC_COMPRESSED because |
| 173 | * these features are not supported in PSA so the only way to have them is |
| 174 | * to enable the built-in solution. |
| 175 | * Both of them are temporary dependencies: |
| 176 | * - PK_PARSE_EC_EXTENDED will be removed after #7779 and #7789 |
| 177 | * - support for compressed points should also be added to PSA, but in this |
| 178 | * case there is no associated issue to track it yet. |
| 179 | * - PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE because Weierstrass key derivation |
| 180 | * still depends on ECP_LIGHT. |
| 181 | * - PK_C + USE_PSA + PSA_WANT_ALG_ECDSA is a temporary dependency which will |
| 182 | * be fixed by #7453. |
| 183 | */ |
| 184 | #if defined(MBEDTLS_ECP_C) || \ |
| 185 | defined(MBEDTLS_PK_PARSE_EC_EXTENDED) || \ |
| 186 | defined(MBEDTLS_PK_PARSE_EC_COMPRESSED) || \ |
| 187 | defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_DERIVE) |
| 188 | #define MBEDTLS_ECP_LIGHT |
| 189 | #endif |
| 190 | |
Thomas Daubney | 540324c | 2023-10-06 17:07:24 +0100 | [diff] [blame] | 191 | /* MBEDTLS_PK_PARSE_EC_COMPRESSED is introduced in Mbed TLS version 3.5, while |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 192 | * in previous version compressed points were automatically supported as long |
| 193 | * as PK_PARSE_C and ECP_C were enabled. As a consequence, for backward |
| 194 | * compatibility, we auto-enable PK_PARSE_EC_COMPRESSED when these conditions |
| 195 | * are met. */ |
| 196 | #if defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_ECP_C) |
| 197 | #define MBEDTLS_PK_PARSE_EC_COMPRESSED |
| 198 | #endif |
| 199 | |
| 200 | /* Helper symbol to state that there is support for ECDH, either through |
| 201 | * library implementation (ECDH_C) or through PSA. */ |
| 202 | #if (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_ALG_ECDH)) || \ |
| 203 | (!defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_ECDH_C)) |
| 204 | #define MBEDTLS_CAN_ECDH |
| 205 | #endif |
| 206 | |
| 207 | /* PK module can achieve ECDSA functionalities by means of either software |
| 208 | * implementations (ECDSA_C) or through a PSA driver. The following defines |
| 209 | * are meant to list these capabilities in a general way which abstracts how |
| 210 | * they are implemented under the hood. */ |
| 211 | #if !defined(MBEDTLS_USE_PSA_CRYPTO) |
| 212 | #if defined(MBEDTLS_ECDSA_C) |
| 213 | #define MBEDTLS_PK_CAN_ECDSA_SIGN |
| 214 | #define MBEDTLS_PK_CAN_ECDSA_VERIFY |
| 215 | #endif /* MBEDTLS_ECDSA_C */ |
| 216 | #else /* MBEDTLS_USE_PSA_CRYPTO */ |
| 217 | #if defined(PSA_WANT_ALG_ECDSA) |
| 218 | #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) |
| 219 | #define MBEDTLS_PK_CAN_ECDSA_SIGN |
| 220 | #endif /* PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC */ |
| 221 | #if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) |
| 222 | #define MBEDTLS_PK_CAN_ECDSA_VERIFY |
| 223 | #endif /* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */ |
| 224 | #endif /* PSA_WANT_ALG_ECDSA */ |
| 225 | #endif /* MBEDTLS_USE_PSA_CRYPTO */ |
| 226 | |
| 227 | #if defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) || defined(MBEDTLS_PK_CAN_ECDSA_SIGN) |
| 228 | #define MBEDTLS_PK_CAN_ECDSA_SOME |
| 229 | #endif |
| 230 | |
| 231 | /* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT |
| 232 | * is defined as well to include all PSA code. |
| 233 | */ |
| 234 | #if defined(MBEDTLS_PSA_CRYPTO_C) |
| 235 | #define MBEDTLS_PSA_CRYPTO_CLIENT |
| 236 | #endif /* MBEDTLS_PSA_CRYPTO_C */ |
| 237 | |
| 238 | /* The PK wrappers need pk_write functions to format RSA key objects |
| 239 | * when they are dispatching to the PSA API. This happens under USE_PSA_CRYPTO, |
| 240 | * and also even without USE_PSA_CRYPTO for mbedtls_pk_sign_ext(). */ |
| 241 | #if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C) |
| 242 | #define MBEDTLS_PK_C |
| 243 | #define MBEDTLS_PK_WRITE_C |
| 244 | #define MBEDTLS_PK_PARSE_C |
| 245 | #endif |
| 246 | |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 247 | /* Helpers to state that each key is supported either on the builtin or PSA side. */ |
| 248 | #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_521) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 249 | #define MBEDTLS_ECP_HAVE_SECP521R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 250 | #endif |
| 251 | #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) || defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 252 | #define MBEDTLS_ECP_HAVE_BP512R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 253 | #endif |
| 254 | #if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) || defined(PSA_WANT_ECC_MONTGOMERY_448) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 255 | #define MBEDTLS_ECP_HAVE_CURVE448 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 256 | #endif |
| 257 | #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 258 | #define MBEDTLS_ECP_HAVE_BP384R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 259 | #endif |
| 260 | #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_384) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 261 | #define MBEDTLS_ECP_HAVE_SECP384R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 262 | #endif |
| 263 | #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 264 | #define MBEDTLS_ECP_HAVE_BP256R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 265 | #endif |
| 266 | #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || defined(PSA_WANT_ECC_SECP_K1_256) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 267 | #define MBEDTLS_ECP_HAVE_SECP256K1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 268 | #endif |
| 269 | #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_256) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 270 | #define MBEDTLS_ECP_HAVE_SECP256R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 271 | #endif |
| 272 | #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || defined(PSA_WANT_ECC_MONTGOMERY_255) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 273 | #define MBEDTLS_ECP_HAVE_CURVE25519 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 274 | #endif |
| 275 | #if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || defined(PSA_WANT_ECC_SECP_K1_224) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 276 | #define MBEDTLS_ECP_HAVE_SECP224K1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 277 | #endif |
| 278 | #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_224) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 279 | #define MBEDTLS_ECP_HAVE_SECP224R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 280 | #endif |
| 281 | #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || defined(PSA_WANT_ECC_SECP_K1_192) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 282 | #define MBEDTLS_ECP_HAVE_SECP192K1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 283 | #endif |
| 284 | #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_192) |
Valerio Setti | db6b4db | 2023-09-01 09:20:51 +0200 | [diff] [blame] | 285 | #define MBEDTLS_ECP_HAVE_SECP192R1 |
Valerio Setti | 67d82e7 | 2023-08-16 17:11:53 +0200 | [diff] [blame] | 286 | #endif |
| 287 | |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 288 | /* Helper symbol to state that the PK module has support for EC keys. This |
| 289 | * can either be provided through the legacy ECP solution or through the |
| 290 | * PSA friendly MBEDTLS_PK_USE_PSA_EC_DATA (see pk.h for its description). */ |
| 291 | #if defined(MBEDTLS_ECP_C) || \ |
| 292 | (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)) |
| 293 | #define MBEDTLS_PK_HAVE_ECC_KEYS |
| 294 | #endif /* MBEDTLS_PK_USE_PSA_EC_DATA || MBEDTLS_ECP_C */ |
| 295 | |
Gilles Peskine | ca1e605 | 2023-09-25 16:16:26 +0200 | [diff] [blame] | 296 | /* Historically pkparse did not check the CBC padding when decrypting |
| 297 | * a key. This was a bug, which is now fixed. As a consequence, pkparse |
| 298 | * now needs PKCS7 padding support, but existing configurations might not |
| 299 | * enable it, so we enable it here. */ |
| 300 | #if defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PKCS5_C) && defined(MBEDTLS_CIPHER_MODE_CBC) |
| 301 | #define MBEDTLS_CIPHER_PADDING_PKCS7 |
| 302 | #endif |
| 303 | |
Dave Rodgman | 94a634d | 2023-10-10 12:59:29 +0100 | [diff] [blame] | 304 | /* Backwards compatibility for some macros which were renamed to reflect that |
| 305 | * they are related to Armv8, not aarch64. */ |
Dave Rodgman | c5861d5 | 2023-10-10 14:01:54 +0100 | [diff] [blame] | 306 | #if defined(MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT) && \ |
Dave Rodgman | 5b89c55 | 2023-10-10 14:59:02 +0100 | [diff] [blame] | 307 | !defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT) |
| 308 | #define MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT |
Dave Rodgman | 94a634d | 2023-10-10 12:59:29 +0100 | [diff] [blame] | 309 | #endif |
Dave Rodgman | 5b89c55 | 2023-10-10 14:59:02 +0100 | [diff] [blame] | 310 | #if defined(MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY) && !defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY) |
| 311 | #define MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY |
Dave Rodgman | 94a634d | 2023-10-10 12:59:29 +0100 | [diff] [blame] | 312 | #endif |
Dave Rodgman | 94a634d | 2023-10-10 12:59:29 +0100 | [diff] [blame] | 313 | |
Valerio Setti | e570704 | 2023-10-11 11:54:42 +0200 | [diff] [blame] | 314 | #if (!defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_GCM_C)) || \ |
| 315 | (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_ALG_GCM)) |
| 316 | #define MBEDTLS_SSL_HAVE_GCM |
| 317 | #endif |
| 318 | |
| 319 | #if (!defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_CCM_C)) || \ |
| 320 | (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_ALG_CCM)) |
| 321 | #define MBEDTLS_SSL_HAVE_CCM |
| 322 | #endif |
| 323 | |
| 324 | #if (!defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_CHACHAPOLY_C)) || \ |
| 325 | (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_ALG_CHACHA20_POLY1305)) |
| 326 | #define MBEDTLS_SSL_HAVE_CHACHAPOLY |
| 327 | #endif |
| 328 | |
| 329 | #if defined(MBEDTLS_SSL_HAVE_GCM) || defined(MBEDTLS_SSL_HAVE_CCM) || \ |
| 330 | defined(MBEDTLS_SSL_HAVE_CHACHAPOLY) |
| 331 | #define MBEDTLS_SSL_HAVE_AEAD |
| 332 | #endif |
| 333 | |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 334 | #endif /* MBEDTLS_CONFIG_ADJUST_LEGACY_CRYPTO_H */ |