blob: 2cb36e9e17b975e64953bee67adf904db8611a31 [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
David Horstmannd2c83be2022-11-14 15:40:46 +000031/* *INDENT-OFF* */
Manuel Pégourié-Gonnardd14acbc2015-05-29 11:26:37 +020032/*
33 * We assume CHAR_BIT is 8 in many places. In practice, this is true on our
34 * target platforms, so not an issue, but let's just be extra sure.
35 */
36#include <limits.h>
37#if CHAR_BIT != 8
38#error "mbed TLS requires a platform with 8-bit chars"
39#endif
40
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020041#if defined(_WIN32)
42#if !defined(MBEDTLS_PLATFORM_C)
Manuel Pégourié-Gonnard6c0c8e02015-06-22 10:23:34 +020043#error "MBEDTLS_PLATFORM_C is required on Windows"
44#endif
45
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020046/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
Gilles Peskine5d46f6a2019-07-27 23:52:53 +020047 * it would confuse config.py. */
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020048#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
49 !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
50#define MBEDTLS_PLATFORM_SNPRINTF_ALT
51#endif
k-stachowiak6b5ef482019-01-07 16:53:29 +010052
53#if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \
54 !defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
55#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
56#endif
Manuel Pégourié-Gonnard9db28872015-06-26 10:52:01 +020057#endif /* _WIN32 */
58
Jaeden Amero128c94d2021-06-08 18:31:27 +010059#if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C)
60#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 +020061#endif
62
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020063#if defined(MBEDTLS_DEPRECATED_WARNING) && \
Manuel Pégourié-Gonnard757ca002015-03-23 15:24:07 +010064 !defined(__GNUC__) && !defined(__clang__)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020065#error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
Manuel Pégourié-Gonnardc70581c2015-03-23 13:58:27 +010066#endif
67
Manuel Pégourié-Gonnard60c793b2015-06-18 20:52:58 +020068#if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
69#error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
70#endif
71
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020072#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
73#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020074#endif
75
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020076#if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
77#error "MBEDTLS_DHM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020078#endif
79
Hanno Beckere89353a2017-11-20 16:36:41 +000080#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
81#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
82#endif
83
Brian Murray53e23b62016-09-13 14:00:15 -070084#if defined(MBEDTLS_CMAC_C) && \
Simon Butcher69283e52016-10-06 12:49:58 +010085 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
Brian Murray53e23b62016-09-13 14:00:15 -070086#error "MBEDTLS_CMAC_C defined, but not all prerequisites"
87#endif
88
Ron Eldor466a57f2018-05-03 16:54:28 +030089#if defined(MBEDTLS_NIST_KW_C) && \
90 ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) )
91#error "MBEDTLS_NIST_KW_C defined, but not all prerequisites"
92#endif
93
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020094#if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
95#error "MBEDTLS_ECDH_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020096#endif
97
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020098#if defined(MBEDTLS_ECDSA_C) && \
99 ( !defined(MBEDTLS_ECP_C) || \
Gilles Peskine799e5762018-09-14 17:34:00 +0200100 !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
101 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
102 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
103 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
104 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
105 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
106 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
107 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \
108 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
109 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
110 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200111 !defined(MBEDTLS_ASN1_PARSE_C) || \
112 !defined(MBEDTLS_ASN1_WRITE_C) )
113#error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200114#endif
115
Manuel Pégourié-Gonnard4d8685b2015-08-05 15:44:42 +0200116#if defined(MBEDTLS_ECJPAKE_C) && \
117 ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
118#error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
119#endif
120
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200121#if defined(MBEDTLS_ECP_RESTARTABLE) && \
Hanno Becker85fd9132019-02-22 12:50:35 +0000122 ( defined(MBEDTLS_USE_PSA_CRYPTO) || \
Hanno Becker1ce51e42019-02-22 10:25:47 +0000123 defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200124 defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \
125 defined(MBEDTLS_ECDSA_SIGN_ALT) || \
126 defined(MBEDTLS_ECDSA_VERIFY_ALT) || \
127 defined(MBEDTLS_ECDSA_GENKEY_ALT) || \
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500128 defined(MBEDTLS_ECP_INTERNAL_ALT) || \
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200129 defined(MBEDTLS_ECP_ALT) )
Hanno Becker1ce51e42019-02-22 10:25:47 +0000130#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative or PSA-based ECP implementation"
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200131#endif
132
Gilles Peskine43f564f2019-02-22 12:14:02 +0100133#if defined(MBEDTLS_ECP_RESTARTABLE) && \
134 ! defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
135#error "MBEDTLS_ECP_RESTARTABLE defined, but not MBEDTLS_ECDH_LEGACY_CONTEXT"
136#endif
137
Christoph M. Wintersteiger9c1b56b2019-04-15 11:09:33 +0100138#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) && \
139 defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
140#error "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED defined, but MBEDTLS_ECDH_LEGACY_CONTEXT not disabled"
141#endif
142
Manuel Pégourié-Gonnard3dc7f232022-12-06 13:20:06 +0100143#if defined(MBEDTLS_ECP_RESTARTABLE) && \
144 !defined(MBEDTLS_ECP_C)
145#error "MBEDTLS_ECP_RESTARTABLE defined, but not all prerequisites"
146#endif
147
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200148#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
149#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200150#endif
151
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200152#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200153 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
154 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
155 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
156 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
157 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
158 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
159 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
160 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
161 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
162 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200163 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
164 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
165 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200166#error "MBEDTLS_ECP_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200167#endif
168
Manuel Pégourié-Gonnard1a3f9ed2020-05-19 12:38:31 +0200169#if defined(MBEDTLS_ECP_C) && !( \
170 defined(MBEDTLS_ECP_ALT) || \
171 defined(MBEDTLS_CTR_DRBG_C) || \
172 defined(MBEDTLS_HMAC_DRBG_C) || \
173 defined(MBEDTLS_ECP_NO_INTERNAL_RNG))
174#error "MBEDTLS_ECP_C requires a DRBG module unless MBEDTLS_ECP_NO_INTERNAL_RNG is defined or an alternative implementation is used"
175#endif
176
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500177#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800178#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500179#endif
180
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100181#if defined(MBEDTLS_PKCS5_C) && !defined(MBEDTLS_MD_C)
Andrzej Kurek293e4522022-04-13 14:28:52 -0400182#error "MBEDTLS_PKCS5_C defined, but not all prerequisites"
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100183#endif
184
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200185#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
186 !defined(MBEDTLS_SHA256_C))
187#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200188#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200189#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
190 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
191#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200192#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200193#if defined(MBEDTLS_ENTROPY_C) && \
194 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
195 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
196#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200197#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200198#if defined(MBEDTLS_ENTROPY_C) && \
199 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
200#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200201#endif
202
Manuel Pégourié-Gonnard6240def2020-07-10 09:35:54 +0200203#if defined(__has_feature)
204#if __has_feature(memory_sanitizer)
205#define MBEDTLS_HAS_MEMSAN
206#endif
207#endif
208#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
209#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
210#endif
211#undef MBEDTLS_HAS_MEMSAN
212
Simon Butcherab5df402016-06-11 02:31:21 +0100213#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
214 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
215#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
Janos Follath53de7842016-06-08 15:29:18 +0100216#endif
Simon Butcherab5df402016-06-11 02:31:21 +0100217#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
218 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
219 defined(MBEDTLS_HAVEGE_C) )
220#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
Janos Follath53de7842016-06-08 15:29:18 +0100221#endif
222
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200223#if defined(MBEDTLS_CCM_C) && ( \
Gilles Peskinefa21dda2021-09-09 20:39:47 +0200224 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200225#error "MBEDTLS_CCM_C defined, but not all prerequisites"
226#endif
227
228#if defined(MBEDTLS_CCM_C) && !defined(MBEDTLS_CIPHER_C)
229#error "MBEDTLS_CCM_C defined, but not all prerequisites"
230#endif
231
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200232#if defined(MBEDTLS_GCM_C) && ( \
Gilles Peskinefa21dda2021-09-09 20:39:47 +0200233 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200234#error "MBEDTLS_GCM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200235#endif
236
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200237#if defined(MBEDTLS_GCM_C) && !defined(MBEDTLS_CIPHER_C)
238#error "MBEDTLS_GCM_C defined, but not all prerequisites"
239#endif
240
241#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_CHACHA20_C)
242#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
243#endif
244
245#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_POLY1305_C)
246#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
247#endif
248
Janos Follathc44ab972016-11-18 16:38:23 +0000249#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100250#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
251#endif
252
Janos Follathc44ab972016-11-18 16:38:23 +0000253#if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100254#error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
255#endif
256
Janos Follathc44ab972016-11-18 16:38:23 +0000257#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100258#error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
259#endif
260
Janos Follathc44ab972016-11-18 16:38:23 +0000261#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100262#error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
263#endif
264
Janos Follathc44ab972016-11-18 16:38:23 +0000265#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100266#error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
267#endif
268
Janos Follathc44ab972016-11-18 16:38:23 +0000269#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100270#error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
271#endif
272
Janos Follathc44ab972016-11-18 16:38:23 +0000273#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100274#error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
275#endif
276
Janos Follathc44ab972016-11-18 16:38:23 +0000277#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100278#error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
279#endif
280
Steven Cooremanb5873132021-01-21 13:59:17 +0100281#if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
282#error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled"
283#endif
284
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200285#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
286#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200287#endif
288
Thomas Fossati656864b2016-07-17 08:51:22 +0100289#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
290#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
291#endif
292
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200293#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
294#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200295#endif
296
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200297#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200298 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
299 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200300#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200301#endif
302
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200303#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200304 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
305 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200306#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200307#endif
308
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200309#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
310#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_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_ECDHE_PSK_ENABLED) && \
314 !defined(MBEDTLS_ECDH_C)
315#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200316#endif
317
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200318#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
319 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
320 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
321#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200322#endif
323
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200324#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
325 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
326 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
327#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200328#endif
329
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200330#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
331 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
332 !defined(MBEDTLS_X509_CRT_PARSE_C) )
333#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200334#endif
335
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200336#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
337 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
338 !defined(MBEDTLS_PKCS1_V15) )
339#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200340#endif
341
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200342#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
343 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
344 !defined(MBEDTLS_PKCS1_V15) )
345#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200346#endif
347
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200348#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
349 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
350 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
351#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
352#endif
353
Gilles Peskineeccd8882020-03-10 12:19:08 +0100354#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
Hanno Beckerfe4ef0c2019-02-26 11:43:09 +0000355 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \
356 ( !defined(MBEDTLS_SHA256_C) && \
357 !defined(MBEDTLS_SHA512_C) && \
358 !defined(MBEDTLS_SHA1_C) )
359#error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C"
360#endif
361
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200362#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
363 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
364#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200365#endif
366
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000367#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800368#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequisites"
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000369#endif
370
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100371#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800372#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequisites"
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100373#endif
374
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200375#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
376#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200377#endif
378
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200379#if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
380#error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200381#endif
382
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200383#if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
384#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200385#endif
386
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200387#if defined(MBEDTLS_PK_C) && \
388 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
389#error "MBEDTLS_PK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000390#endif
391
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200392#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
393#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200394#endif
395
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200396#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
397#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200398#endif
399
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200400#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
401#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200402#endif
403
Manuel Pégourié-Gonnard320f4d92020-02-04 09:17:29 +0100404#if defined(MBEDTLS_PKCS11_C)
405#if defined(MBEDTLS_DEPRECATED_REMOVED)
406#error "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
407#elif defined(MBEDTLS_DEPRECATED_WARNING)
408#warning "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
409#endif
410#endif /* MBEDTLS_PKCS11_C */
411
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200412#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
413#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000414#endif
415
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200416#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
417#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000418#endif
419
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200420#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
421 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
422 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
423#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 +0000424#endif
425
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100426#if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
427 ( !defined(MBEDTLS_PLATFORM_C) ||\
428 !defined(MBEDTLS_HAVE_TIME) )
429#error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
430#endif
431
432#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
433 ( !defined(MBEDTLS_PLATFORM_C) ||\
434 !defined(MBEDTLS_HAVE_TIME) )
435#error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
436#endif
437
438#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
439 ( !defined(MBEDTLS_PLATFORM_C) ||\
440 !defined(MBEDTLS_HAVE_TIME) )
441#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
442#endif
443
444#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
445 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
446 defined(MBEDTLS_PLATFORM_TIME_ALT) )
447#error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
448#endif
449
450#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
451 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
452 defined(MBEDTLS_PLATFORM_TIME_ALT) )
453#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
454#endif
455
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200456#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
457#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000458#endif
459
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200460#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
461#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000462#endif
463
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200464#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
465 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
466 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
467#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 +0000468#endif
469
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200470#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
471 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
472#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000473#endif
474
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200475#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
476 defined(MBEDTLS_PLATFORM_STD_FREE)
477#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000478#endif
479
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200480#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
481#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000482#endif
483
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200484#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200485 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200486#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000487#endif
488
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200489#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
490 defined(MBEDTLS_PLATFORM_STD_CALLOC)
491#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000492#endif
493
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200494#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
495#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000496#endif
497
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200498#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
499#error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000500#endif
501
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200502#if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
503#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000504#endif
505
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200506#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
507#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000508#endif
509
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200510#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
511 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
512 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
513#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 +0000514#endif
515
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200516#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
517#error "MBEDTLS_PLATFORM_SNPRINTF_ALT 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_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
521#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000522#endif
523
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200524#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
525 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
526 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
527#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 +0000528#endif
529
Gilles Peskine9c764bf2022-09-18 14:05:23 +0200530#if defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
531#error "MBEDTLS_PLATFORM_VSNPRINTF_ALT defined, but not all prerequisites"
532#endif
533
534#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
535#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO defined, but not all prerequisites"
536#endif
537
538#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) &&\
539 ( defined(MBEDTLS_PLATFORM_STD_VSNPRINTF) ||\
540 defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) )
541#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_VSNPRINTF/MBEDTLS_PLATFORM_VSNPRINTF_ALT cannot be defined simultaneously"
542#endif
543
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200544#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
545 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
546#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000547#endif
548
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200549#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
550#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000551#endif
552
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200553#if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
554#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000555#endif
556
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200557#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
558 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
559#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000560#endif
561
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100562#if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
563 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
564 !defined(MBEDTLS_HAVE_TIME) )
565#error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
566#endif
567
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200568#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
569 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
570#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000571#endif
572
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200573#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
574 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
575#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000576#endif
577
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200578#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
579 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
580#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000581#endif
582
Paul Bakkercf0a9f92016-06-01 11:25:44 +0100583#if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
584 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
585#error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
586#endif
587
588#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
589 !defined(MBEDTLS_ENTROPY_NV_SEED)
590#error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
591#endif
592
593#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
594 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
595#error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
596#endif
597
598#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
599 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
600#error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
601#endif
602
603#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
604 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
605 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
606#error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
607#endif
608
609#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
610 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
611 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
612#error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
613#endif
614
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100615#if defined(MBEDTLS_PSA_CRYPTO_C) && \
Gilles Peskine82e57d12020-11-13 21:31:17 +0100616 !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100617 defined(MBEDTLS_ENTROPY_C) ) || \
618 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) )
619#error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)"
Jaeden Amero484ee332018-10-25 17:38:05 +0100620#endif
621
Andrzej Kurekc6905232019-02-05 05:23:41 -0500622#if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C)
623#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
624#endif
625
Gilles Peskinea8ade162019-06-26 11:24:49 +0200626#if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \
627 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \
628 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) )
629#error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites"
630#endif
631
Andrzej Kurekc6905232019-02-05 05:23:41 -0500632#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000633 ! defined(MBEDTLS_PSA_CRYPTO_C)
Andrzej Kurekc6905232019-02-05 05:23:41 -0500634#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
635#endif
636
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000637#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
638 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
639 defined(MBEDTLS_ENTROPY_NV_SEED) )
640#error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500641#endif
642
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000643#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
644 !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
645#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources"
646#endif
647
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100648#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
Gilles Peskine89ffb282020-11-18 15:23:08 +0100649 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100650#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG"
651#endif
652
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000653#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
654 !defined(MBEDTLS_FS_IO)
655#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500656#endif
657
Ronald Cronc3623db2020-10-29 10:51:32 +0100658#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
659 defined(MBEDTLS_USE_PSA_CRYPTO)
660#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
661#endif
662
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500663#if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
Andrzej Kurekd08ed952022-01-27 11:03:09 -0500664 !defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_ECDSA_C)
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500665#error "MBEDTLS_PK_C in configuration with MBEDTLS_USE_PSA_CRYPTO and \
Andrzej Kurekd08ed952022-01-27 11:03:09 -0500666 MBEDTLS_ECDSA_C requires MBEDTLS_PK_WRITE_C to be defined."
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500667#endif
668
Gilles Peskine8fb928f2022-10-25 20:24:29 +0200669#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C) && \
670 !( defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PK_WRITE_C) )
671#error "MBEDTLS_PSA_CRYPTO_C with MBEDTLS_RSA_C requires MBEDTLS_PK_PARSE_C and MBEDTLS_PK_WRITE_C"
Andrzej Kureka16ffaf2022-01-28 09:03:03 -0500672#endif
673
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200674#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
675 !defined(MBEDTLS_OID_C) )
676#error "MBEDTLS_RSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200677#endif
678
Paul Bakker4fde40f2016-05-09 15:13:04 +0100679#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
Paul Bakker37068a72016-05-09 14:36:33 +0100680 !defined(MBEDTLS_PKCS1_V15) )
681#error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
682#endif
683
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200684#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
685 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
686#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100687#endif
688
Manuel Pégourié-Gonnard1e6fb012020-01-07 11:00:34 +0100689#if defined(MBEDTLS_SHA512_NO_SHA384) && !defined(MBEDTLS_SHA512_C)
690#error "MBEDTLS_SHA512_NO_SHA384 defined without MBEDTLS_SHA512_C"
691#endif
692
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200693#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
694 !defined(MBEDTLS_SHA1_C) )
695#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200696#endif
697
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200698#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
699 !defined(MBEDTLS_SHA1_C) )
700#error "MBEDTLS_SSL_PROTO_TLS1 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_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
704 !defined(MBEDTLS_SHA1_C) )
705#error "MBEDTLS_SSL_PROTO_TLS1_1 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_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
709 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
710#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200711#endif
712
Hanno Beckerafca47a2020-06-02 07:51:26 +0100713#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) && ( !defined(MBEDTLS_HKDF_C) && \
Hanno Becker6055a172020-06-02 06:20:23 +0100714 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
715#error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites"
716#endif
717
Simon Butcher432e7022019-04-11 18:56:18 +0100718#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
719 defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
720 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
721 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
722 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
723 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
724 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
725 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
726 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
727 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
728 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
729 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
730 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
731#error "One or more versions of the TLS protocol are enabled " \
732 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
733#endif
734
Manuel Pégourié-Gonnard5a8d56d2015-05-13 10:10:00 +0200735#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
736 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
737 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200738#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100739#endif
740
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200741#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
742#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200743#endif
744
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200745#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
746 !defined(MBEDTLS_MD_C) )
747#error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200748#endif
749
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200750#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
751#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200752#endif
753
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200754#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
755 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
756 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
757#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200758#endif
759
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200760#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
761 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200762#error "Illegal protocol selection"
763#endif
764
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200765#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
766 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200767#error "Illegal protocol selection"
768#endif
769
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200770#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
771 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
772 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200773#error "Illegal protocol selection"
774#endif
775
Manuel Pégourié-Gonnarde057d3b2015-05-20 10:59:43 +0200776#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200777#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200778#endif
779
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200780#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
Manuel Pégourié-Gonnardddfe5d22015-09-09 12:46:16 +0200781 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200782#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
783#endif
784
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200785#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
786 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
787#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200788#endif
789
Gilles Peskined3d02902020-03-04 21:35:27 +0100790#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
791 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
792#error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
793#endif
794
795#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
796 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \
797 MBEDTLS_SSL_CID_IN_LEN_MAX > 255
798#error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
799#endif
800
801#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
802 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \
803 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
804#error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
805#endif
806
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200807#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
808 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
809#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200810#endif
811
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200812#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
813 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
814 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
815 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Shaun Case0e7791f2021-12-20 21:14:10 -0800816#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequisites"
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100817#endif
818
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200819#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
820 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
821 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
822 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Shaun Case0e7791f2021-12-20 21:14:10 -0800823#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequisites"
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100824#endif
825
Manuel Pégourié-Gonnard4214e3a2015-05-25 19:34:49 +0200826#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
Manuel Pégourié-Gonnard0c0f11f2015-05-20 09:55:50 +0200827#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200828#endif
829
Przemek Stekiel97d57402022-10-10 14:08:51 +0200830#if defined(MBEDTLS_SSL_TICKET_C) && \
831 !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
832#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
833#endif
834
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200835#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
836 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
837#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100838#endif
839
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200840#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
841 !defined(MBEDTLS_X509_CRT_PARSE_C)
842#error "MBEDTLS_SSL_SERVER_NAME_INDICATION 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_THREADING_PTHREAD)
846#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
847#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200848#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200849#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200850#endif
851
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200852#if defined(MBEDTLS_THREADING_ALT)
853#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
854#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200855#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200856#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200857#endif
858
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200859#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
860#error "MBEDTLS_THREADING_C defined, single threading implementation required"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200861#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200862#undef MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200863
Manuel Pégourié-Gonnardaeefa492018-10-22 12:14:52 +0200864#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C)
865#error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites"
866#endif
867
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200868#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
869#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200870#endif
871
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200872#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
873 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
874 !defined(MBEDTLS_PK_PARSE_C) )
875#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200876#endif
877
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200878#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
879 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
880 !defined(MBEDTLS_PK_WRITE_C) )
881#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200882#endif
883
Simon Butcher432e7022019-04-11 18:56:18 +0100884#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
885#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
886#endif
887
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200888#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
889#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200890#endif
891
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200892#if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
893#error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200894#endif
895
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200896#if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
897#error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200898#endif
899
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200900#if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
901#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200902#endif
903
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200904#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
905#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200906#endif
907
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100908#if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
909#error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
910#endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
911
Andres Amaya Garcia93db11a2017-07-20 12:11:19 +0100912#if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
913 defined(MBEDTLS_HAVE_ASM)
Andres Amaya Garciab39467d2017-07-20 13:21:15 +0100914#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100915#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
916
Andres Amaya Garcia88c2cc72018-11-29 09:56:02 +0000917#if defined(MBEDTLS_SSL_PROTO_SSL3)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000918#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000919#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 +0000920#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000921#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 +0000922#endif
923#endif /* MBEDTLS_SSL_PROTO_SSL3 */
924
Andres Amaya Garcia09634242018-11-29 09:55:41 +0000925#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000926#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000927#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 +0000928#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000929#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 +0000930#endif
931#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
932
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000933#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
934#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000935#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 +0000936#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000937#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 +0000938#endif /* MBEDTLS_DEPRECATED_REMOVED */
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000939#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
940
Ron Eldor3adb9922017-12-21 10:15:08 +0200941#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
942#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
943#endif
944
Andrzej Kurek557289b2020-10-21 15:12:39 +0200945#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
946#error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
947#endif
948
Przemek Stekiel864b43d2022-10-05 11:47:29 +0200949#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) && !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
950#error "MBEDTLS_SSL_CONTEXT_SERIALIZATION defined, but not all prerequisites"
951#endif
952
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200953/*
954 * Avoid warning from -pedantic. This is a convenient place for this
955 * workaround since this is included by every single file before the
Antonin Décimo36e89b52019-01-23 15:24:37 +0100956 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200957 */
958typedef int mbedtls_iso_c_forbids_empty_translation_units;
959
David Horstmannd2c83be2022-11-14 15:40:46 +0000960/* *INDENT-ON* */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200961#endif /* MBEDTLS_CHECK_CONFIG_H */