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