|
2 | 2 | * \file mbedtls/config_adjust_legacy_crypto.h |
3 | 3 | * \brief Adjust legacy configuration configuration |
4 | 4 | * |
5 | | - * Automatically enable certain dependencies. Generally, MBEDLTS_xxx |
| 5 | + * This is an internal header. Do not include it directly. |
| 6 | + * |
| 7 | + * Automatically enable certain dependencies. Generally, MBEDTLS_xxx |
6 | 8 | * configurations need to be explicitly enabled by the user: enabling |
7 | 9 | * MBEDTLS_xxx_A but not MBEDTLS_xxx_B when A requires B results in a |
8 | 10 | * compilation error. However, we do automatically enable certain options |
|
22 | 24 | #ifndef MBEDTLS_CONFIG_ADJUST_LEGACY_CRYPTO_H |
23 | 25 | #define MBEDTLS_CONFIG_ADJUST_LEGACY_CRYPTO_H |
24 | 26 |
|
| 27 | +#if !defined(MBEDTLS_CONFIG_FILES_READ) |
| 28 | +#error "Do not include mbedtls/config_adjust_*.h manually! This can lead to problems, " \ |
| 29 | + "up to and including runtime errors such as buffer overflows. " \ |
| 30 | + "If you're trying to fix a complaint from check_config.h, just remove " \ |
| 31 | + "it from your configuration file: since Mbed TLS 3.0, it is included " \ |
| 32 | + "automatically at the right point." |
| 33 | +#endif /* */ |
| 34 | + |
25 | 35 | /* Ideally, we'd set those as defaults in mbedtls_config.h, but |
26 | 36 | * putting an #ifdef _WIN32 in mbedtls_config.h would confuse config.py. |
27 | 37 | * |
|
48 | 58 | defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \ |
49 | 59 | defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \ |
50 | 60 | defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7) || \ |
51 | | - defined(MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG)) |
| 61 | + defined(MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG) || \ |
| 62 | + defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC)) |
52 | 63 | #define MBEDTLS_CIPHER_C |
53 | 64 | #endif |
54 | 65 |
|
|
293 | 304 | #define MBEDTLS_ECP_LIGHT |
294 | 305 | #endif |
295 | 306 |
|
| 307 | +/* Backward compatibility: after #8740 the RSA module offers functions to parse |
| 308 | + * and write RSA private/public keys without relying on the PK one. Of course |
| 309 | + * this needs ASN1 support to do so, so we enable it here. */ |
| 310 | +#if defined(MBEDTLS_RSA_C) |
| 311 | +#define MBEDTLS_ASN1_PARSE_C |
| 312 | +#define MBEDTLS_ASN1_WRITE_C |
| 313 | +#endif |
| 314 | + |
296 | 315 | /* MBEDTLS_PK_PARSE_EC_COMPRESSED is introduced in Mbed TLS version 3.5, while |
297 | 316 | * in previous version compressed points were automatically supported as long |
298 | 317 | * as PK_PARSE_C and ECP_C were enabled. As a consequence, for backward |
|
409 | 428 |
|
410 | 429 | /* psa_util file features some ECDSA conversion functions, to convert between |
411 | 430 | * legacy's ASN.1 DER format and PSA's raw one. */ |
412 | | -#if defined(MBEDTLS_ECDSA_C) || (defined(MBEDTLS_PSA_CRYPTO_C) && \ |
| 431 | +#if (defined(MBEDTLS_PSA_CRYPTO_CLIENT) && \ |
413 | 432 | (defined(PSA_WANT_ALG_ECDSA) || defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA))) |
414 | 433 | #define MBEDTLS_PSA_UTIL_HAVE_ECDSA |
415 | 434 | #endif |
416 | 435 |
|
417 | | -/* Some internal helpers to determine which keys are availble. */ |
| 436 | +/* Some internal helpers to determine which keys are available. */ |
418 | 437 | #if (!defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_AES_C)) || \ |
419 | 438 | (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_AES)) |
420 | 439 | #define MBEDTLS_SSL_HAVE_AES |
|
428 | 447 | #define MBEDTLS_SSL_HAVE_CAMELLIA |
429 | 448 | #endif |
430 | 449 |
|
431 | | -/* Some internal helpers to determine which operation modes are availble. */ |
| 450 | +/* Some internal helpers to determine which operation modes are available. */ |
432 | 451 | #if (!defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_CIPHER_MODE_CBC)) || \ |
433 | 452 | (defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_ALG_CBC_NO_PADDING)) |
434 | 453 | #define MBEDTLS_SSL_HAVE_CBC |
|
0 commit comments