blob: 5372c694e18aef750b0282e8489624d9aff79934 [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é-Gonnard860b5162015-01-28 17:12:07 +00008 * This file is part of mbed TLS (https://polarssl.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
33#if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
34#error "POLARSSL_AESNI_C defined, but not all prerequisites"
35#endif
36
37#if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
38#error "POLARSSL_CERTS_C defined, but not all prerequisites"
39#endif
40
41#if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
42#error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
43#endif
44
45#if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
46#error "POLARSSL_DHM_C defined, but not all prerequisites"
47#endif
48
49#if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
50#error "POLARSSL_ECDH_C defined, but not all prerequisites"
51#endif
52
53#if defined(POLARSSL_ECDSA_C) && \
54 ( !defined(POLARSSL_ECP_C) || \
55 !defined(POLARSSL_ASN1_PARSE_C) || \
56 !defined(POLARSSL_ASN1_WRITE_C) )
57#error "POLARSSL_ECDSA_C defined, but not all prerequisites"
58#endif
59
60#if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_HMAC_DRBG_C)
61#error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
62#endif
63
64#if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
65 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
66 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
67 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
68 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
69 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
70 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
71 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
72 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) && \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020073 !defined(POLARSSL_ECP_DP_SECP192K1_ENABLED) && \
74 !defined(POLARSSL_ECP_DP_SECP224K1_ENABLED) && \
75 !defined(POLARSSL_ECP_DP_SECP256K1_ENABLED) ) )
76#error "POLARSSL_ECP_C defined, but not all prerequisites"
77#endif
78
79#if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
80 !defined(POLARSSL_SHA256_C))
81#error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
82#endif
83#if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
Paul Bakker770268f2014-05-05 11:40:14 +020084 defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 64)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020085#error "CTR_DRBG_ENTROPY_LEN value too high"
86#endif
87#if defined(POLARSSL_ENTROPY_C) && \
88 ( !defined(POLARSSL_SHA512_C) || defined(POLARSSL_ENTROPY_FORCE_SHA256) ) \
Paul Bakker770268f2014-05-05 11:40:14 +020089 && defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 32)
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_ENTROPY_FORCE_SHA256) && !defined(POLARSSL_SHA256_C)
94#error "POLARSSL_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
95#endif
96
97#if defined(POLARSSL_GCM_C) && ( \
98 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
99#error "POLARSSL_GCM_C defined, but not all prerequisites"
100#endif
101
102#if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
103#error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
104#endif
105
106#if defined(POLARSSL_HMAC_DRBG) && !defined(POLARSSL_MD_C)
107#error "POLARSSL_HMAC_DRBG_C defined, but not all prerequisites"
108#endif
109
110#if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
111 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
112#error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
113#endif
114
115#if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
116 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
117#error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
118#endif
119
120#if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
121#error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
122#endif
123
124#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
125 !defined(POLARSSL_ECDH_C)
126#error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
127#endif
128
129#if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
130 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
131 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
132#error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
133#endif
134
135#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
136 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
137 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
138#error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
139#endif
140
141#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
142 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
143 !defined(POLARSSL_X509_CRT_PARSE_C) )
144#error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
145#endif
146
147#if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000148 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200149 !defined(POLARSSL_PKCS1_V15) )
150#error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
151#endif
152
153#if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
Manuel Pégourié-Gonnard013bffe2015-02-13 14:09:44 +0000154 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) || \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200155 !defined(POLARSSL_PKCS1_V15) )
156#error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
157#endif
158
Manuel Pégourié-Gonnard0a155b82015-01-23 17:28:27 +0000159#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_C)
160#error "POLARSSL_MEMORY_C defined, but not all prerequisites"
161#endif
162
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200163#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
164 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
165#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
166#endif
167
168#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
169#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
170#endif
171
172#if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
173#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
174#endif
175
176#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
177#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
178#endif
179
180#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
181#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
182#endif
183
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000184#if defined(POLARSSL_PK_C) && \
185 ( !defined(POLARSSL_RSA_C) && !defined(POLARSSL_ECP_C) )
186#error "POLARSSL_PK_C defined, but not all prerequisites"
187#endif
188
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200189#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
190#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
191#endif
192
193#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
194#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
195#endif
196
197#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
198#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
199#endif
200
Rich Evansc0b6da32015-02-03 10:58:06 +0000201#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
202#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
203#endif
204
Rich Evans16f8cd82015-02-06 16:14:34 +0000205#if defined(POLARSSL_PLATFORM_EXIT_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000206#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
207#endif
208
209#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
210 ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
211 defined(POLARSSL_PLATFORM_EXIT_ALT) )
212#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
213#endif
214
Rich Evansc0b6da32015-02-03 10:58:06 +0000215#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
216#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
217#endif
218
Rich Evans16f8cd82015-02-06 16:14:34 +0000219#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000220#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
221#endif
222
223#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
224 ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
225 defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
226#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
227#endif
228
229#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000230 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000231#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
232#endif
233
234#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
235 defined(POLARSSL_PLATFORM_STD_FREE)
236#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
237#endif
238
Rich Evans16f8cd82015-02-06 16:14:34 +0000239#if defined(POLARSSL_PLATFORM_FREE_MACRO) && !defined(POLARSSL_PLATFORM_MALLOC_MACRO)
240#error "POLARSSL_PLATFORM_MALLOC_MACRO must be defined if POLARSSL_PLATFORM_FREE_MACRO is"
241#endif
242
Rich Evans4cc8a222015-02-03 11:26:31 +0000243#if defined(POLARSSL_PLATFORM_MALLOC_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_MALLOC_MACRO defined, but not all prerequisites"
246#endif
247
248#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
249 defined(POLARSSL_PLATFORM_STD_MALLOC)
250#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
251#endif
252
Rich Evans16f8cd82015-02-06 16:14:34 +0000253#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) && !defined(POLARSSL_PLATFORM_FREE_MACRO)
254#error "POLARSSL_PLATFORM_FREE_MACRO must be defined if POLARSSL_PLATFORM_MALLOC_MACRO is"
255#endif
256
Rich Evansc0b6da32015-02-03 10:58:06 +0000257#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
258#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
259#endif
260
261#if defined(POLARSSL_PLATFORM_PRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
262#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
263#endif
264
Rich Evans16f8cd82015-02-06 16:14:34 +0000265#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000266#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
267#endif
268
269#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
270 ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
271 defined(POLARSSL_PLATFORM_PRINTF_ALT) )
272#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
273#endif
274
Rich Evansc0b6da32015-02-03 10:58:06 +0000275#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
276#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
277#endif
278
Rich Evans46b0a8d2015-01-30 10:47:32 +0000279#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\
280 && !defined(EFIX64) && !defined(EFI32) )
281#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
282#endif
283
Rich Evans16f8cd82015-02-06 16:14:34 +0000284#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000285#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
286#endif
287
288#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
289 ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
290 defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
291#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
292#endif
293
Rich Evansc0b6da32015-02-03 10:58:06 +0000294#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
295 !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
296#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
297#endif
298
299#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
300#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
301#endif
302
303#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
304#error "POLARSSL_PLATFORM_STD_MALLOC defined, but not all prerequisites"
305#endif
306
307#if defined(POLARSSL_PLATFORM_STD_FREE) && !defined(POLARSSL_PLATFORM_MEMORY)
308#error "POLARSSL_PLATFORM_STD_FREE defined, but not all prerequisites"
309#endif
310
311#if defined(POLARSSL_PLATFORM_STD_EXIT) &&\
312 !defined(POLARSSL_PLATFORM_EXIT_ALT)
313#error "POLARSSL_PLATFORM_STD_EXIT defined, but not all prerequisites"
314#endif
315
316#if defined(POLARSSL_PLATFORM_STD_FPRINTF) &&\
317 !defined(POLARSSL_PLATFORM_FPRINTF_ALT)
318#error "POLARSSL_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
319#endif
320
321#if defined(POLARSSL_PLATFORM_STD_PRINTF) &&\
322 !defined(POLARSSL_PLATFORM_PRINTF_ALT)
323#error "POLARSSL_PLATFORM_STD_PRINTF defined, but not all prerequisites"
324#endif
325
326#if defined(POLARSSL_PLATFORM_STD_SNPRINTF) &&\
327 !defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
328#error "POLARSSL_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
329#endif
330
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200331#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
332 !defined(POLARSSL_OID_C) )
333#error "POLARSSL_RSA_C defined, but not all prerequisites"
334#endif
335
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200336#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100337 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200338#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100339#endif
340
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200341#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
342 !defined(POLARSSL_SHA1_C) )
343#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
344#endif
345
346#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
347 !defined(POLARSSL_SHA1_C) )
348#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
349#endif
350
351#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
352 !defined(POLARSSL_SHA1_C) )
353#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
354#endif
355
356#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
357 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
358#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
359#endif
360
361#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é-Gonnard699cafa2014-10-27 13:57:03 +0100396#if defined(POLARSSL_SSL_ENCRYPT_THEN_MAC) && \
397 !defined(POLARSSL_SSL_PROTO_TLS1) && \
398 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
399 !defined(POLARSSL_SSL_PROTO_TLS1_2)
400#error "POLARSSL_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
401#endif
402
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100403#if defined(POLARSSL_SSL_EXTENDED_MASTER_SECRET) && \
404 !defined(POLARSSL_SSL_PROTO_TLS1) && \
405 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
406 !defined(POLARSSL_SSL_PROTO_TLS1_2)
407#error "POLARSSL_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
408#endif
409
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200410#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
411 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
412 !defined(POLARSSL_CIPHER_MODE_CBC) )
413#error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
414#endif
415
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100416#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING) && \
417 !defined(POLARSSL_SSL_PROTO_SSL3) && !defined(POLARSSL_SSL_PROTO_TLS1)
418#error "POLARSSL_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
419#endif
420
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200421#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
422 !defined(POLARSSL_X509_CRT_PARSE_C)
423#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
424#endif
425
426#if defined(POLARSSL_THREADING_PTHREAD)
427#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
428#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
429#endif
430#define POLARSSL_THREADING_IMPL
431#endif
432
433#if defined(POLARSSL_THREADING_ALT)
434#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
435#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
436#endif
437#define POLARSSL_THREADING_IMPL
438#endif
439
440#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
441#error "POLARSSL_THREADING_C defined, single threading implementation required"
442#endif
443#undef POLARSSL_THREADING_IMPL
444
445#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
446#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
447#endif
448
449#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
450 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
451 !defined(POLARSSL_PK_PARSE_C) )
452#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
453#endif
454
455#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
456 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
457 !defined(POLARSSL_PK_WRITE_C) )
458#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
459#endif
460
461#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
462#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
463#endif
464
465#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
466#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
467#endif
468
469#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
470#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
471#endif
472
473#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
474#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
475#endif
476
477#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
478#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
479#endif
480
481#endif /* POLARSSL_CHECK_CONFIG_H */