blob: bd126a68b64b007ed988f7d8c5e63b4c2864d988 [file] [log] [blame]
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +02001/**
2 * \file check_config.h
3 *
4 * \brief Consistency checks for configuration options
5 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00006 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +02007 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +00008 * This file is part of mbed TLS (https://tls.mbed.org)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +02009 *
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020010 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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 POLARSSL_CHECK_CONFIG_H
31#define POLARSSL_CHECK_CONFIG_H
32
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010033#if defined(POLARSSL_DEPRECATED_WARNING) && \
Manuel Pégourié-Gonnard757ca002015-03-23 15:24:07 +010034 !defined(__GNUC__) && !defined(__clang__)
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010035#error "POLARSSL_DEPRECATED_WARNING only works with GCC and Clang"
36#endif
37
Manuel Pégourié-Gonnarda98af5e2015-04-09 14:40:46 +020038#if defined(POLARSSL_NET_C) && !defined(POLARSSL_HAVE_IPV6)
39#if defined(POLARSSL_DEPRECATED_WARNING)
40#warning "Using POLARSSL_NET_C without POLARSSL_HAVE_IPV6 is deprecated"
41#endif
42#if defined(POLARSSL_DEPRECATED_REMOVED)
43#define POLARSSL_HAVE_IPV6
44#endif
45#endif /* POLARSSL_NET_C && !POLARSSL_HAVE_IPV6 */
46
Manuel Pégourié-Gonnard501084c2015-07-15 11:17:45 +020047#if defined(POLARSSL_ERROR_STRERROR_BC)
48#if defined(POLARSSL_DEPRECATED_WARNING)
49#warning "POLARSSL_ERROR_STRERROR_BC is deprecated"
50#endif
51#if defined(POLARSSL_DEPRECATED_REMOVED)
52#error "POLARSSL_ERROR_STRERROR_BC is deprecated"
53#endif
54#endif /* POLARSSL_ERROR_STRERROR_BC */
55
56#if defined(POLARSSL_MEMORY_C)
57#if defined(POLARSSL_DEPRECATED_WARNING)
58#warning "POLARSSL_MEMORY_C is deprecated"
59#endif
60#if defined(POLARSSL_DEPRECATED_REMOVED)
61#error "POLARSSL_MEMORY_C is deprecated"
62#endif
63#endif /* POLARSSL_MEMORY_C */
64
65#if defined(POLARSSL_PBKDF2_C)
66#if defined(POLARSSL_DEPRECATED_WARNING)
67#warning "POLARSSL_PBKDF2_C is deprecated"
68#endif
69#if defined(POLARSSL_DEPRECATED_REMOVED)
70#error "POLARSSL_PBKDF2_C is deprecated"
71#endif
72#endif /* POLARSSL_PBKDF2_C */
73
74#if defined(POLARSSL_HAVE_INT8)
75#if defined(POLARSSL_DEPRECATED_WARNING)
76#warning "POLARSSL_HAVE_INT8 is deprecated"
77#endif
78#if defined(POLARSSL_DEPRECATED_REMOVED)
79#error "POLARSSL_HAVE_INT8 is deprecated"
80#endif
81#endif /* POLARSSL_HAVE_INT8 */
82
83#if defined(POLARSSL_HAVE_INT16)
84#if defined(POLARSSL_DEPRECATED_WARNING)
85#warning "POLARSSL_HAVE_INT16 is deprecated"
86#endif
87#if defined(POLARSSL_DEPRECATED_REMOVED)
88#error "POLARSSL_HAVE_INT16 is deprecated"
89#endif
90#endif /* POLARSSL_HAVE_INT16 */
91
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020092#if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
93#error "POLARSSL_AESNI_C defined, but not all prerequisites"
94#endif
95
96#if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
97#error "POLARSSL_CERTS_C defined, but not all prerequisites"
98#endif
99
100#if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
101#error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
102#endif
103
104#if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
105#error "POLARSSL_DHM_C defined, but not all prerequisites"
106#endif
107
108#if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
109#error "POLARSSL_ECDH_C defined, but not all prerequisites"
110#endif
111
112#if defined(POLARSSL_ECDSA_C) && \
113 ( !defined(POLARSSL_ECP_C) || \
114 !defined(POLARSSL_ASN1_PARSE_C) || \
115 !defined(POLARSSL_ASN1_WRITE_C) )
116#error "POLARSSL_ECDSA_C defined, but not all prerequisites"
117#endif
118
119#if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_HMAC_DRBG_C)
120#error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
121#endif
122
123#if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
124 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
125 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
126 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
127 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
128 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
129 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
130 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
131 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) && \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200132 !defined(POLARSSL_ECP_DP_SECP192K1_ENABLED) && \
133 !defined(POLARSSL_ECP_DP_SECP224K1_ENABLED) && \
134 !defined(POLARSSL_ECP_DP_SECP256K1_ENABLED) ) )
135#error "POLARSSL_ECP_C defined, but not all prerequisites"
136#endif
137
138#if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
139 !defined(POLARSSL_SHA256_C))
140#error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
141#endif
142#if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
Paul Bakker770268f2014-05-05 11:40:14 +0200143 defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 64)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200144#error "CTR_DRBG_ENTROPY_LEN value too high"
145#endif
146#if defined(POLARSSL_ENTROPY_C) && \
147 ( !defined(POLARSSL_SHA512_C) || defined(POLARSSL_ENTROPY_FORCE_SHA256) ) \
Paul Bakker770268f2014-05-05 11:40:14 +0200148 && defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 32)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200149#error "CTR_DRBG_ENTROPY_LEN value too high"
150#endif
151#if defined(POLARSSL_ENTROPY_C) && \
152 defined(POLARSSL_ENTROPY_FORCE_SHA256) && !defined(POLARSSL_SHA256_C)
153#error "POLARSSL_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
154#endif
155
156#if defined(POLARSSL_GCM_C) && ( \
157 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
158#error "POLARSSL_GCM_C defined, but not all prerequisites"
159#endif
160
161#if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
162#error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
163#endif
164
165#if defined(POLARSSL_HMAC_DRBG) && !defined(POLARSSL_MD_C)
166#error "POLARSSL_HMAC_DRBG_C defined, but not all prerequisites"
167#endif
168
169#if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
170 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
171#error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
172#endif
173
174#if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
175 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
176#error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
177#endif
178
179#if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
180#error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
181#endif
182
183#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
184 !defined(POLARSSL_ECDH_C)
185#error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
186#endif
187
188#if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
189 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
190 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
191#error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
192#endif
193
194#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
195 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
196 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
197#error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
198#endif
199
200#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
201 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
202 !defined(POLARSSL_X509_CRT_PARSE_C) )
203#error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
204#endif
205
206#if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000207 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200208 !defined(POLARSSL_PKCS1_V15) )
209#error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
210#endif
211
212#if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000213 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200214 !defined(POLARSSL_PKCS1_V15) )
215#error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
216#endif
217
Manuel Pégourié-Gonnard0a155b82015-01-23 17:28:27 +0000218#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_C)
219#error "POLARSSL_MEMORY_C defined, but not all prerequisites"
220#endif
221
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200222#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
223 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
224#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
225#endif
226
227#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
228#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
229#endif
230
231#if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
232#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
233#endif
234
235#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
236#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
237#endif
238
239#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
240#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
241#endif
242
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000243#if defined(POLARSSL_PK_C) && \
244 ( !defined(POLARSSL_RSA_C) && !defined(POLARSSL_ECP_C) )
245#error "POLARSSL_PK_C defined, but not all prerequisites"
246#endif
247
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200248#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
249#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
250#endif
251
252#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
253#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
254#endif
255
256#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
257#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
258#endif
259
Rich Evansc0b6da32015-02-03 10:58:06 +0000260#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
261#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
262#endif
263
Rich Evans16f8cd82015-02-06 16:14:34 +0000264#if defined(POLARSSL_PLATFORM_EXIT_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000265#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
266#endif
267
268#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
269 ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
270 defined(POLARSSL_PLATFORM_EXIT_ALT) )
271#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
272#endif
273
Rich Evansc0b6da32015-02-03 10:58:06 +0000274#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
275#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
276#endif
277
Rich Evans16f8cd82015-02-06 16:14:34 +0000278#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000279#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
280#endif
281
282#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
283 ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
284 defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
285#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
286#endif
287
288#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000289 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000290#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
291#endif
292
293#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
294 defined(POLARSSL_PLATFORM_STD_FREE)
295#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
296#endif
297
Rich Evans16f8cd82015-02-06 16:14:34 +0000298#if defined(POLARSSL_PLATFORM_FREE_MACRO) && !defined(POLARSSL_PLATFORM_MALLOC_MACRO)
299#error "POLARSSL_PLATFORM_MALLOC_MACRO must be defined if POLARSSL_PLATFORM_FREE_MACRO is"
300#endif
301
Rich Evans4cc8a222015-02-03 11:26:31 +0000302#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000303 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000304#error "POLARSSL_PLATFORM_MALLOC_MACRO defined, but not all prerequisites"
305#endif
306
307#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
308 defined(POLARSSL_PLATFORM_STD_MALLOC)
309#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
310#endif
311
Rich Evans16f8cd82015-02-06 16:14:34 +0000312#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) && !defined(POLARSSL_PLATFORM_FREE_MACRO)
313#error "POLARSSL_PLATFORM_FREE_MACRO must be defined if POLARSSL_PLATFORM_MALLOC_MACRO is"
314#endif
315
Rich Evansc0b6da32015-02-03 10:58:06 +0000316#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
317#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
318#endif
319
320#if defined(POLARSSL_PLATFORM_PRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
321#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
322#endif
323
Rich Evans16f8cd82015-02-06 16:14:34 +0000324#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000325#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
326#endif
327
328#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
329 ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
330 defined(POLARSSL_PLATFORM_PRINTF_ALT) )
331#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
332#endif
333
Rich Evansc0b6da32015-02-03 10:58:06 +0000334#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
335#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
336#endif
337
Rich Evans46b0a8d2015-01-30 10:47:32 +0000338#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\
339 && !defined(EFIX64) && !defined(EFI32) )
340#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
341#endif
342
Rich Evans16f8cd82015-02-06 16:14:34 +0000343#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000344#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
345#endif
346
347#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
348 ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
349 defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
350#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
351#endif
352
Rich Evansc0b6da32015-02-03 10:58:06 +0000353#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
354 !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
355#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
356#endif
357
358#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
359#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
360#endif
361
362#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
363#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
364#endif
365
366#if defined(POLARSSL_PLATFORM_STD_FREE) && !defined(POLARSSL_PLATFORM_MEMORY)
367#error "POLARSSL_PLATFORM_STD_FREE defined, but not all prerequisites"
368#endif
369
370#if defined(POLARSSL_PLATFORM_STD_EXIT) &&\
371 !defined(POLARSSL_PLATFORM_EXIT_ALT)
372#error "POLARSSL_PLATFORM_STD_EXIT defined, but not all prerequisites"
373#endif
374
375#if defined(POLARSSL_PLATFORM_STD_FPRINTF) &&\
376 !defined(POLARSSL_PLATFORM_FPRINTF_ALT)
377#error "POLARSSL_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
378#endif
379
380#if defined(POLARSSL_PLATFORM_STD_PRINTF) &&\
381 !defined(POLARSSL_PLATFORM_PRINTF_ALT)
382#error "POLARSSL_PLATFORM_STD_PRINTF defined, but not all prerequisites"
383#endif
384
385#if defined(POLARSSL_PLATFORM_STD_SNPRINTF) &&\
386 !defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
387#error "POLARSSL_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
388#endif
389
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200390#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
391 !defined(POLARSSL_OID_C) )
392#error "POLARSSL_RSA_C defined, but not all prerequisites"
393#endif
394
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200395#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100396 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200397#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100398#endif
399
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200400#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
401 !defined(POLARSSL_SHA1_C) )
402#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
403#endif
404
405#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
406 !defined(POLARSSL_SHA1_C) )
407#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
408#endif
409
410#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
411 !defined(POLARSSL_SHA1_C) )
412#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
413#endif
414
415#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
416 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
417#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
418#endif
419
420#if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
421#error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
422#endif
423
424#if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
425 !defined(POLARSSL_MD_C) )
426#error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
427#endif
428
429#if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
430#error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
431#endif
432
433#if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
434 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
435 !defined(POLARSSL_SSL_PROTO_TLS1_2))
436#error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
437#endif
438
439#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
440 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
441#error "Illegal protocol selection"
442#endif
443
444#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
445 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
446#error "Illegal protocol selection"
447#endif
448
449#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
450 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
451 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
452#error "Illegal protocol selection"
453#endif
454
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100455#if defined(POLARSSL_SSL_ENCRYPT_THEN_MAC) && \
456 !defined(POLARSSL_SSL_PROTO_TLS1) && \
457 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
458 !defined(POLARSSL_SSL_PROTO_TLS1_2)
459#error "POLARSSL_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
460#endif
461
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100462#if defined(POLARSSL_SSL_EXTENDED_MASTER_SECRET) && \
463 !defined(POLARSSL_SSL_PROTO_TLS1) && \
464 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
465 !defined(POLARSSL_SSL_PROTO_TLS1_2)
466#error "POLARSSL_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
467#endif
468
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200469#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
470 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
471 !defined(POLARSSL_CIPHER_MODE_CBC) )
472#error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
473#endif
474
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100475#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING) && \
476 !defined(POLARSSL_SSL_PROTO_SSL3) && !defined(POLARSSL_SSL_PROTO_TLS1)
477#error "POLARSSL_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
478#endif
479
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200480#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
481 !defined(POLARSSL_X509_CRT_PARSE_C)
482#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
483#endif
484
485#if defined(POLARSSL_THREADING_PTHREAD)
486#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
487#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
488#endif
489#define POLARSSL_THREADING_IMPL
490#endif
491
492#if defined(POLARSSL_THREADING_ALT)
493#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
494#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
495#endif
496#define POLARSSL_THREADING_IMPL
497#endif
498
499#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
500#error "POLARSSL_THREADING_C defined, single threading implementation required"
501#endif
502#undef POLARSSL_THREADING_IMPL
503
504#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
505#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
506#endif
507
508#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
509 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
510 !defined(POLARSSL_PK_PARSE_C) )
511#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
512#endif
513
514#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
515 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
516 !defined(POLARSSL_PK_WRITE_C) )
517#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
518#endif
519
520#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
521#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
522#endif
523
524#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
525#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
526#endif
527
528#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
529#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
530#endif
531
532#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
533#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
534#endif
535
536#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
537#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
538#endif
539
540#endif /* POLARSSL_CHECK_CONFIG_H */