blob: 22d7251cd54f3b6c205f230f07e044c11d6c1a69 [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
Manuel Pégourié-Gonnard0a155b82015-01-23 17:28:27 +0000160#if defined(POLARSSL_MEMORY_C) && !defined(POLARSSL_PLATFORM_C)
161#error "POLARSSL_MEMORY_C defined, but not all prerequisites"
162#endif
163
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200164#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
165 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
166#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
167#endif
168
169#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
170#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
171#endif
172
173#if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
174#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
175#endif
176
177#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
178#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
179#endif
180
181#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
182#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
183#endif
184
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000185#if defined(POLARSSL_PK_C) && \
186 ( !defined(POLARSSL_RSA_C) && !defined(POLARSSL_ECP_C) )
187#error "POLARSSL_PK_C defined, but not all prerequisites"
188#endif
189
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200190#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
191#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
192#endif
193
194#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
195#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
196#endif
197
198#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
199#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
200#endif
201
Rich Evansc0b6da32015-02-03 10:58:06 +0000202#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
203#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
204#endif
205
Rich Evans16f8cd82015-02-06 16:14:34 +0000206#if defined(POLARSSL_PLATFORM_EXIT_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000207#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
208#endif
209
210#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
211 ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
212 defined(POLARSSL_PLATFORM_EXIT_ALT) )
213#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
214#endif
215
Rich Evansc0b6da32015-02-03 10:58:06 +0000216#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
217#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
218#endif
219
Rich Evans16f8cd82015-02-06 16:14:34 +0000220#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000221#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
222#endif
223
224#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
225 ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
226 defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
227#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
228#endif
229
230#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000231 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000232#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
233#endif
234
235#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
236 defined(POLARSSL_PLATFORM_STD_FREE)
237#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
238#endif
239
Rich Evans16f8cd82015-02-06 16:14:34 +0000240#if defined(POLARSSL_PLATFORM_FREE_MACRO) && !defined(POLARSSL_PLATFORM_MALLOC_MACRO)
241#error "POLARSSL_PLATFORM_MALLOC_MACRO must be defined if POLARSSL_PLATFORM_FREE_MACRO is"
242#endif
243
Rich Evans4cc8a222015-02-03 11:26:31 +0000244#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
Rich Evans16f8cd82015-02-06 16:14:34 +0000245 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
Rich Evans4cc8a222015-02-03 11:26:31 +0000246#error "POLARSSL_PLATFORM_MALLOC_MACRO defined, but not all prerequisites"
247#endif
248
249#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
250 defined(POLARSSL_PLATFORM_STD_MALLOC)
251#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
252#endif
253
Rich Evans16f8cd82015-02-06 16:14:34 +0000254#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) && !defined(POLARSSL_PLATFORM_FREE_MACRO)
255#error "POLARSSL_PLATFORM_FREE_MACRO must be defined if POLARSSL_PLATFORM_MALLOC_MACRO is"
256#endif
257
Rich Evansc0b6da32015-02-03 10:58:06 +0000258#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
259#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
260#endif
261
262#if defined(POLARSSL_PLATFORM_PRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
263#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
264#endif
265
Rich Evans16f8cd82015-02-06 16:14:34 +0000266#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000267#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
268#endif
269
270#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
271 ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
272 defined(POLARSSL_PLATFORM_PRINTF_ALT) )
273#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
274#endif
275
Rich Evansc0b6da32015-02-03 10:58:06 +0000276#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
277#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
278#endif
279
Rich Evans46b0a8d2015-01-30 10:47:32 +0000280#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && ( defined(_WIN32)\
281 && !defined(EFIX64) && !defined(EFI32) )
282#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
283#endif
284
Rich Evans16f8cd82015-02-06 16:14:34 +0000285#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) && !defined(POLARSSL_PLATFORM_C)
Rich Evans4cc8a222015-02-03 11:26:31 +0000286#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
287#endif
288
289#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
290 ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
291 defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
292#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
293#endif
294
Rich Evansc0b6da32015-02-03 10:58:06 +0000295#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
296 !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
297#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
298#endif
299
300#if defined(POLARSSL_PLATFORM_STD_MALLOC) && !defined(POLARSSL_PLATFORM_MEMORY)
301#error "POLARSSL_PLATFORM_STD_MALLOC 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_FREE) && !defined(POLARSSL_PLATFORM_MEMORY)
309#error "POLARSSL_PLATFORM_STD_FREE defined, but not all prerequisites"
310#endif
311
312#if defined(POLARSSL_PLATFORM_STD_EXIT) &&\
313 !defined(POLARSSL_PLATFORM_EXIT_ALT)
314#error "POLARSSL_PLATFORM_STD_EXIT defined, but not all prerequisites"
315#endif
316
317#if defined(POLARSSL_PLATFORM_STD_FPRINTF) &&\
318 !defined(POLARSSL_PLATFORM_FPRINTF_ALT)
319#error "POLARSSL_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
320#endif
321
322#if defined(POLARSSL_PLATFORM_STD_PRINTF) &&\
323 !defined(POLARSSL_PLATFORM_PRINTF_ALT)
324#error "POLARSSL_PLATFORM_STD_PRINTF defined, but not all prerequisites"
325#endif
326
327#if defined(POLARSSL_PLATFORM_STD_SNPRINTF) &&\
328 !defined(POLARSSL_PLATFORM_SNPRINTF_ALT)
329#error "POLARSSL_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
330#endif
331
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200332#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
333 !defined(POLARSSL_OID_C) )
334#error "POLARSSL_RSA_C defined, but not all prerequisites"
335#endif
336
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200337#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100338 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200339#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100340#endif
341
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200342#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
343 !defined(POLARSSL_SHA1_C) )
344#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
345#endif
346
347#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
348 !defined(POLARSSL_SHA1_C) )
349#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
350#endif
351
352#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
353 !defined(POLARSSL_SHA1_C) )
354#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
355#endif
356
357#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
358 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
359#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
360#endif
361
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100362#if defined(POLARSSL_SSL_PROTO_DTLS) && ( \
Manuel Pégourié-Gonnard8e704f02014-10-14 20:03:35 +0200363 ( !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
364 !defined(POLARSSL_SSL_PROTO_TLS1_2) ) || \
365 !defined(POLARSSL_TIMING_C) )
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100366#error "POLARSSL_SSL_PROTO_DTLS defined, but not all prerequisites"
367#endif
368
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200369#if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
370#error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
371#endif
372
373#if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
374 !defined(POLARSSL_MD_C) )
375#error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
376#endif
377
378#if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
379#error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
380#endif
381
382#if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
383 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
384 !defined(POLARSSL_SSL_PROTO_TLS1_2))
385#error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
386#endif
387
388#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
389 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
390#error "Illegal protocol selection"
391#endif
392
393#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
394 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
395#error "Illegal protocol selection"
396#endif
397
398#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
399 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
400 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
401#error "Illegal protocol selection"
402#endif
403
Manuel Pégourié-Gonnarda64acd42014-07-23 18:30:45 +0200404#if defined(POLARSSL_SSL_COOKIE_C) && !defined(POLARSSL_SSL_DTLS_HELLO_VERIFY)
405#error "POLARSSL_SSL_COOKIE_C defined, but not all prerequisites"
406#endif
407
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200408#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) && \
409 ( !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
410#error "POLARSSL_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
411#endif
412
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200413#if defined(POLARSSL_SSL_DTLS_ANTI_REPLAY) && \
414 ( !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
415#error "POLARSSL_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
416#endif
417
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200418#if defined(POLARSSL_SSL_DTLS_BADMAC_LIMIT) && \
419 ( !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
420#error "POLARSSL_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
421#endif
422
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100423#if defined(POLARSSL_SSL_ENCRYPT_THEN_MAC) && \
424 !defined(POLARSSL_SSL_PROTO_TLS1) && \
425 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
426 !defined(POLARSSL_SSL_PROTO_TLS1_2)
427#error "POLARSSL_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
428#endif
429
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100430#if defined(POLARSSL_SSL_EXTENDED_MASTER_SECRET) && \
431 !defined(POLARSSL_SSL_PROTO_TLS1) && \
432 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
433 !defined(POLARSSL_SSL_PROTO_TLS1_2)
434#error "POLARSSL_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
435#endif
436
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200437#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
438 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
439 !defined(POLARSSL_CIPHER_MODE_CBC) )
Manuel Pégourié-Gonnard9b669902015-03-06 16:52:46 +0000440#error "POLARSSL_SSL_SESSION_TICKETS defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200441#endif
442
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100443#if defined(POLARSSL_SSL_CBC_RECORD_SPLITTING) && \
444 !defined(POLARSSL_SSL_PROTO_SSL3) && !defined(POLARSSL_SSL_PROTO_TLS1)
445#error "POLARSSL_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
446#endif
447
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200448#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
449 !defined(POLARSSL_X509_CRT_PARSE_C)
450#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
451#endif
452
453#if defined(POLARSSL_THREADING_PTHREAD)
454#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
455#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
456#endif
457#define POLARSSL_THREADING_IMPL
458#endif
459
460#if defined(POLARSSL_THREADING_ALT)
461#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
462#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
463#endif
464#define POLARSSL_THREADING_IMPL
465#endif
466
467#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
468#error "POLARSSL_THREADING_C defined, single threading implementation required"
469#endif
470#undef POLARSSL_THREADING_IMPL
471
472#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
473#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
474#endif
475
476#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
477 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
478 !defined(POLARSSL_PK_PARSE_C) )
479#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
480#endif
481
482#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
483 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
484 !defined(POLARSSL_PK_WRITE_C) )
485#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
486#endif
487
488#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
489#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
490#endif
491
492#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
493#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
494#endif
495
496#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
497#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
498#endif
499
500#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
501#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
502#endif
503
504#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
505#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
506#endif
507
508#endif /* POLARSSL_CHECK_CONFIG_H */