blob: f0d83c8d9e976b3f09f66ee66e582f5d60446b55 [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é-Gonnard14d55952014-04-30 12:35:08 +020047#if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
48#error "POLARSSL_AESNI_C defined, but not all prerequisites"
49#endif
50
51#if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
52#error "POLARSSL_CERTS_C defined, but not all prerequisites"
53#endif
54
55#if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
56#error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
57#endif
58
59#if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
60#error "POLARSSL_DHM_C defined, but not all prerequisites"
61#endif
62
63#if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
64#error "POLARSSL_ECDH_C defined, but not all prerequisites"
65#endif
66
67#if defined(POLARSSL_ECDSA_C) && \
68 ( !defined(POLARSSL_ECP_C) || \
69 !defined(POLARSSL_ASN1_PARSE_C) || \
70 !defined(POLARSSL_ASN1_WRITE_C) )
71#error "POLARSSL_ECDSA_C defined, but not all prerequisites"
72#endif
73
74#if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_HMAC_DRBG_C)
75#error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
76#endif
77
78#if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
79 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
80 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
81 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
82 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
83 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
84 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
85 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
86 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) && \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020087 !defined(POLARSSL_ECP_DP_SECP192K1_ENABLED) && \
88 !defined(POLARSSL_ECP_DP_SECP224K1_ENABLED) && \
89 !defined(POLARSSL_ECP_DP_SECP256K1_ENABLED) ) )
90#error "POLARSSL_ECP_C defined, but not all prerequisites"
91#endif
92
93#if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
94 !defined(POLARSSL_SHA256_C))
95#error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
96#endif
97#if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
Paul Bakker770268f2014-05-05 11:40:14 +020098 defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 64)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020099#error "CTR_DRBG_ENTROPY_LEN value too high"
100#endif
101#if defined(POLARSSL_ENTROPY_C) && \
102 ( !defined(POLARSSL_SHA512_C) || defined(POLARSSL_ENTROPY_FORCE_SHA256) ) \
Paul Bakker770268f2014-05-05 11:40:14 +0200103 && defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 32)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200104#error "CTR_DRBG_ENTROPY_LEN value too high"
105#endif
106#if defined(POLARSSL_ENTROPY_C) && \
107 defined(POLARSSL_ENTROPY_FORCE_SHA256) && !defined(POLARSSL_SHA256_C)
108#error "POLARSSL_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
109#endif
110
111#if defined(POLARSSL_GCM_C) && ( \
112 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
113#error "POLARSSL_GCM_C defined, but not all prerequisites"
114#endif
115
116#if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
117#error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
118#endif
119
120#if defined(POLARSSL_HMAC_DRBG) && !defined(POLARSSL_MD_C)
121#error "POLARSSL_HMAC_DRBG_C defined, but not all prerequisites"
122#endif
123
124#if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
125 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
126#error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
127#endif
128
129#if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
130 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
131#error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
132#endif
133
134#if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
135#error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
136#endif
137
138#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
139 !defined(POLARSSL_ECDH_C)
140#error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
141#endif
142
143#if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
144 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
145 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
146#error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
147#endif
148
149#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
150 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
151 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
152#error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
153#endif
154
155#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
156 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
157 !defined(POLARSSL_X509_CRT_PARSE_C) )
158#error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
159#endif
160
161#if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000162 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200163 !defined(POLARSSL_PKCS1_V15) )
164#error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
165#endif
166
167#if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000168 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200169 !defined(POLARSSL_PKCS1_V15) )
170#error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
171#endif
172
Manuel Pégourié-Gonnard0a155b82015-01-23 17:28:27 +0000173#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_C)
174#error "POLARSSL_MEMORY_C defined, but not all prerequisites"
175#endif
176
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200177#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
178 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
179#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
180#endif
181
182#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
183#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
184#endif
185
186#if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
187#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
188#endif
189
190#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
191#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
192#endif
193
194#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
195#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
196#endif
197
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000198#if defined(POLARSSL_PK_C) && \
199 ( !defined(POLARSSL_RSA_C) && !defined(POLARSSL_ECP_C) )
200#error "POLARSSL_PK_C defined, but not all prerequisites"
201#endif
202
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200203#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
204#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
205#endif
206
207#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
208#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
209#endif
210
211#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
212#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
213#endif
214
Rich Evansc0b6da32015-02-03 10:58:06 +0000215#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
216#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
217#endif
218
Rich Evans16f8cd82015-02-06 16:14:34 +0000219#if defined(POLARSSL_PLATFORM_EXIT_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000220#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
221#endif
222
223#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
224 ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
225 defined(POLARSSL_PLATFORM_EXIT_ALT) )
226#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
227#endif
228
Rich Evansc0b6da32015-02-03 10:58:06 +0000229#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
230#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
231#endif
232
Rich Evans16f8cd82015-02-06 16:14:34 +0000233#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000234#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
235#endif
236
237#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
238 ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
239 defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
240#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
241#endif
242
243#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000244 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000245#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
246#endif
247
248#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
249 defined(POLARSSL_PLATFORM_STD_FREE)
250#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
251#endif
252
Rich Evans16f8cd82015-02-06 16:14:34 +0000253#if defined(POLARSSL_PLATFORM_FREE_MACRO) && !defined(POLARSSL_PLATFORM_MALLOC_MACRO)
254#error "POLARSSL_PLATFORM_MALLOC_MACRO must be defined if POLARSSL_PLATFORM_FREE_MACRO is"
255#endif
256
Rich Evans4cc8a222015-02-03 11:26:31 +0000257#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000258 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000259#error "POLARSSL_PLATFORM_MALLOC_MACRO defined, but not all prerequisites"
260#endif
261
262#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
263 defined(POLARSSL_PLATFORM_STD_MALLOC)
264#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
265#endif
266
Rich Evans16f8cd82015-02-06 16:14:34 +0000267#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) && !defined(POLARSSL_PLATFORM_FREE_MACRO)
268#error "POLARSSL_PLATFORM_FREE_MACRO must be defined if POLARSSL_PLATFORM_MALLOC_MACRO is"
269#endif
270
Rich Evansc0b6da32015-02-03 10:58:06 +0000271#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
272#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
273#endif
274
275#if defined(POLARSSL_PLATFORM_PRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
276#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
277#endif
278
Rich Evans16f8cd82015-02-06 16:14:34 +0000279#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000280#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
281#endif
282
283#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
284 ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
285 defined(POLARSSL_PLATFORM_PRINTF_ALT) )
286#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
287#endif
288
Rich Evansc0b6da32015-02-03 10:58:06 +0000289#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
290#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
291#endif
292
Rich Evans46b0a8d2015-01-30 10:47:32 +0000293#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\
294 && !defined(EFIX64) && !defined(EFI32) )
295#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
296#endif
297
Rich Evans16f8cd82015-02-06 16:14:34 +0000298#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000299#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
300#endif
301
302#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
303 ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
304 defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
305#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
306#endif
307
Rich Evansc0b6da32015-02-03 10:58:06 +0000308#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
309 !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
310#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
311#endif
312
313#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
314#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
315#endif
316
317#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
318#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
319#endif
320
321#if defined(POLARSSL_PLATFORM_STD_FREE) && !defined(POLARSSL_PLATFORM_MEMORY)
322#error "POLARSSL_PLATFORM_STD_FREE defined, but not all prerequisites"
323#endif
324
325#if defined(POLARSSL_PLATFORM_STD_EXIT) &&\
326 !defined(POLARSSL_PLATFORM_EXIT_ALT)
327#error "POLARSSL_PLATFORM_STD_EXIT defined, but not all prerequisites"
328#endif
329
330#if defined(POLARSSL_PLATFORM_STD_FPRINTF) &&\
331 !defined(POLARSSL_PLATFORM_FPRINTF_ALT)
332#error "POLARSSL_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
333#endif
334
335#if defined(POLARSSL_PLATFORM_STD_PRINTF) &&\
336 !defined(POLARSSL_PLATFORM_PRINTF_ALT)
337#error "POLARSSL_PLATFORM_STD_PRINTF defined, but not all prerequisites"
338#endif
339
340#if defined(POLARSSL_PLATFORM_STD_SNPRINTF) &&\
341 !defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
342#error "POLARSSL_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
343#endif
344
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200345#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
346 !defined(POLARSSL_OID_C) )
347#error "POLARSSL_RSA_C defined, but not all prerequisites"
348#endif
349
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200350#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100351 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200352#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100353#endif
354
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200355#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
356 !defined(POLARSSL_SHA1_C) )
357#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
358#endif
359
360#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
361 !defined(POLARSSL_SHA1_C) )
362#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
363#endif
364
365#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
366 !defined(POLARSSL_SHA1_C) )
367#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
368#endif
369
370#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
371 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
372#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
373#endif
374
375#if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
376#error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
377#endif
378
379#if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
380 !defined(POLARSSL_MD_C) )
381#error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
382#endif
383
384#if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
385#error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
386#endif
387
388#if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
389 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
390 !defined(POLARSSL_SSL_PROTO_TLS1_2))
391#error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
392#endif
393
394#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
395 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
396#error "Illegal protocol selection"
397#endif
398
399#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
400 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
401#error "Illegal protocol selection"
402#endif
403
404#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
405 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
406 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
407#error "Illegal protocol selection"
408#endif
409
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100410#if defined(POLARSSL_SSL_ENCRYPT_THEN_MAC) && \
411 !defined(POLARSSL_SSL_PROTO_TLS1) && \
412 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
413 !defined(POLARSSL_SSL_PROTO_TLS1_2)
414#error "POLARSSL_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
415#endif
416
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100417#if defined(POLARSSL_SSL_EXTENDED_MASTER_SECRET) && \
418 !defined(POLARSSL_SSL_PROTO_TLS1) && \
419 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
420 !defined(POLARSSL_SSL_PROTO_TLS1_2)
421#error "POLARSSL_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
422#endif
423
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200424#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
425 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
426 !defined(POLARSSL_CIPHER_MODE_CBC) )
427#error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
428#endif
429
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100430#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING) && \
431 !defined(POLARSSL_SSL_PROTO_SSL3) && !defined(POLARSSL_SSL_PROTO_TLS1)
432#error "POLARSSL_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
433#endif
434
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200435#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
436 !defined(POLARSSL_X509_CRT_PARSE_C)
437#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
438#endif
439
440#if defined(POLARSSL_THREADING_PTHREAD)
441#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
442#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
443#endif
444#define POLARSSL_THREADING_IMPL
445#endif
446
447#if defined(POLARSSL_THREADING_ALT)
448#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
449#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
450#endif
451#define POLARSSL_THREADING_IMPL
452#endif
453
454#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
455#error "POLARSSL_THREADING_C defined, single threading implementation required"
456#endif
457#undef POLARSSL_THREADING_IMPL
458
459#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
460#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
461#endif
462
463#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
464 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
465 !defined(POLARSSL_PK_PARSE_C) )
466#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
467#endif
468
469#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
470 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
471 !defined(POLARSSL_PK_WRITE_C) )
472#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
473#endif
474
475#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
476#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
477#endif
478
479#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
480#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
481#endif
482
483#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
484#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
485#endif
486
487#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
488#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
489#endif
490
491#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
492#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
493#endif
494
495#endif /* POLARSSL_CHECK_CONFIG_H */