4 * \brief Consistency checks for configuration options
7 * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
8 * SPDX-License-Identifier: GPL-2.0
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * This file is part of mbed TLS (https://tls.mbed.org)
28 * It is recommended to include this file from your config.h
29 * in order to catch dependency issues early.
32 #ifndef MBEDTLS_CHECK_CONFIG_H
33 #define MBEDTLS_CHECK_CONFIG_H
36 * We assume CHAR_BIT is 8 in many places. In practice, this is true on our
37 * target platforms, so not an issue, but let's just be extra sure.
41 #error "mbed TLS requires a platform with 8-bit chars"
45 #if !defined(MBEDTLS_PLATFORM_C)
46 #error "MBEDTLS_PLATFORM_C is required on Windows"
49 /* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
50 * it would confuse config.pl. */
51 #if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
52 !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
53 #define MBEDTLS_PLATFORM_SNPRINTF_ALT
57 #if defined(TARGET_LIKE_MBED) && \
58 ( defined(MBEDTLS_NET_C) || defined(MBEDTLS_TIMING_C) )
59 #error "The NET and TIMING modules are not available for mbed OS - please use the network and timing functions provided by mbed OS"
62 #if defined(MBEDTLS_DEPRECATED_WARNING) && \
63 !defined(__GNUC__) && !defined(__clang__)
64 #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
67 #if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
68 #error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
71 #if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
72 #error "MBEDTLS_AESNI_C defined, but not all prerequisites"
75 #if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
76 #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
79 #if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
80 #error "MBEDTLS_DHM_C defined, but not all prerequisites"
83 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
84 #error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
87 #if defined(MBEDTLS_CMAC_C) && \
88 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
89 #error "MBEDTLS_CMAC_C defined, but not all prerequisites"
92 #if defined(MBEDTLS_NIST_KW_C) && \
93 ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) )
94 #error "MBEDTLS_NIST_KW_C defined, but not all prerequisites"
97 #if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
98 #error "MBEDTLS_ECDH_C defined, but not all prerequisites"
101 #if defined(MBEDTLS_ECDSA_C) && \
102 ( !defined(MBEDTLS_ECP_C) || \
103 !defined(MBEDTLS_ASN1_PARSE_C) || \
104 !defined(MBEDTLS_ASN1_WRITE_C) )
105 #error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
108 #if defined(MBEDTLS_ECJPAKE_C) && \
109 ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
110 #error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
113 #if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
114 #error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
117 #if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
118 !defined(MBEDTLS_ECP_DP_SECP128R1_ENABLED) && \
119 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
120 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
121 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
122 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
123 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
124 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
125 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
126 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
127 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
128 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
129 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) )
130 #error "MBEDTLS_ECP_C defined, but not all prerequisites"
133 #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
134 !defined(MBEDTLS_SHA256_C))
135 #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
137 #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
138 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
139 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
141 #if defined(MBEDTLS_ENTROPY_C) && \
142 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
143 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
144 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
146 #if defined(MBEDTLS_ENTROPY_C) && \
147 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
148 #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
151 #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
152 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
153 #error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
155 #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
156 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
157 defined(MBEDTLS_HAVEGE_C) )
158 #error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
161 #if defined(MBEDTLS_GCM_C) && ( \
162 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) )
163 #error "MBEDTLS_GCM_C defined, but not all prerequisites"
166 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
167 #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
170 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
171 #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
174 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
175 #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
178 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
179 #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
182 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
183 #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
186 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
187 #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
190 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
191 #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
194 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
195 #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
198 #if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
199 #error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
202 #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
203 #error "MBEDTLS_HKDF_C defined, but not all prerequisites"
206 #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
207 #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
210 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
211 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
212 #error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
215 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
216 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
217 #error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
220 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
221 #error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
224 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
225 !defined(MBEDTLS_ECDH_C)
226 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
229 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
230 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
231 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
232 #error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
235 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
236 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
237 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
238 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
241 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
242 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
243 !defined(MBEDTLS_X509_CRT_PARSE_C) )
244 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
247 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
248 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
249 !defined(MBEDTLS_PKCS1_V15) )
250 #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
253 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
254 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
255 !defined(MBEDTLS_PKCS1_V15) )
256 #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
259 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
260 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
261 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
262 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
265 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
266 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
267 #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
270 #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
271 #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
274 #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
275 #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
278 #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
279 #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
282 #if defined(MBEDTLS_PK_C) && \
283 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
284 #error "MBEDTLS_PK_C defined, but not all prerequisites"
287 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
288 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
291 #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
292 #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
295 #if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
296 #error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
299 #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
300 #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
303 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
304 #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
307 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
308 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
309 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
310 #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
313 #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
314 ( !defined(MBEDTLS_PLATFORM_C) ||\
315 !defined(MBEDTLS_HAVE_TIME) )
316 #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
319 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
320 ( !defined(MBEDTLS_PLATFORM_C) ||\
321 !defined(MBEDTLS_HAVE_TIME) )
322 #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
325 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
326 ( !defined(MBEDTLS_PLATFORM_C) ||\
327 !defined(MBEDTLS_HAVE_TIME) )
328 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
331 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
332 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
333 defined(MBEDTLS_PLATFORM_TIME_ALT) )
334 #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
337 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
338 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
339 defined(MBEDTLS_PLATFORM_TIME_ALT) )
340 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
343 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
344 #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
347 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
348 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
351 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
352 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
353 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
354 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
357 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
358 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
359 #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
362 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
363 defined(MBEDTLS_PLATFORM_STD_FREE)
364 #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
367 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
368 #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
371 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
372 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
373 #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
376 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
377 defined(MBEDTLS_PLATFORM_STD_CALLOC)
378 #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
381 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
382 #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
385 #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
386 #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
389 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
390 #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
393 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
394 #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
397 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
398 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
399 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
400 #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
403 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
404 #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
407 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
408 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
411 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
412 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
413 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
414 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
417 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
418 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
419 #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
422 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
423 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
426 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
427 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
430 #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
431 #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
434 #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
435 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
436 #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
439 #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
440 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
441 !defined(MBEDTLS_HAVE_TIME) )
442 #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
445 #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
446 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
447 #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
450 #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
451 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
452 #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
455 #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
456 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
457 #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
460 #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
461 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
462 #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
465 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
466 !defined(MBEDTLS_ENTROPY_NV_SEED)
467 #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
470 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
471 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
472 #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
475 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
476 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
477 #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
480 #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
481 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
482 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
483 #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
486 #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
487 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
488 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
489 #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
492 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
493 !defined(MBEDTLS_OID_C) )
494 #error "MBEDTLS_RSA_C defined, but not all prerequisites"
497 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
498 !defined(MBEDTLS_PKCS1_V15) )
499 #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
502 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
503 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
504 #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
507 #if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
508 !defined(MBEDTLS_SHA1_C) )
509 #error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
512 #if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
513 !defined(MBEDTLS_SHA1_C) )
514 #error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
517 #if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
518 !defined(MBEDTLS_SHA1_C) )
519 #error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
522 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
523 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
524 #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
527 #if defined(MBEDTLS_SSL_PROTO_DTLS) && \
528 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
529 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
530 #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
533 #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
534 #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
537 #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
538 !defined(MBEDTLS_MD_C) )
539 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
542 #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
543 #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
546 #if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
547 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
548 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
549 #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
552 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
553 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
554 #error "Illegal protocol selection"
557 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
558 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
559 #error "Illegal protocol selection"
562 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
563 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
564 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
565 #error "Illegal protocol selection"
568 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
569 #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
572 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
573 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
574 #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
577 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
578 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
579 #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
582 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
583 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
584 #error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
587 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
588 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
589 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
590 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
591 #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
594 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
595 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
596 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
597 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
598 #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
601 #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
602 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
605 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
606 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
607 #error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
610 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
611 !defined(MBEDTLS_X509_CRT_PARSE_C)
612 #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
615 #if defined(MBEDTLS_THREADING_PTHREAD)
616 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
617 #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
619 #define MBEDTLS_THREADING_IMPL
622 #if defined(MBEDTLS_THREADING_ALT)
623 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
624 #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
626 #define MBEDTLS_THREADING_IMPL
629 #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
630 #error "MBEDTLS_THREADING_C defined, single threading implementation required"
632 #undef MBEDTLS_THREADING_IMPL
634 #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
635 #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
638 #if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
639 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
640 !defined(MBEDTLS_PK_PARSE_C) )
641 #error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
644 #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
645 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
646 !defined(MBEDTLS_PK_WRITE_C) )
647 #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
650 #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
651 #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
654 #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
655 #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
658 #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
659 #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
662 #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
663 #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
666 #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
667 #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
670 #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
671 #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
672 #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
674 #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
675 defined(MBEDTLS_HAVE_ASM)
676 #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
677 #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
680 * Avoid warning from -pedantic. This is a convenient place for this
681 * workaround since this is included by every single file before the
682 * #if defined(MBEDTLS_xxx_C) that results in emtpy translation units.
684 typedef int mbedtls_iso_c_forbids_empty_translation_units
;
686 #endif /* MBEDTLS_CHECK_CONFIG_H */