blob: c532db0d658240763e9ad5cd72bf8fc03f383745 [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 *
6 * Copyright (C) 2006-2014, Brainspark B.V.
7 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 * All rights reserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27
28/*
29 * It is recommended to include this file from your config.h
30 * in order to catch dependency issues early.
31 */
32
33#ifndef POLARSSL_CHECK_CONFIG_H
34#define POLARSSL_CHECK_CONFIG_H
35
36#if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
37#error "POLARSSL_AESNI_C defined, but not all prerequisites"
38#endif
39
40#if defined(POLARSSL_CERTS_C) && !defined(POLARSSL_PEM_PARSE_C)
41#error "POLARSSL_CERTS_C defined, but not all prerequisites"
42#endif
43
44#if defined(POLARSSL_CTR_DRBG_C) && !defined(POLARSSL_AES_C)
45#error "POLARSSL_CTR_DRBG_C defined, but not all prerequisites"
46#endif
47
48#if defined(POLARSSL_DHM_C) && !defined(POLARSSL_BIGNUM_C)
49#error "POLARSSL_DHM_C defined, but not all prerequisites"
50#endif
51
52#if defined(POLARSSL_ECDH_C) && !defined(POLARSSL_ECP_C)
53#error "POLARSSL_ECDH_C defined, but not all prerequisites"
54#endif
55
56#if defined(POLARSSL_ECDSA_C) && \
57 ( !defined(POLARSSL_ECP_C) || \
58 !defined(POLARSSL_ASN1_PARSE_C) || \
59 !defined(POLARSSL_ASN1_WRITE_C) )
60#error "POLARSSL_ECDSA_C defined, but not all prerequisites"
61#endif
62
63#if defined(POLARSSL_ECDSA_DETERMINISTIC) && !defined(POLARSSL_HMAC_DRBG_C)
64#error "POLARSSL_ECDSA_DETERMINISTIC defined, but not all prerequisites"
65#endif
66
67#if defined(POLARSSL_ECP_C) && ( !defined(POLARSSL_BIGNUM_C) || ( \
68 !defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) && \
69 !defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) && \
70 !defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) && \
71 !defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) && \
72 !defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) && \
73 !defined(POLARSSL_ECP_DP_BP256R1_ENABLED) && \
74 !defined(POLARSSL_ECP_DP_BP384R1_ENABLED) && \
75 !defined(POLARSSL_ECP_DP_BP512R1_ENABLED) && \
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020076 !defined(POLARSSL_ECP_DP_SECP192K1_ENABLED) && \
77 !defined(POLARSSL_ECP_DP_SECP224K1_ENABLED) && \
78 !defined(POLARSSL_ECP_DP_SECP256K1_ENABLED) ) )
79#error "POLARSSL_ECP_C defined, but not all prerequisites"
80#endif
81
82#if defined(POLARSSL_ENTROPY_C) && (!defined(POLARSSL_SHA512_C) && \
83 !defined(POLARSSL_SHA256_C))
84#error "POLARSSL_ENTROPY_C defined, but not all prerequisites"
85#endif
86#if defined(POLARSSL_ENTROPY_C) && defined(POLARSSL_SHA512_C) && \
Paul Bakker770268f2014-05-05 11:40:14 +020087 defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 64)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020088#error "CTR_DRBG_ENTROPY_LEN value too high"
89#endif
90#if defined(POLARSSL_ENTROPY_C) && \
91 ( !defined(POLARSSL_SHA512_C) || defined(POLARSSL_ENTROPY_FORCE_SHA256) ) \
Paul Bakker770268f2014-05-05 11:40:14 +020092 && defined(CTR_DRBG_ENTROPY_LEN) && (CTR_DRBG_ENTROPY_LEN > 32)
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020093#error "CTR_DRBG_ENTROPY_LEN value too high"
94#endif
95#if defined(POLARSSL_ENTROPY_C) && \
96 defined(POLARSSL_ENTROPY_FORCE_SHA256) && !defined(POLARSSL_SHA256_C)
97#error "POLARSSL_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
98#endif
99
100#if defined(POLARSSL_GCM_C) && ( \
101 !defined(POLARSSL_AES_C) && !defined(POLARSSL_CAMELLIA_C) )
102#error "POLARSSL_GCM_C defined, but not all prerequisites"
103#endif
104
105#if defined(POLARSSL_HAVEGE_C) && !defined(POLARSSL_TIMING_C)
106#error "POLARSSL_HAVEGE_C defined, but not all prerequisites"
107#endif
108
109#if defined(POLARSSL_HMAC_DRBG) && !defined(POLARSSL_MD_C)
110#error "POLARSSL_HMAC_DRBG_C defined, but not all prerequisites"
111#endif
112
113#if defined(POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
114 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
115#error "POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
116#endif
117
118#if defined(POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
119 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_X509_CRT_PARSE_C) )
120#error "POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
121#endif
122
123#if defined(POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(POLARSSL_DHM_C)
124#error "POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
125#endif
126
127#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
128 !defined(POLARSSL_ECDH_C)
129#error "POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
130#endif
131
132#if defined(POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
133 ( !defined(POLARSSL_DHM_C) || !defined(POLARSSL_RSA_C) || \
134 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
135#error "POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
136#endif
137
138#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
139 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_RSA_C) || \
140 !defined(POLARSSL_X509_CRT_PARSE_C) || !defined(POLARSSL_PKCS1_V15) )
141#error "POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
142#endif
143
144#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
145 ( !defined(POLARSSL_ECDH_C) || !defined(POLARSSL_ECDSA_C) || \
146 !defined(POLARSSL_X509_CRT_PARSE_C) )
147#error "POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
148#endif
149
150#if defined(POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
151 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
152 !defined(POLARSSL_PKCS1_V15) )
153#error "POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
154#endif
155
156#if defined(POLARSSL_KEY_EXCHANGE_RSA_ENABLED) && \
157 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_X509_CRT_PARSE_C) ||\
158 !defined(POLARSSL_PKCS1_V15) )
159#error "POLARSSL_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
160#endif
161
162#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
163 ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) )
164#error "POLARSSL_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
165#endif
166
167#if defined(POLARSSL_PADLOCK_C) && !defined(POLARSSL_HAVE_ASM)
168#error "POLARSSL_PADLOCK_C defined, but not all prerequisites"
169#endif
170
171#if defined(POLARSSL_PBKDF2_C) && !defined(POLARSSL_MD_C)
172#error "POLARSSL_PBKDF2_C defined, but not all prerequisites"
173#endif
174
175#if defined(POLARSSL_PEM_PARSE_C) && !defined(POLARSSL_BASE64_C)
176#error "POLARSSL_PEM_PARSE_C defined, but not all prerequisites"
177#endif
178
179#if defined(POLARSSL_PEM_WRITE_C) && !defined(POLARSSL_BASE64_C)
180#error "POLARSSL_PEM_WRITE_C defined, but not all prerequisites"
181#endif
182
183#if defined(POLARSSL_PK_PARSE_C) && !defined(POLARSSL_PK_C)
184#error "POLARSSL_PK_PARSE_C defined, but not all prerequisites"
185#endif
186
187#if defined(POLARSSL_PK_WRITE_C) && !defined(POLARSSL_PK_C)
188#error "POLARSSL_PK_WRITE_C defined, but not all prerequisites"
189#endif
190
191#if defined(POLARSSL_PKCS11_C) && !defined(POLARSSL_PK_C)
192#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
193#endif
194
195#if defined(POLARSSL_RSA_C) && ( !defined(POLARSSL_BIGNUM_C) || \
196 !defined(POLARSSL_OID_C) )
197#error "POLARSSL_RSA_C defined, but not all prerequisites"
198#endif
199
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200200#if defined(POLARSSL_X509_RSASSA_PSS_SUPPORT) && \
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100201 ( !defined(POLARSSL_RSA_C) || !defined(POLARSSL_PKCS1_V21) )
Manuel Pégourié-Gonnardd1539b12014-06-06 16:42:37 +0200202#error "POLARSSL_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100203#endif
204
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200205#if defined(POLARSSL_SSL_PROTO_SSL3) && ( !defined(POLARSSL_MD5_C) || \
206 !defined(POLARSSL_SHA1_C) )
207#error "POLARSSL_SSL_PROTO_SSL3 defined, but not all prerequisites"
208#endif
209
210#if defined(POLARSSL_SSL_PROTO_TLS1) && ( !defined(POLARSSL_MD5_C) || \
211 !defined(POLARSSL_SHA1_C) )
212#error "POLARSSL_SSL_PROTO_TLS1 defined, but not all prerequisites"
213#endif
214
215#if defined(POLARSSL_SSL_PROTO_TLS1_1) && ( !defined(POLARSSL_MD5_C) || \
216 !defined(POLARSSL_SHA1_C) )
217#error "POLARSSL_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
218#endif
219
220#if defined(POLARSSL_SSL_PROTO_TLS1_2) && ( !defined(POLARSSL_SHA1_C) && \
221 !defined(POLARSSL_SHA256_C) && !defined(POLARSSL_SHA512_C) )
222#error "POLARSSL_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
223#endif
224
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100225#if defined(POLARSSL_SSL_PROTO_DTLS) && ( \
226 !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
227 !defined(POLARSSL_SSL_PROTO_TLS1_2) )
228#error "POLARSSL_SSL_PROTO_DTLS defined, but not all prerequisites"
229#endif
230
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200231#if defined(POLARSSL_SSL_CLI_C) && !defined(POLARSSL_SSL_TLS_C)
232#error "POLARSSL_SSL_CLI_C defined, but not all prerequisites"
233#endif
234
235#if defined(POLARSSL_SSL_TLS_C) && ( !defined(POLARSSL_CIPHER_C) || \
236 !defined(POLARSSL_MD_C) )
237#error "POLARSSL_SSL_TLS_C defined, but not all prerequisites"
238#endif
239
240#if defined(POLARSSL_SSL_SRV_C) && !defined(POLARSSL_SSL_TLS_C)
241#error "POLARSSL_SSL_SRV_C defined, but not all prerequisites"
242#endif
243
244#if defined(POLARSSL_SSL_TLS_C) && (!defined(POLARSSL_SSL_PROTO_SSL3) && \
245 !defined(POLARSSL_SSL_PROTO_TLS1) && !defined(POLARSSL_SSL_PROTO_TLS1_1) && \
246 !defined(POLARSSL_SSL_PROTO_TLS1_2))
247#error "POLARSSL_SSL_TLS_C defined, but no protocols are active"
248#endif
249
250#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
251 defined(POLARSSL_SSL_PROTO_TLS1_1) && !defined(POLARSSL_SSL_PROTO_TLS1))
252#error "Illegal protocol selection"
253#endif
254
255#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_TLS1) && \
256 defined(POLARSSL_SSL_PROTO_TLS1_2) && !defined(POLARSSL_SSL_PROTO_TLS1_1))
257#error "Illegal protocol selection"
258#endif
259
260#if defined(POLARSSL_SSL_TLS_C) && (defined(POLARSSL_SSL_PROTO_SSL3) && \
261 defined(POLARSSL_SSL_PROTO_TLS1_2) && (!defined(POLARSSL_SSL_PROTO_TLS1) || \
262 !defined(POLARSSL_SSL_PROTO_TLS1_1)))
263#error "Illegal protocol selection"
264#endif
265
Manuel Pégourié-Gonnarda64acd42014-07-23 18:30:45 +0200266#if defined(POLARSSL_SSL_COOKIE_C) && !defined(POLARSSL_SSL_DTLS_HELLO_VERIFY)
267#error "POLARSSL_SSL_COOKIE_C defined, but not all prerequisites"
268#endif
269
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200270#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) && \
271 ( !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
272#error "POLARSSL_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
273#endif
274
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200275#if defined(POLARSSL_SSL_DTLS_ANTI_REPLAY) && \
276 ( !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
277#error "POLARSSL_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
278#endif
279
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200280#if defined(POLARSSL_SSL_DTLS_BADMAC_LIMIT) && \
281 ( !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
282#error "POLARSSL_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
283#endif
284
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200285#if defined(POLARSSL_SSL_SESSION_TICKETS) && defined(POLARSSL_SSL_TLS_C) && \
286 ( !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA256_C) || \
287 !defined(POLARSSL_CIPHER_MODE_CBC) )
288#error "POLARSSL_SSL_SESSION_TICKETS_C defined, but not all prerequisites"
289#endif
290
291#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION) && \
292 !defined(POLARSSL_X509_CRT_PARSE_C)
293#error "POLARSSL_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
294#endif
295
296#if defined(POLARSSL_THREADING_PTHREAD)
297#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
298#error "POLARSSL_THREADING_PTHREAD defined, but not all prerequisites"
299#endif
300#define POLARSSL_THREADING_IMPL
301#endif
302
303#if defined(POLARSSL_THREADING_ALT)
304#if !defined(POLARSSL_THREADING_C) || defined(POLARSSL_THREADING_IMPL)
305#error "POLARSSL_THREADING_ALT defined, but not all prerequisites"
306#endif
307#define POLARSSL_THREADING_IMPL
308#endif
309
310#if defined(POLARSSL_THREADING_C) && !defined(POLARSSL_THREADING_IMPL)
311#error "POLARSSL_THREADING_C defined, single threading implementation required"
312#endif
313#undef POLARSSL_THREADING_IMPL
314
315#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
316#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
317#endif
318
319#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
320 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
321 !defined(POLARSSL_PK_PARSE_C) )
322#error "POLARSSL_X509_USE_C defined, but not all prerequisites"
323#endif
324
325#if defined(POLARSSL_X509_CREATE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
326 !defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_WRITE_C) || \
327 !defined(POLARSSL_PK_WRITE_C) )
328#error "POLARSSL_X509_CREATE_C defined, but not all prerequisites"
329#endif
330
331#if defined(POLARSSL_X509_CRT_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
332#error "POLARSSL_X509_CRT_PARSE_C defined, but not all prerequisites"
333#endif
334
335#if defined(POLARSSL_X509_CRL_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
336#error "POLARSSL_X509_CRL_PARSE_C defined, but not all prerequisites"
337#endif
338
339#if defined(POLARSSL_X509_CSR_PARSE_C) && ( !defined(POLARSSL_X509_USE_C) )
340#error "POLARSSL_X509_CSR_PARSE_C defined, but not all prerequisites"
341#endif
342
343#if defined(POLARSSL_X509_CRT_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
344#error "POLARSSL_X509_CRT_WRITE_C defined, but not all prerequisites"
345#endif
346
347#if defined(POLARSSL_X509_CSR_WRITE_C) && ( !defined(POLARSSL_X509_CREATE_C) )
348#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
349#endif
350
351#endif /* POLARSSL_CHECK_CONFIG_H */