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_SECP192R1_ENABLED) && \
119 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
120 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
121 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
122 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
123 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
124 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
125 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
126 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
127 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
128 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) )
129 #error "MBEDTLS_ECP_C defined, but not all prerequisites"
132 #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
133 !defined(MBEDTLS_SHA256_C))
134 #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
136 #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
137 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
138 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
140 #if defined(MBEDTLS_ENTROPY_C) && \
141 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
142 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
143 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
145 #if defined(MBEDTLS_ENTROPY_C) && \
146 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
147 #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
150 #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
151 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
152 #error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
154 #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
155 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
156 defined(MBEDTLS_HAVEGE_C) )
157 #error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
160 #if defined(MBEDTLS_GCM_C) && ( \
161 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) )
162 #error "MBEDTLS_GCM_C defined, but not all prerequisites"
165 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
166 #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
169 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
170 #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
173 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
174 #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
177 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
178 #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
181 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
182 #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
185 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
186 #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
189 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
190 #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
193 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
194 #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
197 #if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
198 #error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
201 #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
202 #error "MBEDTLS_HKDF_C defined, but not all prerequisites"
205 #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
206 #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
209 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
210 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
211 #error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
214 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
215 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
216 #error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
219 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
220 #error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
223 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
224 !defined(MBEDTLS_ECDH_C)
225 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
228 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
229 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
230 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
231 #error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
234 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
235 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
236 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
237 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
240 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
241 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
242 !defined(MBEDTLS_X509_CRT_PARSE_C) )
243 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
246 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
247 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
248 !defined(MBEDTLS_PKCS1_V15) )
249 #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
252 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
253 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
254 !defined(MBEDTLS_PKCS1_V15) )
255 #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
258 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
259 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
260 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
261 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
264 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
265 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
266 #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
269 #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
270 #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
273 #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
274 #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
277 #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
278 #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
281 #if defined(MBEDTLS_PK_C) && \
282 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
283 #error "MBEDTLS_PK_C defined, but not all prerequisites"
286 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
287 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
290 #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
291 #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
294 #if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
295 #error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
298 #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
299 #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
302 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
303 #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
306 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
307 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
308 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
309 #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
312 #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
313 ( !defined(MBEDTLS_PLATFORM_C) ||\
314 !defined(MBEDTLS_HAVE_TIME) )
315 #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
318 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
319 ( !defined(MBEDTLS_PLATFORM_C) ||\
320 !defined(MBEDTLS_HAVE_TIME) )
321 #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
324 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
325 ( !defined(MBEDTLS_PLATFORM_C) ||\
326 !defined(MBEDTLS_HAVE_TIME) )
327 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
330 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
331 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
332 defined(MBEDTLS_PLATFORM_TIME_ALT) )
333 #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
336 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
337 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
338 defined(MBEDTLS_PLATFORM_TIME_ALT) )
339 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
342 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
343 #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
346 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
347 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
350 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
351 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
352 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
353 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
356 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
357 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
358 #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
361 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
362 defined(MBEDTLS_PLATFORM_STD_FREE)
363 #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
366 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
367 #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
370 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
371 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
372 #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
375 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
376 defined(MBEDTLS_PLATFORM_STD_CALLOC)
377 #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
380 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
381 #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
384 #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
385 #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
388 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
389 #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
392 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
393 #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
396 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
397 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
398 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
399 #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
402 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
403 #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
406 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
407 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
410 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
411 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
412 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
413 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
416 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
417 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
418 #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
421 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
422 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
425 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
426 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
429 #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
430 #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
433 #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
434 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
435 #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
438 #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
439 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
440 !defined(MBEDTLS_HAVE_TIME) )
441 #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
444 #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
445 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
446 #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
449 #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
450 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
451 #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
454 #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
455 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
456 #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
459 #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
460 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
461 #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
464 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
465 !defined(MBEDTLS_ENTROPY_NV_SEED)
466 #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
469 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
470 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
471 #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
474 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
475 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
476 #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
479 #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
480 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
481 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
482 #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
485 #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
486 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
487 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
488 #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
491 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
492 !defined(MBEDTLS_OID_C) )
493 #error "MBEDTLS_RSA_C defined, but not all prerequisites"
496 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
497 !defined(MBEDTLS_PKCS1_V15) )
498 #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
501 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
502 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
503 #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
506 #if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
507 !defined(MBEDTLS_SHA1_C) )
508 #error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
511 #if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
512 !defined(MBEDTLS_SHA1_C) )
513 #error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
516 #if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
517 !defined(MBEDTLS_SHA1_C) )
518 #error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
521 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
522 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
523 #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
526 #if defined(MBEDTLS_SSL_PROTO_DTLS) && \
527 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
528 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
529 #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
532 #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
533 #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
536 #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
537 !defined(MBEDTLS_MD_C) )
538 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
541 #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
542 #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
545 #if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
546 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
547 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
548 #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
551 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
552 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
553 #error "Illegal protocol selection"
556 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
557 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
558 #error "Illegal protocol selection"
561 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
562 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
563 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
564 #error "Illegal protocol selection"
567 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
568 #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
571 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
572 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
573 #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
576 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
577 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
578 #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
581 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
582 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
583 #error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
586 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
587 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
588 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
589 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
590 #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
593 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
594 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
595 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
596 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
597 #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
600 #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
601 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
604 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
605 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
606 #error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
609 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
610 !defined(MBEDTLS_X509_CRT_PARSE_C)
611 #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
614 #if defined(MBEDTLS_THREADING_PTHREAD)
615 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
616 #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
618 #define MBEDTLS_THREADING_IMPL
621 #if defined(MBEDTLS_THREADING_ALT)
622 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
623 #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
625 #define MBEDTLS_THREADING_IMPL
628 #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
629 #error "MBEDTLS_THREADING_C defined, single threading implementation required"
631 #undef MBEDTLS_THREADING_IMPL
633 #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
634 #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
637 #if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
638 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
639 !defined(MBEDTLS_PK_PARSE_C) )
640 #error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
643 #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
644 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
645 !defined(MBEDTLS_PK_WRITE_C) )
646 #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
649 #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
650 #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
653 #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
654 #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
657 #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
658 #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
661 #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
662 #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
665 #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
666 #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
669 #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
670 #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
671 #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
673 #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
674 defined(MBEDTLS_HAVE_ASM)
675 #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
676 #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
679 * Avoid warning from -pedantic. This is a convenient place for this
680 * workaround since this is included by every single file before the
681 * #if defined(MBEDTLS_xxx_C) that results in emtpy translation units.
683 typedef int mbedtls_iso_c_forbids_empty_translation_units
;
685 #endif /* MBEDTLS_CHECK_CONFIG_H */