blob: 2194d475d67fe817e7a0d904415ea4bdc7c4deeb [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 *
10 * 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é-Gonnard14d55952014-04-30 12:35:08 +020038#if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
39#error "POLARSSL_AESNI_C defined, but not all prerequisites"
40#endif
41
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020042#if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
43#error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
44#endif
45
46#if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
47#error "POLARSSL_DHM_C defined, but not all prerequisites"
48#endif
49
50#if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
51#error "POLARSSL_ECDH_C defined, but not all prerequisites"
52#endif
53
54#if defined(POLARSSL_ECDSA_C) && \
55 ( !defined(POLARSSL_ECP_C) || \
56 !defined(POLARSSL_ASN1_PARSE_C) || \
57 !defined(POLARSSL_ASN1_WRITE_C) )
58#error "POLARSSL_ECDSA_C defined, but not all prerequisites"
59#endif
60
61#if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_HMAC_DRBG_C)
62#error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
63#endif
64
65#if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
66 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
67 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
68 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
69 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
70 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
71 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
72 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
73 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) && \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020074 !defined(POLARSSL_ECP_DP_SECP192K1_ENABLED) && \
75 !defined(POLARSSL_ECP_DP_SECP224K1_ENABLED) && \
76 !defined(POLARSSL_ECP_DP_SECP256K1_ENABLED) ) )
77#error "POLARSSL_ECP_C defined, but not all prerequisites"
78#endif
79
80#if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
81 !defined(POLARSSL_SHA256_C))
82#error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
83#endif
84#if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
Paul Bakker770268f2014-05-05 11:40:14 +020085 defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 64)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020086#error "CTR_DRBG_ENTROPY_LEN value too high"
87#endif
88#if defined(POLARSSL_ENTROPY_C) && \
89 ( !defined(POLARSSL_SHA512_C) || defined(POLARSSL_ENTROPY_FORCE_SHA256) ) \
Paul Bakker770268f2014-05-05 11:40:14 +020090 && defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 32)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020091#error "CTR_DRBG_ENTROPY_LEN value too high"
92#endif
93#if defined(POLARSSL_ENTROPY_C) && \
94 defined(POLARSSL_ENTROPY_FORCE_SHA256) && !defined(POLARSSL_SHA256_C)
95#error "POLARSSL_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
96#endif
97
98#if defined(POLARSSL_GCM_C) && ( \
99 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
100#error "POLARSSL_GCM_C defined, but not all prerequisites"
101#endif
102
103#if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
104#error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
105#endif
106
Manuel Pégourié-Gonnard9b669902015-03-06 16:52:46 +0000107#if defined(POLARSSL_HMAC_DRBG_C) && !defined(POLARSSL_MD_C)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200108#error "POLARSSL_HMAC_DRBG_C defined, but not all prerequisites"
109#endif
110
111#if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
112 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
113#error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
114#endif
115
116#if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
117 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
118#error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
119#endif
120
121#if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
122#error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
123#endif
124
125#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
126 !defined(POLARSSL_ECDH_C)
127#error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
128#endif
129
130#if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
131 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
132 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
133#error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
134#endif
135
136#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
137 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
138 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
139#error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
140#endif
141
142#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
143 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
144 !defined(POLARSSL_X509_CRT_PARSE_C) )
145#error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
146#endif
147
148#if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000149 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200150 !defined(POLARSSL_PKCS1_V15) )
151#error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
152#endif
153
154#if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000155 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200156 !defined(POLARSSL_PKCS1_V15) )
157#error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
158#endif
159
160#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
161 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
162#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
163#endif
164
165#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
166#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
167#endif
168
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200169#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
170#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
171#endif
172
173#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
174#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
175#endif
176
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000177#if defined(POLARSSL_PK_C) && \
178 ( !defined(POLARSSL_RSA_C) && !defined(POLARSSL_ECP_C) )
179#error "POLARSSL_PK_C defined, but not all prerequisites"
180#endif
181
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200182#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
183#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
184#endif
185
186#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
187#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
188#endif
189
190#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
191#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
192#endif
193
Rich Evansc0b6da32015-02-03 10:58:06 +0000194#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
195#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
196#endif
197
Rich Evans16f8cd82015-02-06 16:14:34 +0000198#if defined(POLARSSL_PLATFORM_EXIT_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000199#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
200#endif
201
202#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
203 ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
204 defined(POLARSSL_PLATFORM_EXIT_ALT) )
205#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
206#endif
207
Rich Evansc0b6da32015-02-03 10:58:06 +0000208#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
209#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
210#endif
211
Rich Evans16f8cd82015-02-06 16:14:34 +0000212#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000213#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
214#endif
215
216#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
217 ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
218 defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
219#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
220#endif
221
222#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000223 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000224#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
225#endif
226
227#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
228 defined(POLARSSL_PLATFORM_STD_FREE)
229#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
230#endif
231
Rich Evans16f8cd82015-02-06 16:14:34 +0000232#if defined(POLARSSL_PLATFORM_FREE_MACRO) && !defined(POLARSSL_PLATFORM_MALLOC_MACRO)
233#error "POLARSSL_PLATFORM_MALLOC_MACRO must be defined if POLARSSL_PLATFORM_FREE_MACRO is"
234#endif
235
Rich Evans4cc8a222015-02-03 11:26:31 +0000236#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000237 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000238#error "POLARSSL_PLATFORM_MALLOC_MACRO defined, but not all prerequisites"
239#endif
240
241#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
242 defined(POLARSSL_PLATFORM_STD_MALLOC)
243#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
244#endif
245
Rich Evans16f8cd82015-02-06 16:14:34 +0000246#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) && !defined(POLARSSL_PLATFORM_FREE_MACRO)
247#error "POLARSSL_PLATFORM_FREE_MACRO must be defined if POLARSSL_PLATFORM_MALLOC_MACRO is"
248#endif
249
Rich Evansc0b6da32015-02-03 10:58:06 +0000250#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
251#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
252#endif
253
254#if defined(POLARSSL_PLATFORM_PRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
255#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
256#endif
257
Rich Evans16f8cd82015-02-06 16:14:34 +0000258#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000259#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
260#endif
261
262#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
263 ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
264 defined(POLARSSL_PLATFORM_PRINTF_ALT) )
265#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
266#endif
267
Rich Evansc0b6da32015-02-03 10:58:06 +0000268#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
269#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
270#endif
271
Rich Evans46b0a8d2015-01-30 10:47:32 +0000272#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\
273 && !defined(EFIX64) && !defined(EFI32) )
274#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
275#endif
276
Rich Evans16f8cd82015-02-06 16:14:34 +0000277#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000278#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
279#endif
280
281#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
282 ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
283 defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
284#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
285#endif
286
Rich Evansc0b6da32015-02-03 10:58:06 +0000287#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
288 !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
289#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
290#endif
291
292#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
293#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
294#endif
295
296#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
297#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
298#endif
299
300#if defined(POLARSSL_PLATFORM_STD_FREE) && !defined(POLARSSL_PLATFORM_MEMORY)
301#error "POLARSSL_PLATFORM_STD_FREE defined, but not all prerequisites"
302#endif
303
304#if defined(POLARSSL_PLATFORM_STD_EXIT) &&\
305 !defined(POLARSSL_PLATFORM_EXIT_ALT)
306#error "POLARSSL_PLATFORM_STD_EXIT defined, but not all prerequisites"
307#endif
308
309#if defined(POLARSSL_PLATFORM_STD_FPRINTF) &&\
310 !defined(POLARSSL_PLATFORM_FPRINTF_ALT)
311#error "POLARSSL_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
312#endif
313
314#if defined(POLARSSL_PLATFORM_STD_PRINTF) &&\
315 !defined(POLARSSL_PLATFORM_PRINTF_ALT)
316#error "POLARSSL_PLATFORM_STD_PRINTF defined, but not all prerequisites"
317#endif
318
319#if defined(POLARSSL_PLATFORM_STD_SNPRINTF) &&\
320 !defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
321#error "POLARSSL_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
322#endif
323
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200324#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
325 !defined(POLARSSL_OID_C) )
326#error "POLARSSL_RSA_C defined, but not all prerequisites"
327#endif
328
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200329#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100330 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200331#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100332#endif
333
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200334#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
335 !defined(POLARSSL_SHA1_C) )
336#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
337#endif
338
339#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
340 !defined(POLARSSL_SHA1_C) )
341#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
342#endif
343
344#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
345 !defined(POLARSSL_SHA1_C) )
346#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
347#endif
348
349#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
350 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
351#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
352#endif
353
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100354#if defined(POLARSSL_SSL_PROTO_DTLS) && ( \
Manuel Pégourié-Gonnard8e704f02014-10-14 20:03:35 +0200355 ( !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
356 !defined(POLARSSL_SSL_PROTO_TLS1_2) ) || \
357 !defined(POLARSSL_TIMING_C) )
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100358#error "POLARSSL_SSL_PROTO_DTLS defined, but not all prerequisites"
359#endif
360
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200361#if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
362#error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
363#endif
364
365#if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
366 !defined(POLARSSL_MD_C) )
367#error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
368#endif
369
370#if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
371#error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
372#endif
373
374#if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
375 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
376 !defined(POLARSSL_SSL_PROTO_TLS1_2))
377#error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
378#endif
379
380#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
381 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
382#error "Illegal protocol selection"
383#endif
384
385#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
386 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
387#error "Illegal protocol selection"
388#endif
389
390#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
391 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
392 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
393#error "Illegal protocol selection"
394#endif
395
Manuel Pégourié-Gonnarda64acd42014-07-23 18:30:45 +0200396#if defined(POLARSSL_SSL_COOKIE_C) && !defined(POLARSSL_SSL_DTLS_HELLO_VERIFY)
397#error "POLARSSL_SSL_COOKIE_C defined, but not all prerequisites"
398#endif
399
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200400#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) && \
401 ( !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
402#error "POLARSSL_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
403#endif
404
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200405#if defined(POLARSSL_SSL_DTLS_ANTI_REPLAY) && \
406 ( !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
407#error "POLARSSL_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
408#endif
409
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200410#if defined(POLARSSL_SSL_DTLS_BADMAC_LIMIT) && \
411 ( !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
412#error "POLARSSL_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
413#endif
414
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100415#if defined(POLARSSL_SSL_ENCRYPT_THEN_MAC) && \
416 !defined(POLARSSL_SSL_PROTO_TLS1) && \
417 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
418 !defined(POLARSSL_SSL_PROTO_TLS1_2)
419#error "POLARSSL_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
420#endif
421
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100422#if defined(POLARSSL_SSL_EXTENDED_MASTER_SECRET) && \
423 !defined(POLARSSL_SSL_PROTO_TLS1) && \
424 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
425 !defined(POLARSSL_SSL_PROTO_TLS1_2)
426#error "POLARSSL_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
427#endif
428
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200429#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
430 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
431 !defined(POLARSSL_CIPHER_MODE_CBC) )
Manuel Pégourié-Gonnard9b669902015-03-06 16:52:46 +0000432#error "POLARSSL_SSL_SESSION_TICKETS defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200433#endif
434
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100435#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING) && \
436 !defined(POLARSSL_SSL_PROTO_SSL3) && !defined(POLARSSL_SSL_PROTO_TLS1)
437#error "POLARSSL_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
438#endif
439
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200440#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
441 !defined(POLARSSL_X509_CRT_PARSE_C)
442#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
443#endif
444
445#if defined(POLARSSL_THREADING_PTHREAD)
446#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
447#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
448#endif
449#define POLARSSL_THREADING_IMPL
450#endif
451
452#if defined(POLARSSL_THREADING_ALT)
453#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
454#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
455#endif
456#define POLARSSL_THREADING_IMPL
457#endif
458
459#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
460#error "POLARSSL_THREADING_C defined, single threading implementation required"
461#endif
462#undef POLARSSL_THREADING_IMPL
463
464#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
465#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
466#endif
467
468#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
469 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
470 !defined(POLARSSL_PK_PARSE_C) )
471#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
472#endif
473
474#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
475 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
476 !defined(POLARSSL_PK_WRITE_C) )
477#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
478#endif
479
480#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
481#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
482#endif
483
484#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
485#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
486#endif
487
488#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
489#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
490#endif
491
492#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
493#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
494#endif
495
496#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
497#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
498#endif
499
500#endif /* POLARSSL_CHECK_CONFIG_H */