blob: fbf43c7792deddec471416772b0e364a0961c445 [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
Darryl Greena40a1012018-01-05 15:33:17 +00005 */
6/*
Bence Szépkúti1e148272020-08-07 13:07:28 +02007 * Copyright The Mbed TLS Contributors
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +02008 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020021 */
22
23/*
24 * It is recommended to include this file from your config.h
25 * in order to catch dependency issues early.
26 */
27
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020028#ifndef MBEDTLS_CHECK_CONFIG_H
29#define MBEDTLS_CHECK_CONFIG_H
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020030
Manuel Pégourié-Gonnardd14acbc2015-05-29 11:26:37 +020031/*
32 * We assume CHAR_BIT is 8 in many places. In practice, this is true on our
33 * target platforms, so not an issue, but let's just be extra sure.
34 */
35#include <limits.h>
36#if CHAR_BIT != 8
37#error "mbed TLS requires a platform with 8-bit chars"
38#endif
39
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020040#if defined(_WIN32)
41#if !defined(MBEDTLS_PLATFORM_C)
Manuel Pégourié-Gonnard6c0c8e02015-06-22 10:23:34 +020042#error "MBEDTLS_PLATFORM_C is required on Windows"
43#endif
44
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020045/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
Gilles Peskine5d46f6a2019-07-27 23:52:53 +020046 * it would confuse config.py. */
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020047#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
48 !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
49#define MBEDTLS_PLATFORM_SNPRINTF_ALT
50#endif
k-stachowiak6b5ef482019-01-07 16:53:29 +010051
52#if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \
53 !defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
54#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
55#endif
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020056#endif /* _WIN32 */
57
Jaeden Amero128c94d2021-06-08 18:31:27 +010058#if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C)
59#error "The NET module is not available for mbed OS - please use the network functions provided by Mbed OS"
Manuel Pégourié-Gonnard63e7eba2015-07-28 14:17:48 +020060#endif
61
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020062#if defined(MBEDTLS_DEPRECATED_WARNING) && \
Manuel Pégourié-Gonnard757ca002015-03-23 15:24:07 +010063 !defined(__GNUC__) && !defined(__clang__)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020064#error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010065#endif
66
Manuel Pégourié-Gonnard60c793b2015-06-18 20:52:58 +020067#if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
68#error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
69#endif
70
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020071#if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
72#error "MBEDTLS_AESNI_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020073#endif
74
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020075#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
76#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020077#endif
78
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020079#if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
80#error "MBEDTLS_DHM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020081#endif
82
Hanno Beckere89353a2017-11-20 16:36:41 +000083#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
84#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
85#endif
86
Brian Murray53e23b62016-09-13 14:00:15 -070087#if defined(MBEDTLS_CMAC_C) && \
Simon Butcher69283e52016-10-06 12:49:58 +010088 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
Brian Murray53e23b62016-09-13 14:00:15 -070089#error "MBEDTLS_CMAC_C defined, but not all prerequisites"
90#endif
91
Ron Eldor466a57f2018-05-03 16:54:28 +030092#if defined(MBEDTLS_NIST_KW_C) && \
93 ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) )
94#error "MBEDTLS_NIST_KW_C defined, but not all prerequisites"
95#endif
96
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020097#if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
98#error "MBEDTLS_ECDH_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020099#endif
100
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200101#if defined(MBEDTLS_ECDSA_C) && \
102 ( !defined(MBEDTLS_ECP_C) || \
Gilles Peskine799e5762018-09-14 17:34:00 +0200103 !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
104 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
105 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
106 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
107 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
108 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
109 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
110 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \
111 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
112 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
113 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200114 !defined(MBEDTLS_ASN1_PARSE_C) || \
115 !defined(MBEDTLS_ASN1_WRITE_C) )
116#error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200117#endif
118
Manuel Pégourié-Gonnard4d8685b2015-08-05 15:44:42 +0200119#if defined(MBEDTLS_ECJPAKE_C) && \
120 ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
121#error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
122#endif
123
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200124#if defined(MBEDTLS_ECP_RESTARTABLE) && \
Hanno Becker85fd9132019-02-22 12:50:35 +0000125 ( defined(MBEDTLS_USE_PSA_CRYPTO) || \
Hanno Becker1ce51e42019-02-22 10:25:47 +0000126 defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200127 defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \
128 defined(MBEDTLS_ECDSA_SIGN_ALT) || \
129 defined(MBEDTLS_ECDSA_VERIFY_ALT) || \
130 defined(MBEDTLS_ECDSA_GENKEY_ALT) || \
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500131 defined(MBEDTLS_ECP_INTERNAL_ALT) || \
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200132 defined(MBEDTLS_ECP_ALT) )
Hanno Becker1ce51e42019-02-22 10:25:47 +0000133#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative or PSA-based ECP implementation"
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200134#endif
135
Gilles Peskine43f564f2019-02-22 12:14:02 +0100136#if defined(MBEDTLS_ECP_RESTARTABLE) && \
137 ! defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
138#error "MBEDTLS_ECP_RESTARTABLE defined, but not MBEDTLS_ECDH_LEGACY_CONTEXT"
139#endif
140
Christoph M. Wintersteiger9c1b56b2019-04-15 11:09:33 +0100141#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) && \
142 defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
143#error "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED defined, but MBEDTLS_ECDH_LEGACY_CONTEXT not disabled"
144#endif
145
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200146#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
147#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200148#endif
149
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200150#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200151 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
152 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
153 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
154 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
155 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
156 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
157 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
158 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
159 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
160 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200161 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
162 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
163 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200164#error "MBEDTLS_ECP_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200165#endif
166
Manuel Pégourié-Gonnard1a3f9ed2020-05-19 12:38:31 +0200167#if defined(MBEDTLS_ECP_C) && !( \
168 defined(MBEDTLS_ECP_ALT) || \
169 defined(MBEDTLS_CTR_DRBG_C) || \
170 defined(MBEDTLS_HMAC_DRBG_C) || \
171 defined(MBEDTLS_ECP_NO_INTERNAL_RNG))
172#error "MBEDTLS_ECP_C requires a DRBG module unless MBEDTLS_ECP_NO_INTERNAL_RNG is defined or an alternative implementation is used"
173#endif
174
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500175#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
176#error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
177#endif
178
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100179#if defined(MBEDTLS_PKCS5_C) && !defined(MBEDTLS_MD_C)
180#error "MBEDTLS_PKCS5_C defined, but not all prerequesites"
181#endif
182
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200183#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
184 !defined(MBEDTLS_SHA256_C))
185#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200186#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200187#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
188 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
189#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200190#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200191#if defined(MBEDTLS_ENTROPY_C) && \
192 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
193 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
194#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200195#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200196#if defined(MBEDTLS_ENTROPY_C) && \
197 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
198#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200199#endif
200
Manuel Pégourié-Gonnard6240def2020-07-10 09:35:54 +0200201#if defined(__has_feature)
202#if __has_feature(memory_sanitizer)
203#define MBEDTLS_HAS_MEMSAN
204#endif
205#endif
206#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
207#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
208#endif
209#undef MBEDTLS_HAS_MEMSAN
210
Simon Butcherab5df402016-06-11 02:31:21 +0100211#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
212 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
213#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
Janos Follath53de7842016-06-08 15:29:18 +0100214#endif
Simon Butcherab5df402016-06-11 02:31:21 +0100215#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
216 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
217 defined(MBEDTLS_HAVEGE_C) )
218#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
Janos Follath53de7842016-06-08 15:29:18 +0100219#endif
220
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200221#if defined(MBEDTLS_GCM_C) && ( \
Jaeden Amero651ae682019-04-10 18:19:16 +0100222 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200223#error "MBEDTLS_GCM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200224#endif
225
Janos Follathc44ab972016-11-18 16:38:23 +0000226#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100227#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
228#endif
229
Janos Follathc44ab972016-11-18 16:38:23 +0000230#if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100231#error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
232#endif
233
Janos Follathc44ab972016-11-18 16:38:23 +0000234#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100235#error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
236#endif
237
Janos Follathc44ab972016-11-18 16:38:23 +0000238#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100239#error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
240#endif
241
Janos Follathc44ab972016-11-18 16:38:23 +0000242#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100243#error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
244#endif
245
Janos Follathc44ab972016-11-18 16:38:23 +0000246#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100247#error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
248#endif
249
Janos Follathc44ab972016-11-18 16:38:23 +0000250#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100251#error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
252#endif
253
Janos Follathc44ab972016-11-18 16:38:23 +0000254#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100255#error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
256#endif
257
Steven Cooremanb5873132021-01-21 13:59:17 +0100258#if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
259#error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled"
260#endif
261
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200262#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
263#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200264#endif
265
Thomas Fossati656864b2016-07-17 08:51:22 +0100266#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
267#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
268#endif
269
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200270#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
271#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200272#endif
273
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200274#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200275 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
276 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200277#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200278#endif
279
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200280#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200281 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
282 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200283#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200284#endif
285
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200286#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
287#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200288#endif
289
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200290#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
291 !defined(MBEDTLS_ECDH_C)
292#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200293#endif
294
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200295#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
296 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
297 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
298#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200299#endif
300
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200301#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
302 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
303 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
304#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200305#endif
306
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200307#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
308 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
309 !defined(MBEDTLS_X509_CRT_PARSE_C) )
310#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200311#endif
312
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200313#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
314 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
315 !defined(MBEDTLS_PKCS1_V15) )
316#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200317#endif
318
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200319#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
320 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
321 !defined(MBEDTLS_PKCS1_V15) )
322#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200323#endif
324
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200325#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
326 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
327 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
328#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
329#endif
330
Gilles Peskineeccd8882020-03-10 12:19:08 +0100331#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
Hanno Beckerfe4ef0c2019-02-26 11:43:09 +0000332 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \
333 ( !defined(MBEDTLS_SHA256_C) && \
334 !defined(MBEDTLS_SHA512_C) && \
335 !defined(MBEDTLS_SHA1_C) )
336#error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C"
337#endif
338
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200339#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
340 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
341#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200342#endif
343
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000344#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
345#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites"
346#endif
347
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100348#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
349#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites"
350#endif
351
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200352#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
353#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200354#endif
355
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200356#if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
357#error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200358#endif
359
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200360#if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
361#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200362#endif
363
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200364#if defined(MBEDTLS_PK_C) && \
365 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
366#error "MBEDTLS_PK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000367#endif
368
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200369#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
370#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200371#endif
372
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200373#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
374#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200375#endif
376
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200377#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
378#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200379#endif
380
Manuel Pégourié-Gonnard320f4d92020-02-04 09:17:29 +0100381#if defined(MBEDTLS_PKCS11_C)
382#if defined(MBEDTLS_DEPRECATED_REMOVED)
383#error "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
384#elif defined(MBEDTLS_DEPRECATED_WARNING)
385#warning "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
386#endif
387#endif /* MBEDTLS_PKCS11_C */
388
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200389#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
390#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000391#endif
392
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200393#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
394#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000395#endif
396
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200397#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
398 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
399 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
400#error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000401#endif
402
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100403#if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
404 ( !defined(MBEDTLS_PLATFORM_C) ||\
405 !defined(MBEDTLS_HAVE_TIME) )
406#error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
407#endif
408
409#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
410 ( !defined(MBEDTLS_PLATFORM_C) ||\
411 !defined(MBEDTLS_HAVE_TIME) )
412#error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
413#endif
414
415#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
416 ( !defined(MBEDTLS_PLATFORM_C) ||\
417 !defined(MBEDTLS_HAVE_TIME) )
418#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
419#endif
420
421#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
422 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
423 defined(MBEDTLS_PLATFORM_TIME_ALT) )
424#error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
425#endif
426
427#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
428 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
429 defined(MBEDTLS_PLATFORM_TIME_ALT) )
430#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
431#endif
432
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200433#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
434#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000435#endif
436
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200437#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
438#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000439#endif
440
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200441#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
442 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
443 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
444#error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000445#endif
446
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200447#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
448 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
449#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000450#endif
451
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200452#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
453 defined(MBEDTLS_PLATFORM_STD_FREE)
454#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000455#endif
456
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200457#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
458#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000459#endif
460
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200461#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200462 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200463#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000464#endif
465
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200466#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
467 defined(MBEDTLS_PLATFORM_STD_CALLOC)
468#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000469#endif
470
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200471#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
472#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000473#endif
474
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200475#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
476#error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000477#endif
478
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200479#if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
480#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000481#endif
482
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200483#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
484#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000485#endif
486
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200487#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
488 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
489 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
490#error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000491#endif
492
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200493#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
494#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000495#endif
496
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200497#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
498#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000499#endif
500
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200501#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
502 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
503 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
504#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000505#endif
506
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200507#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
508 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
509#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000510#endif
511
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200512#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
513#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000514#endif
515
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200516#if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
517#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000518#endif
519
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200520#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
521 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
522#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000523#endif
524
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100525#if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
526 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
527 !defined(MBEDTLS_HAVE_TIME) )
528#error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
529#endif
530
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200531#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
532 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
533#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000534#endif
535
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200536#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
537 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
538#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000539#endif
540
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200541#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
542 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
543#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000544#endif
545
Paul Bakkercf0a9f92016-06-01 11:25:44 +0100546#if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
547 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
548#error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
549#endif
550
551#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
552 !defined(MBEDTLS_ENTROPY_NV_SEED)
553#error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
554#endif
555
556#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
557 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
558#error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
559#endif
560
561#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
562 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
563#error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
564#endif
565
566#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
567 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
568 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
569#error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
570#endif
571
572#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
573 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
574 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
575#error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
576#endif
577
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100578#if defined(MBEDTLS_PSA_CRYPTO_C) && \
Gilles Peskine82e57d12020-11-13 21:31:17 +0100579 !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100580 defined(MBEDTLS_ENTROPY_C) ) || \
581 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) )
582#error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)"
Jaeden Amero484ee332018-10-25 17:38:05 +0100583#endif
584
Andrzej Kurekc6905232019-02-05 05:23:41 -0500585#if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C)
586#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
587#endif
588
Gilles Peskinea8ade162019-06-26 11:24:49 +0200589#if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \
590 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \
591 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) )
592#error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites"
593#endif
594
Andrzej Kurekc6905232019-02-05 05:23:41 -0500595#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000596 ! defined(MBEDTLS_PSA_CRYPTO_C)
Andrzej Kurekc6905232019-02-05 05:23:41 -0500597#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
598#endif
599
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000600#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
601 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
602 defined(MBEDTLS_ENTROPY_NV_SEED) )
603#error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500604#endif
605
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000606#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
607 !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
608#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources"
609#endif
610
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100611#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
Gilles Peskine89ffb282020-11-18 15:23:08 +0100612 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100613#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG"
614#endif
615
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000616#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
617 !defined(MBEDTLS_FS_IO)
618#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500619#endif
620
Ronald Cronc3623db2020-10-29 10:51:32 +0100621#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
622 defined(MBEDTLS_USE_PSA_CRYPTO)
623#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
624#endif
625
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500626#if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
627 !defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_ECDSA_C)
628#error "MBEDTLS_PK_C in configuration with MBEDTLS_USE_PSA_CRYPTO and \
629 MBEDTLS_ECDSA_C requires MBEDTLS_PK_WRITE_C to be defined."
630#endif
631
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200632#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
633 !defined(MBEDTLS_OID_C) )
634#error "MBEDTLS_RSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200635#endif
636
Paul Bakker4fde40f2016-05-09 15:13:04 +0100637#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
Paul Bakker37068a72016-05-09 14:36:33 +0100638 !defined(MBEDTLS_PKCS1_V15) )
639#error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
640#endif
641
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200642#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
643 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
644#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100645#endif
646
Manuel Pégourié-Gonnard1e6fb012020-01-07 11:00:34 +0100647#if defined(MBEDTLS_SHA512_NO_SHA384) && !defined(MBEDTLS_SHA512_C)
648#error "MBEDTLS_SHA512_NO_SHA384 defined without MBEDTLS_SHA512_C"
649#endif
650
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200651#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
652 !defined(MBEDTLS_SHA1_C) )
653#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200654#endif
655
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200656#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
657 !defined(MBEDTLS_SHA1_C) )
658#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200659#endif
660
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200661#if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
662 !defined(MBEDTLS_SHA1_C) )
663#error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200664#endif
665
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200666#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
667 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
668#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200669#endif
670
Hanno Beckerafca47a2020-06-02 07:51:26 +0100671#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) && ( !defined(MBEDTLS_HKDF_C) && \
Hanno Becker6055a172020-06-02 06:20:23 +0100672 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
673#error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites"
674#endif
675
Simon Butcher432e7022019-04-11 18:56:18 +0100676#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
677 defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
678 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
679 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
680 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
681 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
682 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
683 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
684 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
685 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
686 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
687 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
688 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
689#error "One or more versions of the TLS protocol are enabled " \
690 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
691#endif
692
Manuel Pégourié-Gonnard5a8d56d2015-05-13 10:10:00 +0200693#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
694 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
695 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200696#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100697#endif
698
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200699#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
700#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200701#endif
702
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200703#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
704 !defined(MBEDTLS_MD_C) )
705#error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200706#endif
707
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200708#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
709#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200710#endif
711
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200712#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
713 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
714 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
715#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200716#endif
717
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200718#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
719 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200720#error "Illegal protocol selection"
721#endif
722
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200723#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
724 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200725#error "Illegal protocol selection"
726#endif
727
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200728#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
729 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
730 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200731#error "Illegal protocol selection"
732#endif
733
Manuel Pégourié-Gonnarde057d3b2015-05-20 10:59:43 +0200734#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200735#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200736#endif
737
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200738#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
Manuel Pégourié-Gonnardddfe5d22015-09-09 12:46:16 +0200739 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200740#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
741#endif
742
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200743#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
744 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
745#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200746#endif
747
Gilles Peskined3d02902020-03-04 21:35:27 +0100748#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
749 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
750#error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
751#endif
752
753#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
754 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \
755 MBEDTLS_SSL_CID_IN_LEN_MAX > 255
756#error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
757#endif
758
759#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
760 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \
761 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
762#error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
763#endif
764
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200765#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
766 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
767#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200768#endif
769
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200770#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
771 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
772 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
773 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
774#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100775#endif
776
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200777#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
778 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
779 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
780 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
781#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100782#endif
783
Manuel Pégourié-Gonnard4214e3a2015-05-25 19:34:49 +0200784#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
Manuel Pégourié-Gonnard0c0f11f2015-05-20 09:55:50 +0200785#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200786#endif
787
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200788#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
789 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
790#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100791#endif
792
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200793#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
794 !defined(MBEDTLS_X509_CRT_PARSE_C)
795#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200796#endif
797
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200798#if defined(MBEDTLS_THREADING_PTHREAD)
799#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
800#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200801#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200802#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200803#endif
804
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200805#if defined(MBEDTLS_THREADING_ALT)
806#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
807#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200808#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200809#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200810#endif
811
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200812#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
813#error "MBEDTLS_THREADING_C defined, single threading implementation required"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200814#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200815#undef MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200816
Manuel Pégourié-Gonnardaeefa492018-10-22 12:14:52 +0200817#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C)
818#error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites"
819#endif
820
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200821#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
822#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200823#endif
824
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200825#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
826 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
827 !defined(MBEDTLS_PK_PARSE_C) )
828#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200829#endif
830
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200831#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
832 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
833 !defined(MBEDTLS_PK_WRITE_C) )
834#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200835#endif
836
Simon Butcher432e7022019-04-11 18:56:18 +0100837#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
838#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
839#endif
840
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200841#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
842#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200843#endif
844
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200845#if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
846#error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200847#endif
848
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200849#if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
850#error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200851#endif
852
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200853#if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
854#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200855#endif
856
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200857#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
858#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200859#endif
860
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100861#if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
862#error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
863#endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
864
Andres Amaya Garcia93db11a2017-07-20 12:11:19 +0100865#if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
866 defined(MBEDTLS_HAVE_ASM)
Andres Amaya Garciab39467d2017-07-20 13:21:15 +0100867#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100868#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
869
Andres Amaya Garcia88c2cc72018-11-29 09:56:02 +0000870#if defined(MBEDTLS_SSL_PROTO_SSL3)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000871#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000872#error "MBEDTLS_SSL_PROTO_SSL3 is deprecated and will be removed in a future version of Mbed TLS"
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000873#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000874#warning "MBEDTLS_SSL_PROTO_SSL3 is deprecated and will be removed in a future version of Mbed TLS"
Andres Amaya Garcia88c2cc72018-11-29 09:56:02 +0000875#endif
876#endif /* MBEDTLS_SSL_PROTO_SSL3 */
877
Andres Amaya Garcia09634242018-11-29 09:55:41 +0000878#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000879#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000880#error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is deprecated and will be removed in a future version of Mbed TLS"
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000881#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000882#warning "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is deprecated and will be removed in a future version of Mbed TLS"
Andres Amaya Garcia09634242018-11-29 09:55:41 +0000883#endif
884#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
885
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000886#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
887#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000888#error "MBEDTLS_SSL_HW_RECORD_ACCEL is deprecated and will be removed in a future version of Mbed TLS"
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000889#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000890#warning "MBEDTLS_SSL_HW_RECORD_ACCEL is deprecated and will be removed in a future version of Mbed TLS"
Andres Amaya Garcia10edb3e2019-01-15 18:44:06 +0000891#endif /* MBEDTLS_DEPRECATED_REMOVED */
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000892#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
893
Ron Eldor3adb9922017-12-21 10:15:08 +0200894#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
895#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
896#endif
897
Andrzej Kurek557289b2020-10-21 15:12:39 +0200898#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
899#error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
900#endif
901
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200902/*
903 * Avoid warning from -pedantic. This is a convenient place for this
904 * workaround since this is included by every single file before the
Antonin Décimo36e89b52019-01-23 15:24:37 +0100905 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200906 */
907typedef int mbedtls_iso_c_forbids_empty_translation_units;
908
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200909#endif /* MBEDTLS_CHECK_CONFIG_H */