23 #ifndef MBEDTLS_CHECK_CONFIG_H
24 #define MBEDTLS_CHECK_CONFIG_H
32 #error "mbed TLS requires a platform with 8-bit chars"
36 #if !defined(MBEDTLS_PLATFORM_C)
37 #error "MBEDTLS_PLATFORM_C is required on Windows"
42 #if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
43 !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
44 #define MBEDTLS_PLATFORM_SNPRINTF_ALT
47 #if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \
48 !defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
49 #define MBEDTLS_PLATFORM_VSNPRINTF_ALT
53 #if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C)
54 #error "The NET module is not available for mbed OS - please use the network functions provided by Mbed OS"
57 #if defined(MBEDTLS_DEPRECATED_WARNING) && \
58 !defined(__GNUC__) && !defined(__clang__)
59 #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
62 #if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
63 #error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
66 #if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
67 #error "MBEDTLS_AESNI_C defined, but not all prerequisites"
70 #if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
71 #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
74 #if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
75 #error "MBEDTLS_DHM_C defined, but not all prerequisites"
78 #if defined(MBEDTLS_CMAC_C) && \
79 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
80 #error "MBEDTLS_CMAC_C defined, but not all prerequisites"
83 #if defined(MBEDTLS_NIST_KW_C) && \
84 ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) )
85 #error "MBEDTLS_NIST_KW_C defined, but not all prerequisites"
88 #if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
89 #error "MBEDTLS_ECDH_C defined, but not all prerequisites"
92 #if defined(MBEDTLS_ECDSA_C) && \
93 ( !defined(MBEDTLS_ECP_C) || \
94 !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
95 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
96 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
97 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
98 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
99 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
100 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
101 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \
102 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
103 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
104 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \
105 !defined(MBEDTLS_ASN1_PARSE_C) || \
106 !defined(MBEDTLS_ASN1_WRITE_C) )
107 #error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
110 #if defined(MBEDTLS_ECJPAKE_C) && \
111 ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
112 #error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
115 #if defined(MBEDTLS_ECP_RESTARTABLE) && \
116 ( defined(MBEDTLS_USE_PSA_CRYPTO) || \
117 defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \
118 defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \
119 defined(MBEDTLS_ECDSA_SIGN_ALT) || \
120 defined(MBEDTLS_ECDSA_VERIFY_ALT) || \
121 defined(MBEDTLS_ECDSA_GENKEY_ALT) || \
122 defined(MBEDTLS_ECP_INTERNAL_ALT) || \
123 defined(MBEDTLS_ECP_ALT) )
124 #error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative or PSA-based ECP implementation"
127 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
128 #error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
131 #if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
132 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
133 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
134 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
135 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
136 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
137 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
138 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
139 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
140 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
141 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
142 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
143 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
144 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
145 #error "MBEDTLS_ECP_C defined, but not all prerequisites"
148 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
149 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
152 #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
153 !defined(MBEDTLS_SHA256_C))
154 #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
156 #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
157 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
158 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
160 #if defined(MBEDTLS_ENTROPY_C) && \
161 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
162 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
163 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
165 #if defined(MBEDTLS_ENTROPY_C) && \
166 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
167 #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
170 #if defined(__has_feature)
171 #if __has_feature(memory_sanitizer)
172 #define MBEDTLS_HAS_MEMSAN
175 #if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
176 #error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
178 #undef MBEDTLS_HAS_MEMSAN
180 #if defined(MBEDTLS_GCM_C) && ( \
181 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
182 #error "MBEDTLS_GCM_C defined, but not all prerequisites"
185 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
186 #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
189 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
190 #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
193 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
194 #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
197 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
198 #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
201 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
202 #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
205 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
206 #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
209 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
210 #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
213 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
214 #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
217 #if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
218 #error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled"
221 #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
222 #error "MBEDTLS_HKDF_C defined, but not all prerequisites"
225 #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
226 #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
229 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
230 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
231 !defined(MBEDTLS_X509_CRT_PARSE_C) )
232 #error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
235 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
236 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
237 !defined(MBEDTLS_X509_CRT_PARSE_C) )
238 #error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
241 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
242 #error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
245 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
246 !defined(MBEDTLS_ECDH_C)
247 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
250 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
251 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
252 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
253 #error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
256 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
257 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
258 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
259 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
262 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
263 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
264 !defined(MBEDTLS_X509_CRT_PARSE_C) )
265 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
268 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
269 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
270 !defined(MBEDTLS_PKCS1_V15) )
271 #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
274 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
275 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
276 !defined(MBEDTLS_PKCS1_V15) )
277 #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
280 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
281 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
282 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
283 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
286 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
287 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \
288 ( !defined(MBEDTLS_SHA256_C) && \
289 !defined(MBEDTLS_SHA512_C) && \
290 !defined(MBEDTLS_SHA1_C) )
291 #error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C"
294 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
295 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
296 #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
299 #if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
300 #error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites"
303 #if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
304 #error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites"
307 #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
308 #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
311 #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
312 #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
315 #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
316 #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
319 #if defined(MBEDTLS_PK_C) && \
320 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
321 #error "MBEDTLS_PK_C defined, but not all prerequisites"
324 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
325 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
328 #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
329 #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
332 #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
333 #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
336 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
337 #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
340 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
341 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
342 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
343 #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
346 #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
347 ( !defined(MBEDTLS_PLATFORM_C) ||\
348 !defined(MBEDTLS_HAVE_TIME) )
349 #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
352 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
353 ( !defined(MBEDTLS_PLATFORM_C) ||\
354 !defined(MBEDTLS_HAVE_TIME) )
355 #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
358 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
359 ( !defined(MBEDTLS_PLATFORM_C) ||\
360 !defined(MBEDTLS_HAVE_TIME) )
361 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
364 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
365 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
366 defined(MBEDTLS_PLATFORM_TIME_ALT) )
367 #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
370 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
371 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
372 defined(MBEDTLS_PLATFORM_TIME_ALT) )
373 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
376 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
377 #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
380 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
381 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
384 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
385 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
386 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
387 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
390 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
391 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
392 #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
395 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
396 defined(MBEDTLS_PLATFORM_STD_FREE)
397 #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
400 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
401 #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
404 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
405 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
406 #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
409 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
410 defined(MBEDTLS_PLATFORM_STD_CALLOC)
411 #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
414 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
415 #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
418 #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
419 #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
422 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
423 #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
426 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
427 #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
430 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
431 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
432 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
433 #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
436 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
437 #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
440 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
441 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
444 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
445 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
446 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
447 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
450 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
451 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
452 #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
455 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
456 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
459 #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
460 #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
463 #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
464 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
465 #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
468 #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
469 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
470 !defined(MBEDTLS_HAVE_TIME) )
471 #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
474 #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
475 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
476 #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
479 #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
480 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
481 #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
484 #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
485 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
486 #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
489 #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
490 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
491 #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
494 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
495 !defined(MBEDTLS_ENTROPY_NV_SEED)
496 #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
499 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
500 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
501 #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
504 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
505 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
506 #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
509 #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
510 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
511 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
512 #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
515 #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
516 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
517 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
518 #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
521 #if defined(MBEDTLS_PSA_CRYPTO_C) && \
522 !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \
523 defined(MBEDTLS_ENTROPY_C) ) || \
524 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) )
525 #error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)"
528 #if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C)
529 #error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
532 #if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \
533 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \
534 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) )
535 #error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites"
538 #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
539 ! defined(MBEDTLS_PSA_CRYPTO_C)
540 #error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
543 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
544 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
545 defined(MBEDTLS_ENTROPY_NV_SEED) )
546 #error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
549 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
550 !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
551 #error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources"
554 #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
555 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
556 #error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG"
559 #if defined(MBEDTLS_PSA_ITS_FILE_C) && \
560 !defined(MBEDTLS_FS_IO)
561 #error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
564 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
565 defined(MBEDTLS_USE_PSA_CRYPTO)
566 #error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
569 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
570 !defined(MBEDTLS_OID_C) )
571 #error "MBEDTLS_RSA_C defined, but not all prerequisites"
574 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
575 !defined(MBEDTLS_PKCS1_V15) )
576 #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
579 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
580 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
581 #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
584 #if defined(MBEDTLS_SHA384_C) && !defined(MBEDTLS_SHA512_C)
585 #error "MBEDTLS_SHA384_C defined without MBEDTLS_SHA512_C"
588 #if defined(MBEDTLS_SHA224_C) && !defined(MBEDTLS_SHA256_C)
589 #error "MBEDTLS_SHA224_C defined without MBEDTLS_SHA256_C"
592 #if defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA224_C)
593 #error "MBEDTLS_SHA256_C defined without MBEDTLS_SHA224_C"
596 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
597 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
598 #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
606 #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \
607 ( ( !defined(MBEDTLS_HKDF_C) ) || \
608 ( !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA384_C) ) || \
609 ( !defined(MBEDTLS_PSA_CRYPTO_C) ) )
610 #error "MBEDTLS_SSL_PROTO_TLS1_3 defined, but not all prerequisites"
613 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
614 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
615 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
616 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
617 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
618 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
619 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
620 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
621 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
622 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
623 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
624 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
625 #error "One or more versions of the TLS protocol are enabled " \
626 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
629 #if defined(MBEDTLS_SSL_PROTO_DTLS) && \
630 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
631 #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
634 #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
635 #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
638 #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
639 !defined(MBEDTLS_MD_C) )
640 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
643 #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
644 #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
647 #if defined(MBEDTLS_SSL_TLS_C) && !defined(MBEDTLS_SSL_PROTO_TLS1_2)
648 #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
651 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
652 #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
655 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
656 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
657 #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
660 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
661 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
662 #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
665 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
666 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
667 #error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
670 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
671 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \
672 MBEDTLS_SSL_CID_IN_LEN_MAX > 255
673 #error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
676 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
677 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \
678 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
679 #error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
682 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
683 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
684 #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
687 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
688 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
689 #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
692 #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
693 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
696 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
697 !defined(MBEDTLS_X509_CRT_PARSE_C)
698 #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
701 #if defined(MBEDTLS_THREADING_PTHREAD)
702 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
703 #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
705 #define MBEDTLS_THREADING_IMPL
708 #if defined(MBEDTLS_THREADING_ALT)
709 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
710 #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
712 #define MBEDTLS_THREADING_IMPL
715 #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
716 #error "MBEDTLS_THREADING_C defined, single threading implementation required"
718 #undef MBEDTLS_THREADING_IMPL
720 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C)
721 #error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites"
724 #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
725 #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
728 #if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
729 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
730 !defined(MBEDTLS_PK_PARSE_C) )
731 #error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
734 #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
735 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
736 !defined(MBEDTLS_PK_WRITE_C) )
737 #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
740 #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
741 #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
744 #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
745 #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
748 #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
749 #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
752 #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
753 #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
756 #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
757 #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
760 #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
761 #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
764 #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
765 defined(MBEDTLS_HAVE_ASM)
766 #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
769 #if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
770 #error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
773 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
774 #error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
782 #if defined(MBEDTLS_HAVEGE_C) //no-check-names
783 #error "MBEDTLS_HAVEGE_C was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/2599"
786 #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) //no-check-names
787 #error "MBEDTLS_SSL_HW_RECORD_ACCEL was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
790 #if defined(MBEDTLS_SSL_PROTO_SSL3) //no-check-names
791 #error "MBEDTLS_SSL_PROTO_SSL3 (SSL v3.0 support) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
794 #if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO) //no-check-names
795 #error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO (SSL v2 ClientHello support) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
798 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) //no-check-names
799 #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/ARMmbed/mbedtls/issues/4031"
802 #if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES) //no-check-names
803 #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."
806 #if defined(MBEDTLS_ZLIB_SUPPORT) //no-check-names
807 #error "MBEDTLS_ZLIB_SUPPORT was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
810 #if defined(MBEDTLS_CHECK_PARAMS) //no-check-names
811 #error "MBEDTLS_CHECK_PARAMS was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4313"
814 #if defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY) //no-check-names
815 #error "MBEDTLS_SSL_CID_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4335"
818 #if defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY) //no-check-names
819 #error "MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4335"
822 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) //no-check-names
823 #error "MBEDTLS_SSL_TRUNCATED_HMAC was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4341"
int mbedtls_iso_c_forbids_empty_translation_units