1 /** 2 * \file check_config.h 3 * 4 * \brief Consistency checks for configuration options 5 */ 6 /* 7 * Copyright The Mbed TLS Contributors 8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 */ 10 11 #ifndef MBEDTLS_CHECK_CONFIG_H 12 #define MBEDTLS_CHECK_CONFIG_H 13 14 /* *INDENT-OFF* */ 15 /* 16 * We assume CHAR_BIT is 8 in many places. In practice, this is true on our 17 * target platforms, so not an issue, but let's just be extra sure. 18 */ 19 #include <limits.h> 20 #if CHAR_BIT != 8 21 #error "Mbed TLS requires a platform with 8-bit chars" 22 #endif 23 24 #include <stdint.h> 25 26 #if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER <= 1900) 27 #if !defined(MBEDTLS_PLATFORM_C) 28 #error "MBEDTLS_PLATFORM_C is required on Windows" 29 #endif 30 /* See auto-enabling SNPRINTF_ALT and VSNPRINTF_ALT 31 * in * config_adjust_legacy_crypto.h */ 32 #endif /* _MINGW32__ || (_MSC_VER && (_MSC_VER <= 1900)) */ 33 34 #if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C) 35 #error "The NET module is not available for mbed OS - please use the network functions provided by Mbed OS" 36 #endif 37 38 #if defined(MBEDTLS_DEPRECATED_WARNING) && \ 39 !defined(__GNUC__) && !defined(__clang__) 40 #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang" 41 #endif 42 43 #if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME) 44 #error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense" 45 #endif 46 47 /* Limitations on ECC key types acceleration: if we have any of `PUBLIC_KEY`, 48 * `KEY_PAIR_BASIC`, `KEY_PAIR_IMPORT`, `KEY_PAIR_EXPORT` then we must have 49 * all 4 of them. 50 */ 51 #if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY) || \ 52 defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \ 53 defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT) || \ 54 defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT) 55 #if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY) || \ 56 !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \ 57 !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT) || \ 58 !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT) 59 #error "Unsupported partial support for ECC key type acceleration, see docs/driver-only-builds.md" 60 #endif /* not all of public, basic, import, export */ 61 #endif /* one of public, basic, import, export */ 62 63 /* Limitations on ECC curves acceleration: partial curve acceleration is only 64 * supported with crypto excluding PK, X.509 or TLS. 65 * Note: no need to check X.509 as it depends on PK. */ 66 #if defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256) || \ 67 defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384) || \ 68 defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512) || \ 69 defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255) || \ 70 defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448) || \ 71 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192) || \ 72 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224) || \ 73 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256) || \ 74 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192) || \ 75 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224) || \ 76 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256) || \ 77 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384) || \ 78 defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521) 79 #if defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES) 80 #if defined(MBEDTLS_PK_C) || \ 81 defined(MBEDTLS_SSL_TLS_C) 82 #error "Unsupported partial support for ECC curves acceleration, see docs/driver-only-builds.md" 83 #endif /* modules beyond what's supported */ 84 #endif /* not all curves accelerated */ 85 #endif /* some curve accelerated */ 86 87 #if defined(MBEDTLS_CTR_DRBG_C) && !(defined(MBEDTLS_AES_C) || \ 88 (defined(MBEDTLS_PSA_CRYPTO_CLIENT) && defined(PSA_WANT_KEY_TYPE_AES) && \ 89 defined(PSA_WANT_ALG_ECB_NO_PADDING))) 90 #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites" 91 #endif 92 93 #if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C) 94 #error "MBEDTLS_DHM_C defined, but not all prerequisites" 95 #endif 96 97 #if defined(MBEDTLS_CMAC_C) && \ 98 ( !defined(MBEDTLS_CIPHER_C ) || ( !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C) ) ) 99 #error "MBEDTLS_CMAC_C defined, but not all prerequisites" 100 #endif 101 102 #if defined(MBEDTLS_NIST_KW_C) && \ 103 ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) ) 104 #error "MBEDTLS_NIST_KW_C defined, but not all prerequisites" 105 #endif 106 107 #if defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT) && defined(MBEDTLS_PSA_CRYPTO_CONFIG) 108 #if defined(PSA_WANT_ALG_CBC_NO_PADDING) 109 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and PSA_WANT_ALG_CBC_NO_PADDING cannot be defined simultaneously" 110 #endif 111 #if defined(PSA_WANT_ALG_CBC_PKCS7) 112 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and PSA_WANT_ALG_CBC_PKCS7 cannot be defined simultaneously" 113 #endif 114 #if defined(PSA_WANT_ALG_ECB_NO_PADDING) 115 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and PSA_WANT_ALG_ECB_NO_PADDING cannot be defined simultaneously" 116 #endif 117 #if defined(PSA_WANT_KEY_TYPE_DES) 118 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and PSA_WANT_KEY_TYPE_DES cannot be defined simultaneously" 119 #endif 120 #endif 121 122 #if defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT) 123 #if defined(MBEDTLS_CIPHER_MODE_CBC) 124 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and MBEDTLS_CIPHER_MODE_CBC cannot be defined simultaneously" 125 #endif 126 #if defined(MBEDTLS_CIPHER_MODE_XTS) 127 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and MBEDTLS_CIPHER_MODE_XTS cannot be defined simultaneously" 128 #endif 129 #if defined(MBEDTLS_DES_C) 130 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and MBEDTLS_DES_C cannot be defined simultaneously" 131 #endif 132 #if defined(MBEDTLS_NIST_KW_C) 133 #error "MBEDTLS_BLOCK_CIPHER_NO_DECRYPT and MBEDTLS_NIST_KW_C cannot be defined simultaneously" 134 #endif 135 #endif 136 137 #if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C) 138 #error "MBEDTLS_ECDH_C defined, but not all prerequisites" 139 #endif 140 141 #if defined(MBEDTLS_ECDSA_C) && \ 142 ( !defined(MBEDTLS_ECP_C) || \ 143 !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \ 144 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \ 145 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \ 146 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \ 147 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \ 148 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \ 149 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \ 150 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \ 151 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \ 152 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \ 153 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \ 154 !defined(MBEDTLS_ASN1_PARSE_C) || \ 155 !defined(MBEDTLS_ASN1_WRITE_C) ) 156 #error "MBEDTLS_ECDSA_C defined, but not all prerequisites" 157 #endif 158 159 #if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO) 160 #if defined(MBEDTLS_PK_CAN_ECDSA_SIGN) && !defined(MBEDTLS_ASN1_WRITE_C) 161 #error "MBEDTLS_PK_C with MBEDTLS_USE_PSA_CRYPTO needs MBEDTLS_ASN1_WRITE_C for ECDSA signature" 162 #endif 163 #if defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) && !defined(MBEDTLS_ASN1_PARSE_C) 164 #error "MBEDTLS_PK_C with MBEDTLS_USE_PSA_CRYPTO needs MBEDTLS_ASN1_PARSE_C for ECDSA verification" 165 #endif 166 #endif /* MBEDTLS_PK_C && MBEDTLS_USE_PSA_CRYPTO */ 167 168 #if defined(MBEDTLS_ECJPAKE_C) && \ 169 !defined(MBEDTLS_ECP_C) 170 #error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites" 171 #endif 172 173 #if defined(MBEDTLS_ECP_RESTARTABLE) && \ 174 ( defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \ 175 defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \ 176 defined(MBEDTLS_ECDSA_SIGN_ALT) || \ 177 defined(MBEDTLS_ECDSA_VERIFY_ALT) || \ 178 defined(MBEDTLS_ECDSA_GENKEY_ALT) || \ 179 defined(MBEDTLS_ECP_INTERNAL_ALT) || \ 180 defined(MBEDTLS_ECP_ALT) ) 181 #error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative ECP implementation" 182 #endif 183 184 #if defined(MBEDTLS_ECP_RESTARTABLE) && \ 185 !defined(MBEDTLS_ECP_C) 186 #error "MBEDTLS_ECP_RESTARTABLE defined, but not all prerequisites" 187 #endif 188 189 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C) 190 #error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites" 191 #endif 192 193 #if defined(MBEDTLS_ECP_LIGHT) && ( !defined(MBEDTLS_BIGNUM_C) || ( \ 194 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \ 195 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \ 196 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \ 197 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \ 198 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \ 199 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \ 200 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \ 201 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \ 202 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \ 203 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \ 204 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \ 205 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \ 206 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) ) 207 #error "MBEDTLS_ECP_C defined (or a subset enabled), but not all prerequisites" 208 #endif 209 210 #if defined(MBEDTLS_ENTROPY_C) && \ 211 !(defined(MBEDTLS_MD_CAN_SHA512) || defined(MBEDTLS_MD_CAN_SHA256)) 212 #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites" 213 #endif 214 #if defined(MBEDTLS_ENTROPY_C) && \ 215 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64) 216 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high" 217 #endif 218 #if defined(MBEDTLS_ENTROPY_C) && \ 219 (defined(MBEDTLS_ENTROPY_FORCE_SHA256) || !defined(MBEDTLS_MD_CAN_SHA512)) \ 220 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32) 221 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high" 222 #endif 223 #if defined(MBEDTLS_ENTROPY_C) && \ 224 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_MD_CAN_SHA256) 225 #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites" 226 #endif 227 228 #if defined(__has_feature) 229 #if __has_feature(memory_sanitizer) 230 #define MBEDTLS_HAS_MEMSAN // #undef at the end of this paragraph 231 #endif 232 #endif 233 #if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN) 234 #error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer" 235 #endif 236 #undef MBEDTLS_HAS_MEMSAN // temporary macro defined above 237 238 #if defined(MBEDTLS_CCM_C) && \ 239 !(defined(MBEDTLS_CCM_GCM_CAN_AES) || defined(MBEDTLS_CCM_GCM_CAN_ARIA) || \ 240 defined(MBEDTLS_CCM_GCM_CAN_CAMELLIA)) 241 #error "MBEDTLS_CCM_C defined, but not all prerequisites" 242 #endif 243 244 #if defined(MBEDTLS_GCM_C) && \ 245 !(defined(MBEDTLS_CCM_GCM_CAN_AES) || defined(MBEDTLS_CCM_GCM_CAN_ARIA) || \ 246 defined(MBEDTLS_CCM_GCM_CAN_CAMELLIA)) 247 #error "MBEDTLS_GCM_C defined, but not all prerequisites" 248 #endif 249 250 #if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_CHACHA20_C) 251 #error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites" 252 #endif 253 254 #if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_POLY1305_C) 255 #error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites" 256 #endif 257 258 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 259 #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites" 260 #endif 261 262 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 263 #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites" 264 #endif 265 266 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 267 #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites" 268 #endif 269 270 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 271 #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites" 272 #endif 273 274 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 275 #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites" 276 #endif 277 278 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 279 #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites" 280 #endif 281 282 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 283 #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites" 284 #endif 285 286 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 287 #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites" 288 #endif 289 290 #if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT) 291 #error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled" 292 #endif 293 294 #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C) 295 #error "MBEDTLS_HKDF_C defined, but not all prerequisites" 296 #endif 297 298 #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C) 299 #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites" 300 #endif 301 302 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \ 303 ( !defined(MBEDTLS_CAN_ECDH) || \ 304 !defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || \ 305 !defined(MBEDTLS_X509_CRT_PARSE_C) ) 306 #error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites" 307 #endif 308 309 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \ 310 ( !defined(MBEDTLS_CAN_ECDH) || !defined(MBEDTLS_RSA_C) || \ 311 !defined(MBEDTLS_X509_CRT_PARSE_C) ) 312 #error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites" 313 #endif 314 315 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C) 316 #error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites" 317 #endif 318 319 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \ 320 !defined(MBEDTLS_CAN_ECDH) 321 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites" 322 #endif 323 324 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \ 325 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \ 326 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) ) 327 #error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites" 328 #endif 329 330 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \ 331 ( !defined(MBEDTLS_CAN_ECDH) || !defined(MBEDTLS_RSA_C) || \ 332 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) ) 333 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites" 334 #endif 335 336 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \ 337 ( !defined(MBEDTLS_CAN_ECDH) || \ 338 !defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || \ 339 !defined(MBEDTLS_X509_CRT_PARSE_C) ) 340 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites" 341 #endif 342 343 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \ 344 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \ 345 !defined(MBEDTLS_PKCS1_V15) ) 346 #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites" 347 #endif 348 349 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \ 350 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \ 351 !defined(MBEDTLS_PKCS1_V15) ) 352 #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites" 353 #endif 354 355 #if defined(MBEDTLS_USE_PSA_CRYPTO) 356 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \ 357 ( !defined(PSA_WANT_ALG_JPAKE) || \ 358 !defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \ 359 !defined(PSA_WANT_ECC_SECP_R1_256) ) 360 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites" 361 #endif 362 #else /* MBEDTLS_USE_PSA_CRYPTO */ 363 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \ 364 ( !defined(MBEDTLS_ECJPAKE_C) || \ 365 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) ) 366 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites" 367 #endif 368 #endif /* MBEDTLS_USE_PSA_CRYPTO */ 369 370 /* Use of EC J-PAKE in TLS requires SHA-256. */ 371 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \ 372 !defined(MBEDTLS_MD_CAN_SHA256) 373 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites" 374 #endif 375 376 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \ 377 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \ 378 !defined(MBEDTLS_MD_CAN_SHA256) && \ 379 !defined(MBEDTLS_MD_CAN_SHA512) && \ 380 !defined(MBEDTLS_MD_CAN_SHA1) 381 #error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires SHA-512, SHA-256 or SHA-1". 382 #endif 383 384 #if defined(MBEDTLS_MD_C) && \ 385 !defined(MBEDTLS_MD_CAN_MD5) && \ 386 !defined(MBEDTLS_MD_CAN_RIPEMD160) && \ 387 !defined(MBEDTLS_MD_CAN_SHA1) && \ 388 !defined(MBEDTLS_MD_CAN_SHA224) && \ 389 !defined(MBEDTLS_MD_CAN_SHA256) && \ 390 !defined(MBEDTLS_MD_CAN_SHA384) && \ 391 !defined(MBEDTLS_MD_CAN_SHA512) && \ 392 !defined(MBEDTLS_MD_CAN_SHA3_224) && \ 393 !defined(MBEDTLS_MD_CAN_SHA3_256) && \ 394 !defined(MBEDTLS_MD_CAN_SHA3_384) && \ 395 !defined(MBEDTLS_MD_CAN_SHA3_512) 396 #error "MBEDTLS_MD_C defined, but no hash algorithm" 397 #endif 398 399 #if defined(MBEDTLS_LMS_C) && \ 400 ! ( defined(MBEDTLS_PSA_CRYPTO_CLIENT) && defined(PSA_WANT_ALG_SHA_256) ) 401 #error "MBEDTLS_LMS_C requires MBEDTLS_PSA_CRYPTO_C and PSA_WANT_ALG_SHA_256" 402 #endif 403 404 #if defined(MBEDTLS_LMS_PRIVATE) && \ 405 ( !defined(MBEDTLS_LMS_C) ) 406 #error "MBEDTLS_LMS_PRIVATE requires MBEDTLS_LMS_C" 407 #endif 408 409 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \ 410 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) 411 #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites" 412 #endif 413 414 #if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) 415 #error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequisites" 416 #endif 417 418 #if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) 419 #error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequisites" 420 #endif 421 422 #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C) 423 #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites" 424 #endif 425 426 #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C) 427 #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites" 428 #endif 429 430 #if defined(MBEDTLS_PK_C) && \ 431 !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_PK_HAVE_ECC_KEYS) 432 #error "MBEDTLS_PK_C defined, but not all prerequisites" 433 #endif 434 435 #if defined(MBEDTLS_PK_PARSE_C) && \ 436 (!defined(MBEDTLS_ASN1_PARSE_C) || \ 437 !defined(MBEDTLS_OID_C) || \ 438 !defined(MBEDTLS_PK_C)) 439 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites" 440 #endif 441 442 #if defined(MBEDTLS_PK_WRITE_C) && \ 443 (!defined(MBEDTLS_ASN1_WRITE_C) || \ 444 !defined(MBEDTLS_OID_C) || \ 445 !defined(MBEDTLS_PK_C)) 446 #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites" 447 #endif 448 449 #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C) 450 #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites" 451 #endif 452 453 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C) 454 #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites" 455 #endif 456 457 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\ 458 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\ 459 defined(MBEDTLS_PLATFORM_EXIT_ALT) ) 460 #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously" 461 #endif 462 463 #if defined(MBEDTLS_PLATFORM_SETBUF_ALT) && !defined(MBEDTLS_PLATFORM_C) 464 #error "MBEDTLS_PLATFORM_SETBUF_ALT defined, but not all prerequisites" 465 #endif 466 467 #if defined(MBEDTLS_PLATFORM_SETBUF_MACRO) && !defined(MBEDTLS_PLATFORM_C) 468 #error "MBEDTLS_PLATFORM_SETBUF_MACRO defined, but not all prerequisites" 469 #endif 470 471 #if defined(MBEDTLS_PLATFORM_SETBUF_MACRO) &&\ 472 ( defined(MBEDTLS_PLATFORM_STD_SETBUF) ||\ 473 defined(MBEDTLS_PLATFORM_SETBUF_ALT) ) 474 #error "MBEDTLS_PLATFORM_SETBUF_MACRO and MBEDTLS_PLATFORM_STD_SETBUF/MBEDTLS_PLATFORM_SETBUF_ALT cannot be defined simultaneously" 475 #endif 476 477 #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\ 478 ( !defined(MBEDTLS_PLATFORM_C) ||\ 479 !defined(MBEDTLS_HAVE_TIME) ) 480 #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites" 481 #endif 482 483 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\ 484 ( !defined(MBEDTLS_PLATFORM_C) ||\ 485 !defined(MBEDTLS_HAVE_TIME) ) 486 #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites" 487 #endif 488 489 #if defined(MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO) &&\ 490 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_HAVE_TIME) ) 491 #error "MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO defined, but not all prerequisites" 492 #endif 493 494 #if defined(MBEDTLS_PLATFORM_MS_TIME_ALT) && \ 495 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_HAVE_TIME) ) 496 #error "MBEDTLS_PLATFORM_MS_TIME_ALT defined, but not all prerequisites" 497 #endif 498 499 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\ 500 ( !defined(MBEDTLS_PLATFORM_C) ||\ 501 !defined(MBEDTLS_HAVE_TIME) ) 502 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites" 503 #endif 504 505 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\ 506 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\ 507 defined(MBEDTLS_PLATFORM_TIME_ALT) ) 508 #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously" 509 #endif 510 511 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\ 512 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\ 513 defined(MBEDTLS_PLATFORM_TIME_ALT) ) 514 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously" 515 #endif 516 517 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) 518 #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites" 519 #endif 520 521 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) 522 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites" 523 #endif 524 525 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\ 526 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\ 527 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) ) 528 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously" 529 #endif 530 531 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\ 532 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) 533 #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites" 534 #endif 535 536 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\ 537 defined(MBEDTLS_PLATFORM_STD_FREE) 538 #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously" 539 #endif 540 541 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO) 542 #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is" 543 #endif 544 545 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\ 546 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) 547 #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites" 548 #endif 549 550 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\ 551 defined(MBEDTLS_PLATFORM_STD_CALLOC) 552 #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously" 553 #endif 554 555 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO) 556 #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is" 557 #endif 558 559 #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C) 560 #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites" 561 #endif 562 563 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) 564 #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites" 565 #endif 566 567 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) 568 #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites" 569 #endif 570 571 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\ 572 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\ 573 defined(MBEDTLS_PLATFORM_PRINTF_ALT) ) 574 #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously" 575 #endif 576 577 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) 578 #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites" 579 #endif 580 581 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) 582 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites" 583 #endif 584 585 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\ 586 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\ 587 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) ) 588 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously" 589 #endif 590 591 #if defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) 592 #error "MBEDTLS_PLATFORM_VSNPRINTF_ALT defined, but not all prerequisites" 593 #endif 594 595 #if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) 596 #error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO defined, but not all prerequisites" 597 #endif 598 599 #if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) &&\ 600 ( defined(MBEDTLS_PLATFORM_STD_VSNPRINTF) ||\ 601 defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) ) 602 #error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_VSNPRINTF/MBEDTLS_PLATFORM_VSNPRINTF_ALT cannot be defined simultaneously" 603 #endif 604 605 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\ 606 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) 607 #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites" 608 #endif 609 610 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY) 611 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites" 612 #endif 613 614 #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY) 615 #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites" 616 #endif 617 618 #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\ 619 !defined(MBEDTLS_PLATFORM_EXIT_ALT) 620 #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites" 621 #endif 622 623 #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\ 624 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\ 625 !defined(MBEDTLS_HAVE_TIME) ) 626 #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites" 627 #endif 628 629 #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\ 630 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT) 631 #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites" 632 #endif 633 634 #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\ 635 !defined(MBEDTLS_PLATFORM_PRINTF_ALT) 636 #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites" 637 #endif 638 639 #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\ 640 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) 641 #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites" 642 #endif 643 644 #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\ 645 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) ) 646 #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites" 647 #endif 648 649 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\ 650 !defined(MBEDTLS_ENTROPY_NV_SEED) 651 #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites" 652 #endif 653 654 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\ 655 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT) 656 #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites" 657 #endif 658 659 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\ 660 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT) 661 #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites" 662 #endif 663 664 #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\ 665 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\ 666 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) ) 667 #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously" 668 #endif 669 670 #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\ 671 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\ 672 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) ) 673 #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously" 674 #endif 675 676 #if defined(MBEDTLS_PSA_CRYPTO_C) && \ 677 !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \ 678 defined(MBEDTLS_ENTROPY_C) ) || \ 679 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) ) 680 #error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)" 681 #endif 682 683 #if defined(MBEDTLS_PSA_CRYPTO_C) && defined(PSA_HAVE_SOFT_BLOCK_MODE) && \ 684 defined(PSA_HAVE_SOFT_BLOCK_CIPHER) && !defined(MBEDTLS_CIPHER_C) 685 #error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites" 686 #endif 687 688 #if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C) 689 #error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites" 690 #endif 691 692 #if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \ 693 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \ 694 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) ) 695 #error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites" 696 #endif 697 698 #if defined(MBEDTLS_PSA_CRYPTO_SE_C) 699 #if defined(MBEDTLS_DEPRECATED_REMOVED) 700 #error "MBEDTLS_PSA_CRYPTO_SE_C is deprecated and will be removed in a future version of Mbed TLS" 701 #elif defined(MBEDTLS_DEPRECATED_WARNING) 702 #warning "MBEDTLS_PSA_CRYPTO_SE_C is deprecated and will be removed in a future version of Mbed TLS" 703 #endif 704 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */ 705 706 #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \ 707 ! defined(MBEDTLS_PSA_CRYPTO_C) 708 #error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites" 709 #endif 710 711 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \ 712 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \ 713 defined(MBEDTLS_ENTROPY_NV_SEED) ) 714 #error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites" 715 #endif 716 717 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \ 718 !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) 719 #error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources" 720 #endif 721 722 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \ 723 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) 724 #error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG" 725 #endif 726 727 #if defined(MBEDTLS_PSA_ITS_FILE_C) && \ 728 !defined(MBEDTLS_FS_IO) 729 #error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites" 730 #endif 731 732 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ 733 !defined(MBEDTLS_OID_C) ) 734 #error "MBEDTLS_RSA_C defined, but not all prerequisites" 735 #endif 736 737 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \ 738 !defined(MBEDTLS_PKCS1_V15) ) 739 #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled" 740 #endif 741 742 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \ 743 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) ) 744 #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites" 745 #endif 746 747 #if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) && \ 748 defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY) 749 #error "Must only define one of MBEDTLS_SHA512_USE_A64_CRYPTO_*" 750 #endif 751 752 #if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \ 753 defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY) 754 #if !defined(MBEDTLS_SHA512_C) 755 #error "MBEDTLS_SHA512_USE_A64_CRYPTO_* defined without MBEDTLS_SHA512_C" 756 #endif 757 #if defined(MBEDTLS_SHA512_ALT) || defined(MBEDTLS_SHA512_PROCESS_ALT) 758 #error "MBEDTLS_SHA512_*ALT can't be used with MBEDTLS_SHA512_USE_A64_CRYPTO_*" 759 #endif 760 761 #endif /* MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT || MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY */ 762 763 #if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY) && !defined(__aarch64__) 764 #error "MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY defined on non-Aarch64 system" 765 #endif 766 767 #if defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT) && \ 768 defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY) 769 #error "Must only define one of MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_*" 770 #endif 771 772 #if defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT) || \ 773 defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY) 774 #if !defined(MBEDTLS_SHA256_C) 775 #error "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_* defined without MBEDTLS_SHA256_C" 776 #endif 777 #if defined(MBEDTLS_SHA256_ALT) || defined(MBEDTLS_SHA256_PROCESS_ALT) 778 #error "MBEDTLS_SHA256_*ALT can't be used with MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_*" 779 #endif 780 781 #endif 782 783 #if defined(MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY) && !defined(MBEDTLS_ARCH_IS_ARMV8_A) 784 #error "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY defined on non-Armv8-A system" 785 #endif 786 787 /* TLS 1.3 requires separate HKDF parts from PSA, 788 * and at least one ciphersuite, so at least SHA-256 or SHA-384 789 * from PSA to use with HKDF. 790 * 791 * Note: for dependencies common with TLS 1.2 (running handshake hash), 792 * see MBEDTLS_SSL_TLS_C. */ 793 #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \ 794 !(defined(MBEDTLS_PSA_CRYPTO_CLIENT) && \ 795 defined(PSA_WANT_ALG_HKDF_EXTRACT) && \ 796 defined(PSA_WANT_ALG_HKDF_EXPAND) && \ 797 (defined(PSA_WANT_ALG_SHA_256) || defined(PSA_WANT_ALG_SHA_384))) 798 #error "MBEDTLS_SSL_PROTO_TLS1_3 defined, but not all prerequisites" 799 #endif 800 801 #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) 802 #if !( (defined(PSA_WANT_ALG_ECDH) || defined(PSA_WANT_ALG_FFDH)) && \ 803 defined(MBEDTLS_X509_CRT_PARSE_C) && \ 804 ( defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || defined(MBEDTLS_PKCS1_V21) ) ) 805 #error "MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED defined, but not all prerequisites" 806 #endif 807 #endif 808 809 #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED) 810 #if !( defined(PSA_WANT_ALG_ECDH) || defined(PSA_WANT_ALG_FFDH) ) 811 #error "MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED defined, but not all prerequisites" 812 #endif 813 #endif 814 815 /* 816 * The current implementation of TLS 1.3 requires MBEDTLS_SSL_KEEP_PEER_CERTIFICATE. 817 */ 818 #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) 819 #error "MBEDTLS_SSL_PROTO_TLS1_3 defined without MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" 820 #endif 821 822 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ 823 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ 824 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ 825 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ 826 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ 827 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ 828 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \ 829 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ 830 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \ 831 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \ 832 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ 833 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) ) 834 #error "One or more versions of the TLS protocol are enabled " \ 835 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx" 836 #endif 837 838 #if defined(MBEDTLS_SSL_EARLY_DATA) && \ 839 ( !defined(MBEDTLS_SSL_SESSION_TICKETS) || \ 840 ( !defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED) && \ 841 !defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED) ) ) 842 #error "MBEDTLS_SSL_EARLY_DATA defined, but not all prerequisites" 843 #endif 844 845 #if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_SRV_C) && \ 846 defined(MBEDTLS_SSL_MAX_EARLY_DATA_SIZE) && \ 847 ((MBEDTLS_SSL_MAX_EARLY_DATA_SIZE < 0) || \ 848 (MBEDTLS_SSL_MAX_EARLY_DATA_SIZE > UINT32_MAX)) 849 #error "MBEDTLS_SSL_MAX_EARLY_DATA_SIZE must be in the range(0..UINT32_MAX)" 850 #endif 851 852 #if defined(MBEDTLS_SSL_PROTO_DTLS) && \ 853 !defined(MBEDTLS_SSL_PROTO_TLS1_2) 854 #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites" 855 #endif 856 857 #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C) 858 #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites" 859 #endif 860 861 #if defined(MBEDTLS_SSL_ASYNC_PRIVATE) && !defined(MBEDTLS_X509_CRT_PARSE_C) 862 #error "MBEDTLS_SSL_ASYNC_PRIVATE defined, but not all prerequisites" 863 #endif 864 865 #if defined(MBEDTLS_SSL_TLS_C) && !(defined(MBEDTLS_CIPHER_C) || \ 866 defined(MBEDTLS_USE_PSA_CRYPTO)) 867 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites" 868 #endif 869 870 /* TLS 1.2 and 1.3 require SHA-256 or SHA-384 (running handshake hash) */ 871 #if defined(MBEDTLS_SSL_TLS_C) 872 #if defined(MBEDTLS_USE_PSA_CRYPTO) 873 #if !(defined(PSA_WANT_ALG_SHA_256) || defined(PSA_WANT_ALG_SHA_384)) 874 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites" 875 #endif 876 #else /* MBEDTLS_USE_PSA_CRYPTO */ 877 #if !defined(MBEDTLS_MD_C) || \ 878 !(defined(MBEDTLS_MD_CAN_SHA256) || defined(MBEDTLS_MD_CAN_SHA384)) 879 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites" 880 #endif 881 #endif /* MBEDTLS_USE_PSA_CRYPTO */ 882 #endif /* MBEDTLS_SSL_TLS_C */ 883 884 #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C) 885 #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites" 886 #endif 887 888 #if defined(MBEDTLS_SSL_TLS_C) && \ 889 !( defined(MBEDTLS_SSL_PROTO_TLS1_2) || defined(MBEDTLS_SSL_PROTO_TLS1_3) ) 890 #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active" 891 #endif 892 893 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS) 894 #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites" 895 #endif 896 897 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \ 898 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) 899 #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites" 900 #endif 901 902 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \ 903 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) 904 #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites" 905 #endif 906 907 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ 908 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) 909 #error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites" 910 #endif 911 912 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ 913 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \ 914 MBEDTLS_SSL_CID_IN_LEN_MAX > 255 915 #error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)" 916 #endif 917 918 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ 919 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \ 920 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255 921 #error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)" 922 #endif 923 924 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT) && \ 925 !defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) 926 #error "MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT defined, but not all prerequisites" 927 #endif 928 929 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT) && MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT != 0 930 #if defined(MBEDTLS_DEPRECATED_REMOVED) 931 #error "MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT is deprecated and will be removed in a future version of Mbed TLS" 932 #elif defined(MBEDTLS_DEPRECATED_WARNING) 933 #warning "MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT is deprecated and will be removed in a future version of Mbed TLS" 934 #endif 935 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT && MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT != 0 */ 936 937 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \ 938 !defined(MBEDTLS_SSL_PROTO_TLS1_2) 939 #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequisites" 940 #endif 941 942 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \ 943 !defined(MBEDTLS_SSL_PROTO_TLS1_2) 944 #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequisites" 945 #endif 946 947 #if defined(MBEDTLS_SSL_RENEGOTIATION) && \ 948 !defined(MBEDTLS_SSL_PROTO_TLS1_2) 949 #error "MBEDTLS_SSL_RENEGOTIATION defined, but not all prerequisites" 950 #endif 951 952 #if defined(MBEDTLS_SSL_TICKET_C) && ( !defined(MBEDTLS_CIPHER_C) && \ 953 !defined(MBEDTLS_USE_PSA_CRYPTO) ) 954 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites" 955 #endif 956 957 #if defined(MBEDTLS_SSL_TICKET_C) && \ 958 !( defined(MBEDTLS_SSL_HAVE_CCM) || defined(MBEDTLS_SSL_HAVE_GCM) || \ 959 defined(MBEDTLS_SSL_HAVE_CHACHAPOLY) ) 960 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites" 961 #endif 962 963 #if defined(MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH) && \ 964 MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH >= 256 965 #error "MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH must be less than 256" 966 #endif 967 968 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \ 969 !defined(MBEDTLS_X509_CRT_PARSE_C) 970 #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites" 971 #endif 972 973 #if defined(MBEDTLS_THREADING_PTHREAD) 974 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL) 975 #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites" 976 #endif 977 #define MBEDTLS_THREADING_IMPL // undef at the end of this paragraph 978 #endif 979 #if defined(MBEDTLS_THREADING_ALT) 980 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL) 981 #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites" 982 #endif 983 #define MBEDTLS_THREADING_IMPL // undef at the end of this paragraph 984 #endif 985 #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL) 986 #error "MBEDTLS_THREADING_C defined, single threading implementation required" 987 #endif 988 #undef MBEDTLS_THREADING_IMPL // temporary macro defined above 989 990 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_CLIENT) 991 #error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites" 992 #endif 993 994 #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C) 995 #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites" 996 #endif 997 998 #if defined(MBEDTLS_X509_USE_C) && \ 999 (!defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \ 1000 !defined(MBEDTLS_PK_PARSE_C) || \ 1001 ( !defined(MBEDTLS_MD_C) && !defined(MBEDTLS_USE_PSA_CRYPTO) ) ) 1002 #error "MBEDTLS_X509_USE_C defined, but not all prerequisites" 1003 #endif 1004 1005 #if defined(MBEDTLS_X509_CREATE_C) && \ 1006 (!defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \ 1007 !defined(MBEDTLS_PK_PARSE_C) || \ 1008 ( !defined(MBEDTLS_MD_C) && !defined(MBEDTLS_USE_PSA_CRYPTO) ) ) 1009 #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites" 1010 #endif 1011 1012 #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) 1013 #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites" 1014 #endif 1015 1016 #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) 1017 #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites" 1018 #endif 1019 1020 #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) 1021 #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites" 1022 #endif 1023 1024 #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) ) 1025 #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites" 1026 #endif 1027 1028 #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) ) 1029 #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites" 1030 #endif 1031 1032 #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK) && \ 1033 ( !defined(MBEDTLS_X509_CRT_PARSE_C) ) 1034 #error "MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK defined, but not all prerequisites" 1035 #endif 1036 1037 #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64) 1038 #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously" 1039 #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */ 1040 1041 #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \ 1042 defined(MBEDTLS_HAVE_ASM) 1043 #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously" 1044 #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */ 1045 1046 #if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) ) 1047 #error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites" 1048 #endif 1049 1050 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) ) 1051 #error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites" 1052 #endif 1053 1054 #if defined(MBEDTLS_SSL_RECORD_SIZE_LIMIT) && ( !defined(MBEDTLS_SSL_PROTO_TLS1_3) ) 1055 #error "MBEDTLS_SSL_RECORD_SIZE_LIMIT defined, but not all prerequisites" 1056 #endif 1057 1058 #if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) && \ 1059 !( defined(MBEDTLS_SSL_HAVE_CCM) || defined(MBEDTLS_SSL_HAVE_GCM) || \ 1060 defined(MBEDTLS_SSL_HAVE_CHACHAPOLY) ) 1061 #error "MBEDTLS_SSL_CONTEXT_SERIALIZATION defined, but not all prerequisites" 1062 #endif 1063 1064 /* Reject attempts to enable options that have been removed and that could 1065 * cause a build to succeed but with features removed. */ 1066 1067 #if defined(MBEDTLS_HAVEGE_C) //no-check-names 1068 #error "MBEDTLS_HAVEGE_C was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/2599" 1069 #endif 1070 1071 #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) //no-check-names 1072 #error "MBEDTLS_SSL_HW_RECORD_ACCEL was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/4031" 1073 #endif 1074 1075 #if defined(MBEDTLS_SSL_PROTO_SSL3) //no-check-names 1076 #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" 1077 #endif 1078 1079 #if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO) //no-check-names 1080 #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" 1081 #endif 1082 1083 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) //no-check-names 1084 #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" 1085 #endif 1086 1087 #if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES) //no-check-names 1088 #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." 1089 #endif 1090 1091 #if defined(MBEDTLS_ZLIB_SUPPORT) //no-check-names 1092 #error "MBEDTLS_ZLIB_SUPPORT was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/4031" 1093 #endif 1094 1095 #if defined(MBEDTLS_CHECK_PARAMS) //no-check-names 1096 #error "MBEDTLS_CHECK_PARAMS was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/4313" 1097 #endif 1098 1099 #if defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY) //no-check-names 1100 #error "MBEDTLS_SSL_CID_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/4335" 1101 #endif 1102 1103 #if defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY) //no-check-names 1104 #error "MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/4335" 1105 #endif 1106 1107 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) //no-check-names 1108 #error "MBEDTLS_SSL_TRUNCATED_HMAC was removed in Mbed TLS 3.0. See https://github.com/Mbed-TLS/mbedtls/issues/4341" 1109 #endif 1110 1111 #if defined(MBEDTLS_PKCS7_C) && ( ( !defined(MBEDTLS_ASN1_PARSE_C) ) || \ 1112 ( !defined(MBEDTLS_OID_C) ) || ( !defined(MBEDTLS_PK_PARSE_C) ) || \ 1113 ( !defined(MBEDTLS_X509_CRT_PARSE_C) ) || \ 1114 ( !defined(MBEDTLS_X509_CRL_PARSE_C) ) || \ 1115 ( !defined(MBEDTLS_MD_C) ) ) 1116 #error "MBEDTLS_PKCS7_C is defined, but not all prerequisites" 1117 #endif 1118 1119 /* 1120 * Avoid warning from -pedantic. This is a convenient place for this 1121 * workaround since this is included by every single file before the 1122 * #if defined(MBEDTLS_xxx_C) that results in empty translation units. 1123 */ 1124 typedef int mbedtls_iso_c_forbids_empty_translation_units; 1125 1126 /* *INDENT-ON* */ 1127 #endif /* MBEDTLS_CHECK_CONFIG_H */ 1128