Mbed OS Reference
Loading...
Searching...
No Matches
check_config.h
Go to the documentation of this file.
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
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22
23/*
24 * It is recommended to include this file from your config.h
25 * in order to catch dependency issues early.
26 */
27
28#ifndef MBEDTLS_CHECK_CONFIG_H
29#define MBEDTLS_CHECK_CONFIG_H
30
31/*
32 * We assume CHAR_BIT is 8 in many places. In practice, this is true on our
33 * target platforms, so not an issue, but let's just be extra sure.
34 */
35#include <limits.h>
36#if CHAR_BIT != 8
37#error "mbed TLS requires a platform with 8-bit chars"
38#endif
39
40#if defined(_WIN32)
41#if !defined(MBEDTLS_PLATFORM_C)
42#error "MBEDTLS_PLATFORM_C is required on Windows"
43#endif
44
45/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
46 * it would confuse config.py. */
47#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
48 !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
49#define MBEDTLS_PLATFORM_SNPRINTF_ALT
50#endif
51
52#if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \
53 !defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
54#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
55#endif
56#endif /* _WIN32 */
57
58#if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C)
59#error "The NET module is not available for mbed OS - please use the network functions provided by mbed OS"
60#endif
61
62#if defined(MBEDTLS_DEPRECATED_WARNING) && \
63 !defined(__GNUC__) && !defined(__clang__)
64#error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
65#endif
66
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"
69#endif
70
71#if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
72#error "MBEDTLS_AESNI_C defined, but not all prerequisites"
73#endif
74
75#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
76#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
77#endif
78
79#if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
80#error "MBEDTLS_DHM_C defined, but not all prerequisites"
81#endif
82
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"
85#endif
86
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"
90#endif
91
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"
95#endif
96
97#if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
98#error "MBEDTLS_ECDH_C defined, but not all prerequisites"
99#endif
100
101#if defined(MBEDTLS_ECDSA_C) && \
102 ( !defined(MBEDTLS_ECP_C) || \
103 !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
104 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
105 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
106 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
107 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
108 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
109 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
110 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \
111 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
112 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
113 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \
114 !defined(MBEDTLS_ASN1_PARSE_C) || \
115 !defined(MBEDTLS_ASN1_WRITE_C) )
116#error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
117#endif
118
119#if defined(MBEDTLS_ECJPAKE_C) && \
120 ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
121#error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
122#endif
123
124#if defined(MBEDTLS_ECP_RESTARTABLE) && \
125 ( defined(MBEDTLS_USE_PSA_CRYPTO) || \
126 defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \
127 defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \
128 defined(MBEDTLS_ECDSA_SIGN_ALT) || \
129 defined(MBEDTLS_ECDSA_VERIFY_ALT) || \
130 defined(MBEDTLS_ECDSA_GENKEY_ALT) || \
131 defined(MBEDTLS_ECP_INTERNAL_ALT) || \
132 defined(MBEDTLS_ECP_ALT) )
133#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative or PSA-based ECP implementation"
134#endif
135
136#if defined(MBEDTLS_ECP_RESTARTABLE) && \
137 ! defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
138#error "MBEDTLS_ECP_RESTARTABLE defined, but not MBEDTLS_ECDH_LEGACY_CONTEXT"
139#endif
140
141#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) && \
142 defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
143#error "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED defined, but MBEDTLS_ECDH_LEGACY_CONTEXT not disabled"
144#endif
145
146#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
147#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
148#endif
149
150#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
151 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
152 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
153 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
154 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
155 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
156 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
157 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
158 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
159 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
160 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
161 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
162 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
163 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
164#error "MBEDTLS_ECP_C defined, but not all prerequisites"
165#endif
166
167#if defined(MBEDTLS_ECP_C) && !( \
168 defined(MBEDTLS_ECP_ALT) || \
169 defined(MBEDTLS_CTR_DRBG_C) || \
170 defined(MBEDTLS_HMAC_DRBG_C) || \
171 defined(MBEDTLS_ECP_NO_INTERNAL_RNG))
172#error "MBEDTLS_ECP_C requires a DRBG module unless MBEDTLS_ECP_NO_INTERNAL_RNG is defined or an alternative implementation is used"
173#endif
174
175#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
176#error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
177#endif
178
179#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
180 !defined(MBEDTLS_SHA256_C))
181#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
182#endif
183#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
184 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
185#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
186#endif
187#if defined(MBEDTLS_ENTROPY_C) && \
188 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
189 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
190#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
191#endif
192#if defined(MBEDTLS_ENTROPY_C) && \
193 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
194#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
195#endif
196
197#if defined(__has_feature)
198#if __has_feature(memory_sanitizer)
199#define MBEDTLS_HAS_MEMSAN
200#endif
201#endif
202#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
203#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
204#endif
205#undef MBEDTLS_HAS_MEMSAN
206
207#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
208 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
209#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
210#endif
211#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
212 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
213 defined(MBEDTLS_HAVEGE_C) )
214#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
215#endif
216
217#if defined(MBEDTLS_GCM_C) && ( \
218 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
219#error "MBEDTLS_GCM_C defined, but not all prerequisites"
220#endif
221
222#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
223#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
224#endif
225
226#if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
227#error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
228#endif
229
230#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
231#error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
232#endif
233
234#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
235#error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
236#endif
237
238#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
239#error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
240#endif
241
242#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
243#error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
244#endif
245
246#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
247#error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
248#endif
249
250#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
251#error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
252#endif
253
254#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
255#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
256#endif
257
258#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
259#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
260#endif
261
262#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
263#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
264#endif
265
266#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
267 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
268 !defined(MBEDTLS_X509_CRT_PARSE_C) )
269#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
270#endif
271
272#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
273 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
274 !defined(MBEDTLS_X509_CRT_PARSE_C) )
275#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
276#endif
277
278#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
279#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
280#endif
281
282#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
283 !defined(MBEDTLS_ECDH_C)
284#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
285#endif
286
287#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
288 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
289 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
290#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
291#endif
292
293#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
294 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
295 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
296#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
297#endif
298
299#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
300 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
301 !defined(MBEDTLS_X509_CRT_PARSE_C) )
302#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
303#endif
304
305#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
306 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
307 !defined(MBEDTLS_PKCS1_V15) )
308#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
309#endif
310
311#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
312 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
313 !defined(MBEDTLS_PKCS1_V15) )
314#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
315#endif
316
317#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
318 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
319 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
320#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
321#endif
322
323#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
324 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \
325 ( !defined(MBEDTLS_SHA256_C) && \
326 !defined(MBEDTLS_SHA512_C) && \
327 !defined(MBEDTLS_SHA1_C) )
328#error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C"
329#endif
330
331#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
332 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
333#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
334#endif
335
336#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
337#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites"
338#endif
339
340#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
341#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites"
342#endif
343
344#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
345#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
346#endif
347
348#if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
349#error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
350#endif
351
352#if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
353#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
354#endif
355
356#if defined(MBEDTLS_PK_C) && \
357 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
358#error "MBEDTLS_PK_C defined, but not all prerequisites"
359#endif
360
361#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
362#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
363#endif
364
365#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
366#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
367#endif
368
369#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
370#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
371#endif
372
373#if defined(MBEDTLS_PKCS11_C)
374#if defined(MBEDTLS_DEPRECATED_REMOVED)
375#error "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
376#elif defined(MBEDTLS_DEPRECATED_WARNING)
377#warning "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
378#endif
379#endif /* MBEDTLS_PKCS11_C */
380
381#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
382#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
383#endif
384
385#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
386#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
387#endif
388
389#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
390 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
391 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
392#error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
393#endif
394
395#if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
396 ( !defined(MBEDTLS_PLATFORM_C) ||\
397 !defined(MBEDTLS_HAVE_TIME) )
398#error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
399#endif
400
401#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
402 ( !defined(MBEDTLS_PLATFORM_C) ||\
403 !defined(MBEDTLS_HAVE_TIME) )
404#error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
405#endif
406
407#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
408 ( !defined(MBEDTLS_PLATFORM_C) ||\
409 !defined(MBEDTLS_HAVE_TIME) )
410#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
411#endif
412
413#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
414 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
415 defined(MBEDTLS_PLATFORM_TIME_ALT) )
416#error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
417#endif
418
419#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
420 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
421 defined(MBEDTLS_PLATFORM_TIME_ALT) )
422#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
423#endif
424
425#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
426#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
427#endif
428
429#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
430#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
431#endif
432
433#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
434 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
435 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
436#error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
437#endif
438
439#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
440 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
441#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
442#endif
443
444#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
445 defined(MBEDTLS_PLATFORM_STD_FREE)
446#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
447#endif
448
449#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
450#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
451#endif
452
453#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
454 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
455#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
456#endif
457
458#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
459 defined(MBEDTLS_PLATFORM_STD_CALLOC)
460#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
461#endif
462
463#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
464#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
465#endif
466
467#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
468#error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
469#endif
470
471#if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
472#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
473#endif
474
475#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
476#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
477#endif
478
479#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
480 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
481 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
482#error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
483#endif
484
485#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
486#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
487#endif
488
489#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
490#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
491#endif
492
493#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
494 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
495 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
496#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
497#endif
498
499#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
500 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
501#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
502#endif
503
504#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
505#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
506#endif
507
508#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
509#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
510#endif
511
512#if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
513#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
514#endif
515
516#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
517 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
518#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
519#endif
520
521#if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
522 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
523 !defined(MBEDTLS_HAVE_TIME) )
524#error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
525#endif
526
527#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
528 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
529#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
530#endif
531
532#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
533 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
534#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
535#endif
536
537#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
538 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
539#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
540#endif
541
542#if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
543 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
544#error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
545#endif
546
547#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
548 !defined(MBEDTLS_ENTROPY_NV_SEED)
549#error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
550#endif
551
552#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
553 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
554#error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
555#endif
556
557#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
558 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
559#error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
560#endif
561
562#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
563 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
564 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
565#error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
566#endif
567
568#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
569 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
570 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
571#error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
572#endif
573
574#if defined(MBEDTLS_PSA_CRYPTO_C) && \
575 !( defined(MBEDTLS_CTR_DRBG_C) && \
576 defined(MBEDTLS_ENTROPY_C) )
577#error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites"
578#endif
579
580#if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C)
581#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
582#endif
583
584#if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \
585 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \
586 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) )
587#error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites"
588#endif
589
590#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
591 ! defined(MBEDTLS_PSA_CRYPTO_C)
592#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
593#endif
594
595#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
596 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
597 defined(MBEDTLS_ENTROPY_NV_SEED) )
598#error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
599#endif
600
601#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
602 !defined(MBEDTLS_FS_IO)
603#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
604#endif
605
606#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
607 defined(MBEDTLS_USE_PSA_CRYPTO)
608#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
609#endif
610
611#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
612 !defined(MBEDTLS_OID_C) )
613#error "MBEDTLS_RSA_C defined, but not all prerequisites"
614#endif
615
616#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
617 !defined(MBEDTLS_PKCS1_V15) )
618#error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
619#endif
620
621#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
622 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
623#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
624#endif
625
626#if defined(MBEDTLS_SHA512_NO_SHA384) && !defined(MBEDTLS_SHA512_C)
627#error "MBEDTLS_SHA512_NO_SHA384 defined without MBEDTLS_SHA512_C"
628#endif
629
630#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
631 !defined(MBEDTLS_SHA1_C) )
632#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
633#endif
634
635#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
636 !defined(MBEDTLS_SHA1_C) )
637#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
638#endif
639
640#if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
641 !defined(MBEDTLS_SHA1_C) )
642#error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
643#endif
644
645#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
646 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
647#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
648#endif
649
650#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) && ( !defined(MBEDTLS_HKDF_C) && \
651 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
652#error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites"
653#endif
654
655#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
656 defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
657 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
658 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
659 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
660 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
661 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
662 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
663 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
664 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
665 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
666 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
667 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
668#error "One or more versions of the TLS protocol are enabled " \
669 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
670#endif
671
672#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
673 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
674 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
675#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
676#endif
677
678#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
679#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
680#endif
681
682#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
683 !defined(MBEDTLS_MD_C) )
684#error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
685#endif
686
687#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
688#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
689#endif
690
691#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
692 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
693 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
694#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
695#endif
696
697#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
698 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
699#error "Illegal protocol selection"
700#endif
701
702#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
703 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
704#error "Illegal protocol selection"
705#endif
706
707#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
708 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
709 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
710#error "Illegal protocol selection"
711#endif
712
713#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
714#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
715#endif
716
717#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
718 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
719#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
720#endif
721
722#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
723 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
724#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
725#endif
726
727#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
728 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
729#error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
730#endif
731
732#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
733 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \
734 MBEDTLS_SSL_CID_IN_LEN_MAX > 255
735#error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
736#endif
737
738#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
739 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \
740 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
741#error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
742#endif
743
744#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
745 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
746#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
747#endif
748
749#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
750 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
751 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
752 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
753#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
754#endif
755
756#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
757 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
758 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
759 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
760#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
761#endif
762
763#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
764#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
765#endif
766
767#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
768 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
769#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
770#endif
771
772#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
773 !defined(MBEDTLS_X509_CRT_PARSE_C)
774#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
775#endif
776
777#if defined(MBEDTLS_THREADING_PTHREAD)
778#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
779#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
780#endif
781#define MBEDTLS_THREADING_IMPL
782#endif
783
784#if defined(MBEDTLS_THREADING_ALT)
785#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
786#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
787#endif
788#define MBEDTLS_THREADING_IMPL
789#endif
790
791#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
792#error "MBEDTLS_THREADING_C defined, single threading implementation required"
793#endif
794#undef MBEDTLS_THREADING_IMPL
795
796#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C)
797#error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites"
798#endif
799
800#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
801#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
802#endif
803
804#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
805 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
806 !defined(MBEDTLS_PK_PARSE_C) )
807#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
808#endif
809
810#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
811 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
812 !defined(MBEDTLS_PK_WRITE_C) )
813#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
814#endif
815
816#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
817#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
818#endif
819
820#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
821#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
822#endif
823
824#if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
825#error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
826#endif
827
828#if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
829#error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
830#endif
831
832#if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
833#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
834#endif
835
836#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
837#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
838#endif
839
840#if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
841#error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
842#endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
843
844#if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
845 defined(MBEDTLS_HAVE_ASM)
846#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
847#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
848
849#if defined(MBEDTLS_SSL_PROTO_SSL3)
850#if defined(MBEDTLS_DEPRECATED_REMOVED)
851#error "MBEDTLS_SSL_PROTO_SSL3 is deprecated and will be removed in a future version of Mbed TLS"
852#elif defined(MBEDTLS_DEPRECATED_WARNING)
853#warning "MBEDTLS_SSL_PROTO_SSL3 is deprecated and will be removed in a future version of Mbed TLS"
854#endif
855#endif /* MBEDTLS_SSL_PROTO_SSL3 */
856
857#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
858#if defined(MBEDTLS_DEPRECATED_REMOVED)
859#error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is deprecated and will be removed in a future version of Mbed TLS"
860#elif defined(MBEDTLS_DEPRECATED_WARNING)
861#warning "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is deprecated and will be removed in a future version of Mbed TLS"
862#endif
863#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
864
865#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
866#if defined(MBEDTLS_DEPRECATED_REMOVED)
867#error "MBEDTLS_SSL_HW_RECORD_ACCEL is deprecated and will be removed in a future version of Mbed TLS"
868#elif defined(MBEDTLS_DEPRECATED_WARNING)
869#warning "MBEDTLS_SSL_HW_RECORD_ACCEL is deprecated and will be removed in a future version of Mbed TLS"
870#endif /* MBEDTLS_DEPRECATED_REMOVED */
871#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
872
873#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
874#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
875#endif
876
877/*
878 * Avoid warning from -pedantic. This is a convenient place for this
879 * workaround since this is included by every single file before the
880 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
881 */
882typedef int mbedtls_iso_c_forbids_empty_translation_units;
883
884#endif /* MBEDTLS_CHECK_CONFIG_H */