2014-04-30 12:35:08 +02:00
/**
2024-11-12 15:57:42 +01:00
* \ file mbedtls / check_config . h
2014-04-30 12:35:08 +02:00
*
* \ brief Consistency checks for configuration options
2024-04-26 14:18:10 +02:00
*
* This is an internal header . Do not include it directly .
*
* This header is included automatically by all public Mbed TLS headers
* ( via mbedtls / build_info . h ) . Do not include it directly in a configuration
* file such as mbedtls / mbedtls_config . h or # MBEDTLS_USER_CONFIG_FILE !
* It would run at the wrong time due to missing derived symbols .
2018-01-05 15:33:17 +00:00
*/
/*
2020-08-07 13:07:28 +02:00
* Copyright The Mbed TLS Contributors
2023-11-02 19:47:20 +00:00
* SPDX - License - Identifier : Apache - 2.0 OR GPL - 2.0 - or - later
2014-04-30 12:35:08 +02:00
*/
2015-04-08 12:49:31 +02:00
# ifndef MBEDTLS_CHECK_CONFIG_H
# define MBEDTLS_CHECK_CONFIG_H
2014-04-30 12:35:08 +02:00
2022-11-14 15:40:46 +00:00
/* *INDENT-OFF* */
2024-05-16 14:54:04 +02:00
# if !defined(MBEDTLS_CONFIG_IS_FINALIZED)
# warning "Do not include mbedtls / check_config.h manually! " \
" This may cause spurious errors. " \
" It is included automatically at the right point since Mbed TLS 3.0. "
# endif /* !MBEDTLS_CONFIG_IS_FINALIZED */
2021-06-08 18:31:27 +01:00
# if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C)
# error "The NET module is not available for mbed OS - please use the network functions provided by Mbed OS"
2015-07-28 14:17:48 +02:00
# endif
2015-06-18 20:52:58 +02:00
# if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
# error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
# endif
2023-09-28 09:46:22 +02:00
/* Limitations on ECC curves acceleration: partial curve acceleration is only
* supported with crypto excluding PK , X .509 or TLS .
* Note : no need to check X .509 as it depends on PK . */
# if defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256) || \
defined ( MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 ) | | \
defined ( MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 )
# if defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES)
2024-11-12 15:57:42 +01:00
# if defined(MBEDTLS_SSL_TLS_C)
2023-09-28 09:46:22 +02:00
# error "Unsupported partial support for ECC curves acceleration, see docs / driver-only-builds.md"
# endif /* modules beyond what's supported */
# endif /* not all curves accelerated */
# endif /* some curve accelerated */
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
2023-07-07 17:22:17 +02:00
! defined ( MBEDTLS_CAN_ECDH )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
2025-06-30 10:36:25 +02:00
( ! defined ( MBEDTLS_CAN_ECDH ) | | ! defined ( PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC ) | | \
! defined ( MBEDTLS_X509_CRT_PARSE_C ) | | ! defined ( PSA_WANT_ALG_RSA_PKCS1V15_CRYPT ) | | ! defined ( PSA_WANT_ALG_RSA_PKCS1V15_SIGN ) )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2023-03-10 11:40:48 +01:00
# if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
2023-07-07 17:22:17 +02:00
( ! defined ( MBEDTLS_CAN_ECDH ) | | \
2024-09-06 10:49:05 +01:00
! defined ( PSA_HAVE_ALG_ECDSA_SIGN ) | | \
2015-04-08 12:49:31 +02:00
! defined ( MBEDTLS_X509_CRT_PARSE_C ) )
# error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2024-02-08 12:17:20 +01:00
# if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
( ! defined ( PSA_WANT_ALG_JPAKE ) | | \
! defined ( PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC ) | | \
! defined ( PSA_WANT_ECC_SECP_R1_256 ) )
# error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
# endif
2015-09-15 17:53:32 +02:00
2023-03-14 23:59:24 +01:00
/* Use of EC J-PAKE in TLS requires SHA-256. */
2022-09-19 10:44:42 +02:00
# if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
2024-08-20 14:53:19 +01:00
! defined ( PSA_WANT_ALG_SHA_256 )
2022-09-19 10:44:42 +02:00
# error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
# endif
2020-03-10 12:19:08 +01:00
# if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
2024-02-08 12:00:28 +01:00
! defined ( MBEDTLS_SSL_KEEP_PEER_CERTIFICATE ) & & \
2024-08-20 14:53:19 +01:00
! defined ( PSA_WANT_ALG_SHA_256 ) & & \
2024-09-03 16:52:28 +01:00
! defined ( PSA_WANT_ALG_SHA_512 ) & & \
2024-09-04 18:12:59 +01:00
! defined ( PSA_WANT_ALG_SHA_1 )
2024-02-08 12:00:28 +01:00
# error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires SHA-512, SHA-256 or SHA-1".
2019-02-26 11:43:09 +00:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
2025-06-30 10:36:25 +02:00
( ! defined ( PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC ) | | ! defined ( PSA_WANT_ALG_RSA_OAEP ) )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
2014-01-24 14:37:29 +01:00
# endif
2023-03-22 00:13:50 +01:00
/* TLS 1.3 requires separate HKDF parts from PSA,
* and at least one ciphersuite , so at least SHA - 256 or SHA - 384
* from PSA to use with HKDF .
*
* Note : for dependencies common with TLS 1.2 ( running handshake hash ) ,
* see MBEDTLS_SSL_TLS_C . */
2021-12-08 16:57:54 +01:00
# if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \
2024-02-07 13:01:33 +00:00
! ( defined ( MBEDTLS_PSA_CRYPTO_CLIENT ) & & \
2023-03-22 00:13:50 +01:00
defined ( PSA_WANT_ALG_HKDF_EXTRACT ) & & \
defined ( PSA_WANT_ALG_HKDF_EXPAND ) & & \
( defined ( PSA_WANT_ALG_SHA_256 ) | | defined ( PSA_WANT_ALG_SHA_384 ) ) )
2021-12-08 16:57:54 +01:00
# error "MBEDTLS_SSL_PROTO_TLS1_3 defined, but not all prerequisites"
2020-06-02 06:20:23 +01:00
# endif
2022-10-04 15:48:06 +02:00
# if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED)
2023-07-06 14:52:45 +02:00
# if !( (defined(PSA_WANT_ALG_ECDH) || defined(PSA_WANT_ALG_FFDH)) && \
defined ( MBEDTLS_X509_CRT_PARSE_C ) & & \
2025-06-30 10:36:25 +02:00
( defined ( PSA_HAVE_ALG_ECDSA_SIGN ) | | defined ( PSA_WANT_ALG_RSA_OAEP ) ) )
2022-10-04 15:48:06 +02:00
# error "MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED defined, but not all prerequisites"
# endif
# endif
# if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
2023-06-15 16:44:08 +02:00
# if !( defined(PSA_WANT_ALG_ECDH) || defined(PSA_WANT_ALG_FFDH) )
2022-10-04 15:48:06 +02:00
# error "MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED defined, but not all prerequisites"
# endif
# endif
2022-06-29 16:36:12 +01:00
/*
* The current implementation of TLS 1.3 requires MBEDTLS_SSL_KEEP_PEER_CERTIFICATE .
*/
# if defined(MBEDTLS_SSL_PROTO_TLS1_3) && !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
# error "MBEDTLS_SSL_PROTO_TLS1_3 defined without MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
# endif
2021-05-12 17:49:18 +02:00
# if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
2025-02-26 18:06:05 +01:00
! ( defined ( MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ) | | \
2019-04-11 18:56:18 +01:00
defined ( MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED ) | | \
defined ( MBEDTLS_KEY_EXCHANGE_PSK_ENABLED ) | | \
defined ( MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ) | | \
defined ( MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED ) )
# error "One or more versions of the TLS protocol are enabled " \
" but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx "
# endif
2022-10-25 02:56:00 +00:00
# if defined(MBEDTLS_SSL_EARLY_DATA) && \
2022-11-10 10:38:17 +00:00
( ! defined ( MBEDTLS_SSL_SESSION_TICKETS ) | | \
( ! defined ( MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED ) & & \
! defined ( MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED ) ) )
2022-10-25 02:56:00 +00:00
# error "MBEDTLS_SSL_EARLY_DATA defined, but not all prerequisites"
# endif
2022-11-05 10:50:06 +08:00
# if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_SRV_C) && \
2023-09-14 12:59:50 +01:00
defined ( MBEDTLS_SSL_MAX_EARLY_DATA_SIZE ) & & \
( ( MBEDTLS_SSL_MAX_EARLY_DATA_SIZE < 0 ) | | \
( MBEDTLS_SSL_MAX_EARLY_DATA_SIZE > UINT32_MAX ) )
# error "MBEDTLS_SSL_MAX_EARLY_DATA_SIZE must be in the range(0..UINT32_MAX)"
2022-11-05 10:50:06 +08:00
# endif
2015-05-13 10:10:00 +02:00
# if defined(MBEDTLS_SSL_PROTO_DTLS) && \
! defined ( MBEDTLS_SSL_PROTO_TLS1_2 )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
2014-02-06 13:04:16 +01:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
# error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2023-01-03 15:36:25 +01:00
# if defined(MBEDTLS_SSL_ASYNC_PRIVATE) && !defined(MBEDTLS_X509_CRT_PARSE_C)
# error "MBEDTLS_SSL_ASYNC_PRIVATE defined, but not all prerequisites"
# endif
2023-03-22 00:13:50 +01:00
/* TLS 1.2 and 1.3 require SHA-256 or SHA-384 (running handshake hash) */
2024-09-05 13:08:59 +01:00
# if defined(MBEDTLS_SSL_TLS_C) && \
2024-08-20 14:53:19 +01:00
! ( defined ( PSA_WANT_ALG_SHA_256 ) | | defined ( PSA_WANT_ALG_SHA_384 ) )
2023-03-24 10:30:40 +01:00
# error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
2023-03-22 00:13:50 +01:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
# error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2021-12-23 11:06:26 +08:00
# if defined(MBEDTLS_SSL_TLS_C) && \
! ( defined ( MBEDTLS_SSL_PROTO_TLS1_2 ) | | defined ( MBEDTLS_SSL_PROTO_TLS1_3 ) )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
2014-04-30 12:35:08 +02:00
# endif
2015-05-20 10:59:43 +02:00
# if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
2014-07-23 00:28:58 +02:00
# endif
2015-09-08 17:50:29 +02:00
# if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
2015-09-09 12:46:16 +02:00
! defined ( MBEDTLS_SSL_DTLS_HELLO_VERIFY )
2015-09-08 17:50:29 +02:00
# error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
( ! defined ( MBEDTLS_SSL_TLS_C ) | | ! defined ( MBEDTLS_SSL_PROTO_DTLS ) )
# error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
2014-09-24 14:05:32 +02:00
# endif
2020-03-04 21:35:27 +01:00
# if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
( ! defined ( MBEDTLS_SSL_TLS_C ) | | ! defined ( MBEDTLS_SSL_PROTO_DTLS ) )
# error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
# endif
# if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
defined ( MBEDTLS_SSL_CID_IN_LEN_MAX ) & & \
MBEDTLS_SSL_CID_IN_LEN_MAX > 255
# error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
# endif
# if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
defined ( MBEDTLS_SSL_CID_OUT_LEN_MAX ) & & \
MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
# error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
! defined ( MBEDTLS_SSL_PROTO_TLS1_2 )
2021-12-20 21:14:10 -08:00
# error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequisites"
2014-10-27 13:57:03 +01:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
! defined ( MBEDTLS_SSL_PROTO_TLS1_2 )
2021-12-20 21:14:10 -08:00
# error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequisites"
2014-10-28 14:13:55 +01:00
# endif
2022-08-12 22:43:18 +02:00
# if defined(MBEDTLS_SSL_RENEGOTIATION) && \
! defined ( MBEDTLS_SSL_PROTO_TLS1_2 )
# error "MBEDTLS_SSL_RENEGOTIATION defined, but not all prerequisites"
# endif
2022-10-10 08:47:13 +02:00
# if defined(MBEDTLS_SSL_TICKET_C) && \
2024-08-20 14:53:19 +01:00
! ( defined ( PSA_WANT_ALG_CCM ) | | defined ( PSA_WANT_ALG_GCM ) | | \
defined ( PSA_WANT_ALG_CHACHA20_POLY1305 ) )
2022-10-11 09:40:40 +02:00
# error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
2022-10-10 08:47:13 +02:00
# endif
2022-07-20 11:04:50 +08:00
# if defined(MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH) && \
MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH > = 256
# error "MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH must be less than 256"
2022-07-20 10:36:12 +08:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
! defined ( MBEDTLS_X509_CRT_PARSE_C )
# error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
# error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2023-07-27 10:10:28 +02:00
# if defined(MBEDTLS_X509_USE_C) && \
2025-05-12 20:52:07 +02:00
( ! defined ( MBEDTLS_ASN1_PARSE_C ) | | ! defined ( MBEDTLS_PK_PARSE_C ) )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2023-07-27 10:10:28 +02:00
# if defined(MBEDTLS_X509_CREATE_C) && \
2025-05-12 20:52:07 +02:00
( ! defined ( MBEDTLS_ASN1_WRITE_C ) | | ! defined ( MBEDTLS_PK_PARSE_C ) )
2015-04-08 12:49:31 +02:00
# error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
# error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
# error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
# error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
# error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2015-04-08 12:49:31 +02:00
# if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
# error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
2014-04-30 12:35:08 +02:00
# endif
2023-01-03 15:36:25 +01:00
# if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK) && \
2023-01-05 09:32:29 +01:00
( ! defined ( MBEDTLS_X509_CRT_PARSE_C ) )
2023-01-03 15:36:25 +01:00
# error "MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK defined, but not all prerequisites"
# endif
2017-12-21 10:15:08 +02:00
# if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
# error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
# endif
2020-10-21 15:12:39 +02:00
# if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
# error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
# endif
2023-02-10 12:45:19 +01:00
# if defined(MBEDTLS_SSL_RECORD_SIZE_LIMIT) && ( !defined(MBEDTLS_SSL_PROTO_TLS1_3) )
# error "MBEDTLS_SSL_RECORD_SIZE_LIMIT defined, but not all prerequisites"
# endif
2023-10-02 16:03:42 +02:00
# if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) && \
2024-08-20 14:53:19 +01:00
! ( defined ( PSA_WANT_ALG_CCM ) | | defined ( PSA_WANT_ALG_GCM ) | | \
defined ( PSA_WANT_ALG_CHACHA20_POLY1305 ) )
2022-09-28 07:59:01 +02:00
# error "MBEDTLS_SSL_CONTEXT_SERIALIZATION defined, but not all prerequisites"
# endif
2021-04-21 18:45:41 +02:00
/* Reject attempts to enable options that have been removed and that could
* cause a build to succeed but with features removed . */
# if defined(MBEDTLS_HAVEGE_C) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_HAVEGE_C was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/2599"
2021-04-21 18:45:41 +02:00
# endif
# if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_HW_RECORD_ACCEL was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4031"
2021-04-21 18:45:41 +02:00
# endif
# if defined(MBEDTLS_SSL_PROTO_SSL3) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_PROTO_SSL3 (SSL v3.0 support) was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4031"
2021-04-21 18:45:41 +02:00
# endif
# if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO (SSL v2 ClientHello support) was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4031"
2021-04-21 18:45:41 +02:00
# endif
# if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT (compatibility with the buggy implementation of truncated HMAC in Mbed TLS up to 2.7) was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4031"
2021-04-21 18:45:41 +02:00
# endif
# if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES) //no-check-names
2021-04-21 19:01:59 +02:00
# error "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES was removed in Mbed TLS 3.0. See the ChangeLog entry if you really need SHA-1-signed certificates."
2021-04-21 18:45:41 +02:00
# endif
# if defined(MBEDTLS_ZLIB_SUPPORT) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_ZLIB_SUPPORT was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4031"
2021-04-21 18:45:41 +02:00
# endif
2021-05-14 15:08:04 +02:00
# if defined(MBEDTLS_CHECK_PARAMS) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_CHECK_PARAMS was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4313"
2021-05-14 15:08:04 +02:00
# endif
2021-05-31 12:58:25 +02:00
# if defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_CID_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4335"
2021-05-31 12:58:25 +02:00
# endif
# if defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4335"
2021-05-31 12:58:25 +02:00
# endif
2021-06-15 12:54:14 +01:00
# if defined(MBEDTLS_SSL_TRUNCATED_HMAC) //no-check-names
2022-03-31 14:07:01 +01:00
# error "MBEDTLS_SSL_TRUNCATED_HMAC was removed in Mbed TLS 3.0. See https: //github.com/Mbed-TLS/mbedtls/issues/4341"
2021-06-15 12:54:14 +01:00
# endif
2020-11-16 19:03:12 +00:00
# if defined(MBEDTLS_PKCS7_C) && ( ( !defined(MBEDTLS_ASN1_PARSE_C) ) || \
2025-05-12 20:52:07 +02:00
( ! defined ( MBEDTLS_PK_PARSE_C ) ) | | \
2023-07-27 10:10:28 +02:00
( ! defined ( MBEDTLS_X509_CRT_PARSE_C ) ) | | \
( ! defined ( MBEDTLS_X509_CRL_PARSE_C ) ) | | \
2022-11-09 10:36:10 -06:00
( ! defined ( MBEDTLS_MD_C ) ) )
2020-11-16 19:03:12 +00:00
# error "MBEDTLS_PKCS7_C is defined, but not all prerequisites"
# endif
Have MBEDTLS_TIMING_C require MBEDTLS_HAVE_TIME
Nowadays, the timing module just builds on a function that provides a timer
with millisecond resolution. In terms of platform requirements, this is
almost exactly equivalent to `mbedtls_ms_time()`
provides (`mbedtls_ms_time()` is arguably a little stronger because it is
supposed to last longer than a single timer object, but an application could
start a timer when it starts, so there's no real difference.) So it's a bit
silly that `timing.c` essentially reimplements this. Rely on
`mbedtls_ms_time()` instead.
This is an API break because in Mbed TLS 4.0, it was possible to enable
`MBEDTLS_TIMING_C` without `MBEDTLS_HAVE_TIME`. However, `timing.c` only
provided an implementation for Windows and Unix-like platforms, and on those
platforms, it is very likely that the default implementation of
`MBEDTLS_HAVE_TIME` would also work. (The main exception would be a platform
that has the traditional Unix function `gettimeofday()`, but not the 1990s
novelty `clock_gettime()`.) So make this an official requirement, as a
belated change that really should have gone into 4.0 if we'd taken the time
to dig into it.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 16:26:18 +01:00
# if defined(MBEDTLS_TIMING_C) && \
! ( defined ( MBEDTLS_HAVE_TIME ) | | defined ( MBEDTLS_TIMING_ALT ) )
# error "MBEDTLS_TIMING_C requires either MBEDTLS_HAVE_TIME or MBEDTLS_TIMING_ALT"
# endif
2022-11-14 15:40:46 +00:00
/* *INDENT-ON* */
2015-04-08 12:49:31 +02:00
# endif /* MBEDTLS_CHECK_CONFIG_H */