mbed TLS v2.16.5

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