mbed TLS v2.16.3: check_config.h Source File

mbed TLS v2.16.3

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_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
285 #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
286 #endif
287
288 #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
289 #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
290 #endif
291
292 #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
293 #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
294 #endif
295
296 #if defined(MBEDTLS_PK_C) && \
297 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
298 #error "MBEDTLS_PK_C defined, but not all prerequisites"
299 #endif
300
301 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
302 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
303 #endif
304
305 #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
306 #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
307 #endif
308
309 #if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
310 #error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
311 #endif
312
313 #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
314 #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
315 #endif
316
317 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
318 #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
319 #endif
320
321 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
322 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
323 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
324 #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
325 #endif
326
327 #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
328 ( !defined(MBEDTLS_PLATFORM_C) ||\
329 !defined(MBEDTLS_HAVE_TIME) )
330 #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
331 #endif
332
333 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
334 ( !defined(MBEDTLS_PLATFORM_C) ||\
335 !defined(MBEDTLS_HAVE_TIME) )
336 #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
337 #endif
338
339 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
340 ( !defined(MBEDTLS_PLATFORM_C) ||\
341 !defined(MBEDTLS_HAVE_TIME) )
342 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
343 #endif
344
345 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
346 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
347 defined(MBEDTLS_PLATFORM_TIME_ALT) )
348 #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
349 #endif
350
351 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
352 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
353 defined(MBEDTLS_PLATFORM_TIME_ALT) )
354 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
355 #endif
356
357 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
358 #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
359 #endif
360
361 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
362 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
363 #endif
364
365 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
366 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
367 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
368 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
369 #endif
370
371 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
372 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
373 #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
374 #endif
375
376 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
377 defined(MBEDTLS_PLATFORM_STD_FREE)
378 #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
379 #endif
380
381 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
382 #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
383 #endif
384
385 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
386 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
387 #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
388 #endif
389
390 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
391 defined(MBEDTLS_PLATFORM_STD_CALLOC)
392 #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
393 #endif
394
395 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
396 #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
397 #endif
398
399 #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
400 #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
401 #endif
402
403 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
404 #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
405 #endif
406
407 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
408 #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
409 #endif
410
411 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
412 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
413 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
414 #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
415 #endif
416
417 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
418 #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
419 #endif
420
421 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
422 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
423 #endif
424
425 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
426 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
427 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
428 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
429 #endif
430
431 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
432 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
433 #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
434 #endif
435
436 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
437 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
438 #endif
439
440 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
441 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
442 #endif
443
444 #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
445 #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
446 #endif
447
448 #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
449 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
450 #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
451 #endif
452
453 #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
454 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
455 !defined(MBEDTLS_HAVE_TIME) )
456 #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
457 #endif
458
459 #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
460 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
461 #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
462 #endif
463
464 #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
465 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
466 #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
467 #endif
468
469 #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
470 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
471 #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
472 #endif
473
474 #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
475 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
476 #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
477 #endif
478
479 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
480 !defined(MBEDTLS_ENTROPY_NV_SEED)
481 #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
482 #endif
483
484 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
485 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
486 #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
487 #endif
488
489 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
490 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
491 #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
492 #endif
493
494 #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
495 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
496 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
497 #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
498 #endif
499
500 #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
501 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
502 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
503 #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
504 #endif
505
506 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
507 !defined(MBEDTLS_OID_C) )
508 #error "MBEDTLS_RSA_C defined, but not all prerequisites"
509 #endif
510
511 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
512 !defined(MBEDTLS_PKCS1_V15) )
513 #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
514 #endif
515
516 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
517 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
518 #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
519 #endif
520
521 #if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
522 !defined(MBEDTLS_SHA1_C) )
523 #error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
524 #endif
525
526 #if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
527 !defined(MBEDTLS_SHA1_C) )
528 #error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
529 #endif
530
531 #if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
532 !defined(MBEDTLS_SHA1_C) )
533 #error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
534 #endif
535
536 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
537 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
538 #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
539 #endif
540
541 #if defined(MBEDTLS_SSL_PROTO_DTLS) && \
542 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
543 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
544 #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
545 #endif
546
547 #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
548 #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
549 #endif
550
551 #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
552 !defined(MBEDTLS_MD_C) )
553 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
554 #endif
555
556 #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
557 #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
558 #endif
559
560 #if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
561 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
562 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
563 #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
564 #endif
565
566 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
567 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
568 #error "Illegal protocol selection"
569 #endif
570
571 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
572 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
573 #error "Illegal protocol selection"
574 #endif
575
576 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
577 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
578 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
579 #error "Illegal protocol selection"
580 #endif
581
582 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
583 #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
584 #endif
585
586 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
587 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
588 #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
589 #endif
590
591 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
592 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
593 #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
594 #endif
595
596 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
597 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
598 #error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
599 #endif
600
601 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
602 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
603 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
604 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
605 #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
606 #endif
607
608 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
609 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
610 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
611 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
612 #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
613 #endif
614
615 #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
616 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
617 #endif
618
619 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
620 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
621 #error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
622 #endif
623
624 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
625 !defined(MBEDTLS_X509_CRT_PARSE_C)
626 #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
627 #endif
628
629 #if defined(MBEDTLS_THREADING_PTHREAD)
630 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
631 #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
632 #endif
633 #define MBEDTLS_THREADING_IMPL
634 #endif
635
636 #if defined(MBEDTLS_THREADING_ALT)
637 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
638 #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
639 #endif
640 #define MBEDTLS_THREADING_IMPL
641 #endif
642
643 #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
644 #error "MBEDTLS_THREADING_C defined, single threading implementation required"
645 #endif
646 #undef MBEDTLS_THREADING_IMPL
647
648 #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
649 #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
650 #endif
651
652 #if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
653 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
654 !defined(MBEDTLS_PK_PARSE_C) )
655 #error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
656 #endif
657
658 #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
659 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
660 !defined(MBEDTLS_PK_WRITE_C) )
661 #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
662 #endif
663
664 #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
665 #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
666 #endif
667
668 #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
669 #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
670 #endif
671
672 #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
673 #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
674 #endif
675
676 #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
677 #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
678 #endif
679
680 #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
681 #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
682 #endif
683
684 #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
685 #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
686 #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
687
688 #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
689 defined(MBEDTLS_HAVE_ASM)
690 #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
691 #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
692
693 /*
694 * Avoid warning from -pedantic. This is a convenient place for this
695 * workaround since this is included by every single file before the
696 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
697 */
698 typedef int mbedtls_iso_c_forbids_empty_translation_units;
699
700 #endif /* MBEDTLS_CHECK_CONFIG_H */
mbedtls_iso_c_forbids_empty_translation_units
int mbedtls_iso_c_forbids_empty_translation_units
Definition: check_config.h:698