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