mbed TLS v2.16.0: check_config.h Source File

mbed TLS v2.16.0

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 #error "MBEDTLS_ECP_C defined, but not all prerequisites"
139 #endif
140
141 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
142 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
143 #endif
144
145 #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
146 !defined(MBEDTLS_SHA256_C))
147 #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
148 #endif
149 #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
150 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
151 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
152 #endif
153 #if defined(MBEDTLS_ENTROPY_C) && \
154 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
155 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
156 #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
157 #endif
158 #if defined(MBEDTLS_ENTROPY_C) && \
159 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
160 #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
161 #endif
162
163 #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
164 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
165 #error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
166 #endif
167 #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
168 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
169 defined(MBEDTLS_HAVEGE_C) )
170 #error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
171 #endif
172
173 #if defined(MBEDTLS_GCM_C) && ( \
174 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) )
175 #error "MBEDTLS_GCM_C defined, but not all prerequisites"
176 #endif
177
178 #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
179 #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
180 #endif
181
182 #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
183 #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
184 #endif
185
186 #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
187 #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
188 #endif
189
190 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
191 #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
192 #endif
193
194 #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
195 #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
196 #endif
197
198 #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
199 #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
200 #endif
201
202 #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
203 #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
204 #endif
205
206 #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
207 #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
208 #endif
209
210 #if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
211 #error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
212 #endif
213
214 #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
215 #error "MBEDTLS_HKDF_C defined, but not all prerequisites"
216 #endif
217
218 #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
219 #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
220 #endif
221
222 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
223 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
224 #error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
225 #endif
226
227 #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
228 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
229 #error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
230 #endif
231
232 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
233 #error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
234 #endif
235
236 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
237 !defined(MBEDTLS_ECDH_C)
238 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
239 #endif
240
241 #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
242 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
243 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
244 #error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
245 #endif
246
247 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
248 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
249 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
250 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
251 #endif
252
253 #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
254 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
255 !defined(MBEDTLS_X509_CRT_PARSE_C) )
256 #error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
257 #endif
258
259 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
260 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
261 !defined(MBEDTLS_PKCS1_V15) )
262 #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
263 #endif
264
265 #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
266 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
267 !defined(MBEDTLS_PKCS1_V15) )
268 #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
269 #endif
270
271 #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
272 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
273 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
274 #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
275 #endif
276
277 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
278 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
279 #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
280 #endif
281
282 #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
283 #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
284 #endif
285
286 #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
287 #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
288 #endif
289
290 #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
291 #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
292 #endif
293
294 #if defined(MBEDTLS_PK_C) && \
295 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
296 #error "MBEDTLS_PK_C defined, but not all prerequisites"
297 #endif
298
299 #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
300 #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
301 #endif
302
303 #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
304 #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
305 #endif
306
307 #if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
308 #error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
309 #endif
310
311 #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
312 #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
313 #endif
314
315 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
316 #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
317 #endif
318
319 #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
320 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
321 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
322 #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
323 #endif
324
325 #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
326 ( !defined(MBEDTLS_PLATFORM_C) ||\
327 !defined(MBEDTLS_HAVE_TIME) )
328 #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
329 #endif
330
331 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
332 ( !defined(MBEDTLS_PLATFORM_C) ||\
333 !defined(MBEDTLS_HAVE_TIME) )
334 #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
335 #endif
336
337 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
338 ( !defined(MBEDTLS_PLATFORM_C) ||\
339 !defined(MBEDTLS_HAVE_TIME) )
340 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
341 #endif
342
343 #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
344 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
345 defined(MBEDTLS_PLATFORM_TIME_ALT) )
346 #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
347 #endif
348
349 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
350 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
351 defined(MBEDTLS_PLATFORM_TIME_ALT) )
352 #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
353 #endif
354
355 #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
356 #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
357 #endif
358
359 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
360 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
361 #endif
362
363 #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
364 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
365 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
366 #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
367 #endif
368
369 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
370 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
371 #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
372 #endif
373
374 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
375 defined(MBEDTLS_PLATFORM_STD_FREE)
376 #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
377 #endif
378
379 #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
380 #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
381 #endif
382
383 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
384 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
385 #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
386 #endif
387
388 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
389 defined(MBEDTLS_PLATFORM_STD_CALLOC)
390 #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
391 #endif
392
393 #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
394 #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
395 #endif
396
397 #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
398 #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
399 #endif
400
401 #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
402 #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
403 #endif
404
405 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
406 #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
407 #endif
408
409 #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
410 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
411 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
412 #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
413 #endif
414
415 #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
416 #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
417 #endif
418
419 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
420 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
421 #endif
422
423 #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
424 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
425 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
426 #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
427 #endif
428
429 #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
430 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
431 #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
432 #endif
433
434 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
435 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
436 #endif
437
438 #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
439 #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
440 #endif
441
442 #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
443 #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
444 #endif
445
446 #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
447 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
448 #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
449 #endif
450
451 #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
452 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
453 !defined(MBEDTLS_HAVE_TIME) )
454 #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
455 #endif
456
457 #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
458 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
459 #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
460 #endif
461
462 #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
463 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
464 #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
465 #endif
466
467 #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
468 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
469 #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
470 #endif
471
472 #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
473 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
474 #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
475 #endif
476
477 #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
478 !defined(MBEDTLS_ENTROPY_NV_SEED)
479 #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
480 #endif
481
482 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
483 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
484 #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
485 #endif
486
487 #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
488 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
489 #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
490 #endif
491
492 #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
493 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
494 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
495 #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
496 #endif
497
498 #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
499 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
500 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
501 #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
502 #endif
503
504 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
505 !defined(MBEDTLS_OID_C) )
506 #error "MBEDTLS_RSA_C defined, but not all prerequisites"
507 #endif
508
509 #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
510 !defined(MBEDTLS_PKCS1_V15) )
511 #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
512 #endif
513
514 #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
515 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
516 #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
517 #endif
518
519 #if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
520 !defined(MBEDTLS_SHA1_C) )
521 #error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
522 #endif
523
524 #if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
525 !defined(MBEDTLS_SHA1_C) )
526 #error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
527 #endif
528
529 #if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
530 !defined(MBEDTLS_SHA1_C) )
531 #error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
532 #endif
533
534 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
535 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
536 #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
537 #endif
538
539 #if defined(MBEDTLS_SSL_PROTO_DTLS) && \
540 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
541 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
542 #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
543 #endif
544
545 #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
546 #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
547 #endif
548
549 #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
550 !defined(MBEDTLS_MD_C) )
551 #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
552 #endif
553
554 #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
555 #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
556 #endif
557
558 #if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
559 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
560 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
561 #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
562 #endif
563
564 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
565 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
566 #error "Illegal protocol selection"
567 #endif
568
569 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
570 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
571 #error "Illegal protocol selection"
572 #endif
573
574 #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
575 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
576 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
577 #error "Illegal protocol selection"
578 #endif
579
580 #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
581 #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
582 #endif
583
584 #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
585 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
586 #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
587 #endif
588
589 #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
590 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
591 #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
592 #endif
593
594 #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
595 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
596 #error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
597 #endif
598
599 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
600 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
601 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
602 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
603 #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
604 #endif
605
606 #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
607 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
608 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
609 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
610 #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
611 #endif
612
613 #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
614 #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
615 #endif
616
617 #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
618 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
619 #error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
620 #endif
621
622 #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
623 !defined(MBEDTLS_X509_CRT_PARSE_C)
624 #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
625 #endif
626
627 #if defined(MBEDTLS_THREADING_PTHREAD)
628 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
629 #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
630 #endif
631 #define MBEDTLS_THREADING_IMPL
632 #endif
633
634 #if defined(MBEDTLS_THREADING_ALT)
635 #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
636 #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
637 #endif
638 #define MBEDTLS_THREADING_IMPL
639 #endif
640
641 #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
642 #error "MBEDTLS_THREADING_C defined, single threading implementation required"
643 #endif
644 #undef MBEDTLS_THREADING_IMPL
645
646 #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
647 #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
648 #endif
649
650 #if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
651 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
652 !defined(MBEDTLS_PK_PARSE_C) )
653 #error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
654 #endif
655
656 #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
657 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
658 !defined(MBEDTLS_PK_WRITE_C) )
659 #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
660 #endif
661
662 #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
663 #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
664 #endif
665
666 #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
667 #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
668 #endif
669
670 #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
671 #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
672 #endif
673
674 #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
675 #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
676 #endif
677
678 #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
679 #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
680 #endif
681
682 #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
683 #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
684 #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
685
686 #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
687 defined(MBEDTLS_HAVE_ASM)
688 #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
689 #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
690
691 /*
692 * Avoid warning from -pedantic. This is a convenient place for this
693 * workaround since this is included by every single file before the
694 * #if defined(MBEDTLS_xxx_C) that results in emtpy translation units.
695 */
696 typedef int mbedtls_iso_c_forbids_empty_translation_units;
697
698 #endif /* MBEDTLS_CHECK_CONFIG_H */
mbedtls_iso_c_forbids_empty_translation_units
int mbedtls_iso_c_forbids_empty_translation_units
Definition: check_config.h:696