blob: a668cf8b18575a9194eb7411eadbbee0f0edb8ed [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) && \
34 !defined(__GCC__) && !defined(__clang__)
35#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
42#if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
43#error "POLARSSL_CERTS_C defined, but not all prerequisites"
44#endif
45
46#if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
47#error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
48#endif
49
50#if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
51#error "POLARSSL_DHM_C defined, but not all prerequisites"
52#endif
53
54#if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
55#error "POLARSSL_ECDH_C defined, but not all prerequisites"
56#endif
57
58#if defined(POLARSSL_ECDSA_C) && \
59 ( !defined(POLARSSL_ECP_C) || \
60 !defined(POLARSSL_ASN1_PARSE_C) || \
61 !defined(POLARSSL_ASN1_WRITE_C) )
62#error "POLARSSL_ECDSA_C defined, but not all prerequisites"
63#endif
64
65#if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_HMAC_DRBG_C)
66#error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
67#endif
68
69#if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
70 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
71 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
72 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
73 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
74 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
75 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
76 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
77 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) && \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020078 !defined(POLARSSL_ECP_DP_SECP192K1_ENABLED) && \
79 !defined(POLARSSL_ECP_DP_SECP224K1_ENABLED) && \
80 !defined(POLARSSL_ECP_DP_SECP256K1_ENABLED) ) )
81#error "POLARSSL_ECP_C defined, but not all prerequisites"
82#endif
83
84#if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
85 !defined(POLARSSL_SHA256_C))
86#error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
87#endif
88#if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
Paul Bakker770268f2014-05-05 11:40:14 +020089 defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 64)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020090#error "CTR_DRBG_ENTROPY_LEN value too high"
91#endif
92#if defined(POLARSSL_ENTROPY_C) && \
93 ( !defined(POLARSSL_SHA512_C) || defined(POLARSSL_ENTROPY_FORCE_SHA256) ) \
Paul Bakker770268f2014-05-05 11:40:14 +020094 && defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 32)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020095#error "CTR_DRBG_ENTROPY_LEN value too high"
96#endif
97#if defined(POLARSSL_ENTROPY_C) && \
98 defined(POLARSSL_ENTROPY_FORCE_SHA256) && !defined(POLARSSL_SHA256_C)
99#error "POLARSSL_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
100#endif
101
102#if defined(POLARSSL_GCM_C) && ( \
103 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
104#error "POLARSSL_GCM_C defined, but not all prerequisites"
105#endif
106
107#if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
108#error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
109#endif
110
111#if defined(POLARSSL_HMAC_DRBG) && !defined(POLARSSL_MD_C)
112#error "POLARSSL_HMAC_DRBG_C defined, but not all prerequisites"
113#endif
114
115#if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
116 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
117#error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
118#endif
119
120#if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
121 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
122#error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
123#endif
124
125#if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
126#error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
127#endif
128
129#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
130 !defined(POLARSSL_ECDH_C)
131#error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
132#endif
133
134#if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
135 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
136 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
137#error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
138#endif
139
140#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
141 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
142 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
143#error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
144#endif
145
146#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
147 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
148 !defined(POLARSSL_X509_CRT_PARSE_C) )
149#error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
150#endif
151
152#if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000153 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200154 !defined(POLARSSL_PKCS1_V15) )
155#error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
156#endif
157
158#if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000159 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200160 !defined(POLARSSL_PKCS1_V15) )
161#error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
162#endif
163
Manuel Pégourié-Gonnard0a155b82015-01-23 17:28:27 +0000164#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_C)
165#error "POLARSSL_MEMORY_C defined, but not all prerequisites"
166#endif
167
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200168#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
169 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
170#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
171#endif
172
173#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
174#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
175#endif
176
177#if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
178#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
179#endif
180
181#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
182#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
183#endif
184
185#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
186#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
187#endif
188
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000189#if defined(POLARSSL_PK_C) && \
190 ( !defined(POLARSSL_RSA_C) && !defined(POLARSSL_ECP_C) )
191#error "POLARSSL_PK_C defined, but not all prerequisites"
192#endif
193
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200194#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
195#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
196#endif
197
198#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
199#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
200#endif
201
202#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
203#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
204#endif
205
Rich Evansc0b6da32015-02-03 10:58:06 +0000206#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
207#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
208#endif
209
Rich Evans16f8cd82015-02-06 16:14:34 +0000210#if defined(POLARSSL_PLATFORM_EXIT_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000211#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
212#endif
213
214#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
215 ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
216 defined(POLARSSL_PLATFORM_EXIT_ALT) )
217#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
218#endif
219
Rich Evansc0b6da32015-02-03 10:58:06 +0000220#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
221#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
222#endif
223
Rich Evans16f8cd82015-02-06 16:14:34 +0000224#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000225#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
226#endif
227
228#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
229 ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
230 defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
231#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
232#endif
233
234#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000235 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000236#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
237#endif
238
239#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
240 defined(POLARSSL_PLATFORM_STD_FREE)
241#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
242#endif
243
Rich Evans16f8cd82015-02-06 16:14:34 +0000244#if defined(POLARSSL_PLATFORM_FREE_MACRO) && !defined(POLARSSL_PLATFORM_MALLOC_MACRO)
245#error "POLARSSL_PLATFORM_MALLOC_MACRO must be defined if POLARSSL_PLATFORM_FREE_MACRO is"
246#endif
247
Rich Evans4cc8a222015-02-03 11:26:31 +0000248#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000249 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000250#error "POLARSSL_PLATFORM_MALLOC_MACRO defined, but not all prerequisites"
251#endif
252
253#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
254 defined(POLARSSL_PLATFORM_STD_MALLOC)
255#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
256#endif
257
Rich Evans16f8cd82015-02-06 16:14:34 +0000258#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) && !defined(POLARSSL_PLATFORM_FREE_MACRO)
259#error "POLARSSL_PLATFORM_FREE_MACRO must be defined if POLARSSL_PLATFORM_MALLOC_MACRO is"
260#endif
261
Rich Evansc0b6da32015-02-03 10:58:06 +0000262#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
263#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
264#endif
265
266#if defined(POLARSSL_PLATFORM_PRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
267#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
268#endif
269
Rich Evans16f8cd82015-02-06 16:14:34 +0000270#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000271#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
272#endif
273
274#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
275 ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
276 defined(POLARSSL_PLATFORM_PRINTF_ALT) )
277#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
278#endif
279
Rich Evansc0b6da32015-02-03 10:58:06 +0000280#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
281#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
282#endif
283
Rich Evans46b0a8d2015-01-30 10:47:32 +0000284#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\
285 && !defined(EFIX64) && !defined(EFI32) )
286#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
287#endif
288
Rich Evans16f8cd82015-02-06 16:14:34 +0000289#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000290#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
291#endif
292
293#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
294 ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
295 defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
296#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
297#endif
298
Rich Evansc0b6da32015-02-03 10:58:06 +0000299#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
300 !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
301#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
302#endif
303
304#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
305#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
306#endif
307
308#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
309#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
310#endif
311
312#if defined(POLARSSL_PLATFORM_STD_FREE) && !defined(POLARSSL_PLATFORM_MEMORY)
313#error "POLARSSL_PLATFORM_STD_FREE defined, but not all prerequisites"
314#endif
315
316#if defined(POLARSSL_PLATFORM_STD_EXIT) &&\
317 !defined(POLARSSL_PLATFORM_EXIT_ALT)
318#error "POLARSSL_PLATFORM_STD_EXIT defined, but not all prerequisites"
319#endif
320
321#if defined(POLARSSL_PLATFORM_STD_FPRINTF) &&\
322 !defined(POLARSSL_PLATFORM_FPRINTF_ALT)
323#error "POLARSSL_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
324#endif
325
326#if defined(POLARSSL_PLATFORM_STD_PRINTF) &&\
327 !defined(POLARSSL_PLATFORM_PRINTF_ALT)
328#error "POLARSSL_PLATFORM_STD_PRINTF defined, but not all prerequisites"
329#endif
330
331#if defined(POLARSSL_PLATFORM_STD_SNPRINTF) &&\
332 !defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
333#error "POLARSSL_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
334#endif
335
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200336#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
337 !defined(POLARSSL_OID_C) )
338#error "POLARSSL_RSA_C defined, but not all prerequisites"
339#endif
340
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200341#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100342 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200343#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100344#endif
345
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200346#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
347 !defined(POLARSSL_SHA1_C) )
348#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
349#endif
350
351#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
352 !defined(POLARSSL_SHA1_C) )
353#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
354#endif
355
356#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
357 !defined(POLARSSL_SHA1_C) )
358#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
359#endif
360
361#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
362 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
363#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
364#endif
365
366#if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
367#error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
368#endif
369
370#if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
371 !defined(POLARSSL_MD_C) )
372#error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
373#endif
374
375#if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
376#error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
377#endif
378
379#if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
380 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
381 !defined(POLARSSL_SSL_PROTO_TLS1_2))
382#error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
383#endif
384
385#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
386 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
387#error "Illegal protocol selection"
388#endif
389
390#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
391 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
392#error "Illegal protocol selection"
393#endif
394
395#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
396 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
397 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
398#error "Illegal protocol selection"
399#endif
400
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100401#if defined(POLARSSL_SSL_ENCRYPT_THEN_MAC) && \
402 !defined(POLARSSL_SSL_PROTO_TLS1) && \
403 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
404 !defined(POLARSSL_SSL_PROTO_TLS1_2)
405#error "POLARSSL_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
406#endif
407
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100408#if defined(POLARSSL_SSL_EXTENDED_MASTER_SECRET) && \
409 !defined(POLARSSL_SSL_PROTO_TLS1) && \
410 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
411 !defined(POLARSSL_SSL_PROTO_TLS1_2)
412#error "POLARSSL_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
413#endif
414
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200415#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
416 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
417 !defined(POLARSSL_CIPHER_MODE_CBC) )
418#error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
419#endif
420
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100421#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING) && \
422 !defined(POLARSSL_SSL_PROTO_SSL3) && !defined(POLARSSL_SSL_PROTO_TLS1)
423#error "POLARSSL_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
424#endif
425
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200426#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
427 !defined(POLARSSL_X509_CRT_PARSE_C)
428#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
429#endif
430
431#if defined(POLARSSL_THREADING_PTHREAD)
432#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
433#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
434#endif
435#define POLARSSL_THREADING_IMPL
436#endif
437
438#if defined(POLARSSL_THREADING_ALT)
439#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
440#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
441#endif
442#define POLARSSL_THREADING_IMPL
443#endif
444
445#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
446#error "POLARSSL_THREADING_C defined, single threading implementation required"
447#endif
448#undef POLARSSL_THREADING_IMPL
449
450#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
451#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
452#endif
453
454#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
455 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
456 !defined(POLARSSL_PK_PARSE_C) )
457#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
458#endif
459
460#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
461 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
462 !defined(POLARSSL_PK_WRITE_C) )
463#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
464#endif
465
466#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
467#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
468#endif
469
470#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
471#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
472#endif
473
474#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
475#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
476#endif
477
478#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
479#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
480#endif
481
482#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
483#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
484#endif
485
486#endif /* POLARSSL_CHECK_CONFIG_H */