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