blob: 25df257a94c6f9a8045adb7eb4c4f10c50b43bc8 [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é-Gonnard3dc7f232022-12-06 13:20:06 +0100146#if defined(MBEDTLS_ECP_RESTARTABLE) && \
147 !defined(MBEDTLS_ECP_C)
148#error "MBEDTLS_ECP_RESTARTABLE defined, but not all prerequisites"
149#endif
150
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200151#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
152#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200153#endif
154
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200155#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200156 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
157 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
158 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
159 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
160 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
161 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
162 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
163 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
164 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
165 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200166 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
167 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
168 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200169#error "MBEDTLS_ECP_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200170#endif
171
Manuel Pégourié-Gonnard1a3f9ed2020-05-19 12:38:31 +0200172#if defined(MBEDTLS_ECP_C) && !( \
173 defined(MBEDTLS_ECP_ALT) || \
174 defined(MBEDTLS_CTR_DRBG_C) || \
175 defined(MBEDTLS_HMAC_DRBG_C) || \
176 defined(MBEDTLS_ECP_NO_INTERNAL_RNG))
177#error "MBEDTLS_ECP_C requires a DRBG module unless MBEDTLS_ECP_NO_INTERNAL_RNG is defined or an alternative implementation is used"
178#endif
179
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500180#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800181#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500182#endif
183
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100184#if defined(MBEDTLS_PKCS5_C) && !defined(MBEDTLS_MD_C)
Andrzej Kurek293e4522022-04-13 14:28:52 -0400185#error "MBEDTLS_PKCS5_C defined, but not all prerequisites"
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100186#endif
187
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200188#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
189 !defined(MBEDTLS_SHA256_C))
190#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200191#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200192#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \
193 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
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_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
198 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
199#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200200#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200201#if defined(MBEDTLS_ENTROPY_C) && \
202 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
203#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200204#endif
205
Manuel Pégourié-Gonnard6240def2020-07-10 09:35:54 +0200206#if defined(__has_feature)
207#if __has_feature(memory_sanitizer)
208#define MBEDTLS_HAS_MEMSAN
209#endif
210#endif
211#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
212#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
213#endif
214#undef MBEDTLS_HAS_MEMSAN
215
Simon Butcherab5df402016-06-11 02:31:21 +0100216#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
217 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
218#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
Janos Follath53de7842016-06-08 15:29:18 +0100219#endif
Simon Butcherab5df402016-06-11 02:31:21 +0100220#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
221 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
222 defined(MBEDTLS_HAVEGE_C) )
223#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
Janos Follath53de7842016-06-08 15:29:18 +0100224#endif
225
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200226#if defined(MBEDTLS_CCM_C) && ( \
Gilles Peskinefa21dda2021-09-09 20:39:47 +0200227 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200228#error "MBEDTLS_CCM_C defined, but not all prerequisites"
229#endif
230
231#if defined(MBEDTLS_CCM_C) && !defined(MBEDTLS_CIPHER_C)
232#error "MBEDTLS_CCM_C defined, but not all prerequisites"
233#endif
234
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200235#if defined(MBEDTLS_GCM_C) && ( \
Gilles Peskinefa21dda2021-09-09 20:39:47 +0200236 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200237#error "MBEDTLS_GCM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200238#endif
239
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200240#if defined(MBEDTLS_GCM_C) && !defined(MBEDTLS_CIPHER_C)
241#error "MBEDTLS_GCM_C defined, but not all prerequisites"
242#endif
243
244#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_CHACHA20_C)
245#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
246#endif
247
248#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_POLY1305_C)
249#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
250#endif
251
Janos Follathc44ab972016-11-18 16:38:23 +0000252#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100253#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
254#endif
255
Janos Follathc44ab972016-11-18 16:38:23 +0000256#if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100257#error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
258#endif
259
Janos Follathc44ab972016-11-18 16:38:23 +0000260#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100261#error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
262#endif
263
Janos Follathc44ab972016-11-18 16:38:23 +0000264#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100265#error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
266#endif
267
Janos Follathc44ab972016-11-18 16:38:23 +0000268#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100269#error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
270#endif
271
Janos Follathc44ab972016-11-18 16:38:23 +0000272#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100273#error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
274#endif
275
Janos Follathc44ab972016-11-18 16:38:23 +0000276#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100277#error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
278#endif
279
Janos Follathc44ab972016-11-18 16:38:23 +0000280#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100281#error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
282#endif
283
Steven Cooremanb5873132021-01-21 13:59:17 +0100284#if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
285#error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled"
286#endif
287
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200288#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
289#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200290#endif
291
Thomas Fossati656864b2016-07-17 08:51:22 +0100292#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
293#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
294#endif
295
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200296#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
297#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200298#endif
299
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200300#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200301 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
302 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200303#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200304#endif
305
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200306#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200307 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
308 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200309#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200310#endif
311
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200312#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
313#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200314#endif
315
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200316#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
317 !defined(MBEDTLS_ECDH_C)
318#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200319#endif
320
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200321#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
322 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
323 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
324#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200325#endif
326
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200327#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
328 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
329 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
330#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200331#endif
332
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200333#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
334 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
335 !defined(MBEDTLS_X509_CRT_PARSE_C) )
336#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200337#endif
338
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200339#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
340 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
341 !defined(MBEDTLS_PKCS1_V15) )
342#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200343#endif
344
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200345#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
346 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
347 !defined(MBEDTLS_PKCS1_V15) )
348#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200349#endif
350
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200351#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
352 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
353 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
354#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
355#endif
356
Gilles Peskineeccd8882020-03-10 12:19:08 +0100357#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
Hanno Beckerfe4ef0c2019-02-26 11:43:09 +0000358 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \
359 ( !defined(MBEDTLS_SHA256_C) && \
360 !defined(MBEDTLS_SHA512_C) && \
361 !defined(MBEDTLS_SHA1_C) )
362#error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C"
363#endif
364
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200365#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
366 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
367#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200368#endif
369
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000370#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800371#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequisites"
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000372#endif
373
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100374#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800375#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequisites"
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100376#endif
377
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200378#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
379#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200380#endif
381
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200382#if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
383#error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200384#endif
385
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200386#if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
387#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200388#endif
389
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200390#if defined(MBEDTLS_PK_C) && \
391 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
392#error "MBEDTLS_PK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000393#endif
394
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200395#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
396#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200397#endif
398
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200399#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
400#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200401#endif
402
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200403#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
404#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200405#endif
406
Manuel Pégourié-Gonnard320f4d92020-02-04 09:17:29 +0100407#if defined(MBEDTLS_PKCS11_C)
408#if defined(MBEDTLS_DEPRECATED_REMOVED)
409#error "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
410#elif defined(MBEDTLS_DEPRECATED_WARNING)
411#warning "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
412#endif
413#endif /* MBEDTLS_PKCS11_C */
414
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200415#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
416#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000417#endif
418
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200419#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
420#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000421#endif
422
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200423#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
424 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
425 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
426#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 +0000427#endif
428
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100429#if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
430 ( !defined(MBEDTLS_PLATFORM_C) ||\
431 !defined(MBEDTLS_HAVE_TIME) )
432#error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
433#endif
434
435#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
436 ( !defined(MBEDTLS_PLATFORM_C) ||\
437 !defined(MBEDTLS_HAVE_TIME) )
438#error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
439#endif
440
441#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
442 ( !defined(MBEDTLS_PLATFORM_C) ||\
443 !defined(MBEDTLS_HAVE_TIME) )
444#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
445#endif
446
447#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
448 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
449 defined(MBEDTLS_PLATFORM_TIME_ALT) )
450#error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
451#endif
452
453#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
454 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
455 defined(MBEDTLS_PLATFORM_TIME_ALT) )
456#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
457#endif
458
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200459#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
460#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000461#endif
462
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200463#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
464#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000465#endif
466
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200467#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
468 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
469 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
470#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 +0000471#endif
472
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200473#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
474 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
475#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000476#endif
477
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200478#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
479 defined(MBEDTLS_PLATFORM_STD_FREE)
480#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000481#endif
482
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200483#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
484#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000485#endif
486
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200487#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200488 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200489#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000490#endif
491
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200492#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
493 defined(MBEDTLS_PLATFORM_STD_CALLOC)
494#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000495#endif
496
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200497#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
498#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000499#endif
500
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200501#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
502#error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000503#endif
504
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200505#if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
506#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000507#endif
508
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200509#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
510#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000511#endif
512
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200513#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
514 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
515 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
516#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 +0000517#endif
518
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200519#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
520#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000521#endif
522
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200523#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
524#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000525#endif
526
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200527#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
528 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
529 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
530#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 +0000531#endif
532
Gilles Peskine9c764bf2022-09-18 14:05:23 +0200533#if defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
534#error "MBEDTLS_PLATFORM_VSNPRINTF_ALT defined, but not all prerequisites"
535#endif
536
537#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
538#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO defined, but not all prerequisites"
539#endif
540
541#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) &&\
542 ( defined(MBEDTLS_PLATFORM_STD_VSNPRINTF) ||\
543 defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) )
544#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_VSNPRINTF/MBEDTLS_PLATFORM_VSNPRINTF_ALT cannot be defined simultaneously"
545#endif
546
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200547#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
548 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
549#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000550#endif
551
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200552#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
553#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000554#endif
555
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200556#if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
557#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000558#endif
559
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200560#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
561 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
562#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000563#endif
564
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100565#if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
566 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
567 !defined(MBEDTLS_HAVE_TIME) )
568#error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
569#endif
570
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200571#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
572 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
573#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000574#endif
575
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200576#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
577 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
578#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000579#endif
580
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200581#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
582 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
583#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000584#endif
585
Paul Bakkercf0a9f92016-06-01 11:25:44 +0100586#if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
587 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
588#error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
589#endif
590
591#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
592 !defined(MBEDTLS_ENTROPY_NV_SEED)
593#error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
594#endif
595
596#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
597 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
598#error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
599#endif
600
601#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
602 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
603#error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
604#endif
605
606#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
607 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
608 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
609#error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
610#endif
611
612#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
613 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
614 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
615#error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
616#endif
617
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100618#if defined(MBEDTLS_PSA_CRYPTO_C) && \
Gilles Peskine82e57d12020-11-13 21:31:17 +0100619 !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100620 defined(MBEDTLS_ENTROPY_C) ) || \
621 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) )
622#error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)"
Jaeden Amero484ee332018-10-25 17:38:05 +0100623#endif
624
Andrzej Kurekc6905232019-02-05 05:23:41 -0500625#if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C)
626#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
627#endif
628
Gilles Peskinea8ade162019-06-26 11:24:49 +0200629#if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \
630 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \
631 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) )
632#error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites"
633#endif
634
Andrzej Kurekc6905232019-02-05 05:23:41 -0500635#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000636 ! defined(MBEDTLS_PSA_CRYPTO_C)
Andrzej Kurekc6905232019-02-05 05:23:41 -0500637#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
638#endif
639
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000640#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
641 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
642 defined(MBEDTLS_ENTROPY_NV_SEED) )
643#error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500644#endif
645
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000646#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
647 !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
648#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources"
649#endif
650
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100651#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
Gilles Peskine89ffb282020-11-18 15:23:08 +0100652 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100653#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG"
654#endif
655
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000656#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
657 !defined(MBEDTLS_FS_IO)
658#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500659#endif
660
Ronald Cronc3623db2020-10-29 10:51:32 +0100661#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
662 defined(MBEDTLS_USE_PSA_CRYPTO)
663#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
664#endif
665
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500666#if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
Andrzej Kurekd08ed952022-01-27 11:03:09 -0500667 !defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_ECDSA_C)
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500668#error "MBEDTLS_PK_C in configuration with MBEDTLS_USE_PSA_CRYPTO and \
Andrzej Kurekd08ed952022-01-27 11:03:09 -0500669 MBEDTLS_ECDSA_C requires MBEDTLS_PK_WRITE_C to be defined."
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500670#endif
671
Gilles Peskine8fb928f2022-10-25 20:24:29 +0200672#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C) && \
673 !( defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PK_WRITE_C) )
674#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 -0500675#endif
676
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200677#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
678 !defined(MBEDTLS_OID_C) )
679#error "MBEDTLS_RSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200680#endif
681
Paul Bakker4fde40f2016-05-09 15:13:04 +0100682#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
Paul Bakker37068a72016-05-09 14:36:33 +0100683 !defined(MBEDTLS_PKCS1_V15) )
684#error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
685#endif
686
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200687#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
688 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
689#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100690#endif
691
Manuel Pégourié-Gonnard1e6fb012020-01-07 11:00:34 +0100692#if defined(MBEDTLS_SHA512_NO_SHA384) && !defined(MBEDTLS_SHA512_C)
693#error "MBEDTLS_SHA512_NO_SHA384 defined without MBEDTLS_SHA512_C"
694#endif
695
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200696#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
697 !defined(MBEDTLS_SHA1_C) )
698#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200699#endif
700
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200701#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
702 !defined(MBEDTLS_SHA1_C) )
703#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200704#endif
705
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200706#if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
707 !defined(MBEDTLS_SHA1_C) )
708#error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200709#endif
710
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200711#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
712 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
713#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200714#endif
715
Hanno Beckerafca47a2020-06-02 07:51:26 +0100716#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) && ( !defined(MBEDTLS_HKDF_C) && \
Hanno Becker6055a172020-06-02 06:20:23 +0100717 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
718#error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites"
719#endif
720
Simon Butcher432e7022019-04-11 18:56:18 +0100721#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
722 defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
723 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
724 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
725 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
726 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
727 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
728 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
729 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
730 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
731 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
732 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
733 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
734#error "One or more versions of the TLS protocol are enabled " \
735 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
736#endif
737
Manuel Pégourié-Gonnard5a8d56d2015-05-13 10:10:00 +0200738#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
739 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
740 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200741#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100742#endif
743
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200744#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
745#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200746#endif
747
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200748#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
749 !defined(MBEDTLS_MD_C) )
750#error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200751#endif
752
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200753#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
754#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200755#endif
756
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200757#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
758 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
759 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
760#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200761#endif
762
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200763#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
764 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200765#error "Illegal protocol selection"
766#endif
767
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200768#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
769 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200770#error "Illegal protocol selection"
771#endif
772
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200773#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
774 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
775 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200776#error "Illegal protocol selection"
777#endif
778
Manuel Pégourié-Gonnarde057d3b2015-05-20 10:59:43 +0200779#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200780#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200781#endif
782
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200783#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
Manuel Pégourié-Gonnardddfe5d22015-09-09 12:46:16 +0200784 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200785#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
786#endif
787
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200788#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
789 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
790#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200791#endif
792
Gilles Peskined3d02902020-03-04 21:35:27 +0100793#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
794 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
795#error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
796#endif
797
798#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
799 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \
800 MBEDTLS_SSL_CID_IN_LEN_MAX > 255
801#error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
802#endif
803
804#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
805 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \
806 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
807#error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
808#endif
809
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200810#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
811 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
812#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200813#endif
814
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200815#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
816 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
817 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
818 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Shaun Case0e7791f2021-12-20 21:14:10 -0800819#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequisites"
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100820#endif
821
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200822#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
823 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
824 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
825 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Shaun Case0e7791f2021-12-20 21:14:10 -0800826#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequisites"
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100827#endif
828
Manuel Pégourié-Gonnard4214e3a2015-05-25 19:34:49 +0200829#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
Manuel Pégourié-Gonnard0c0f11f2015-05-20 09:55:50 +0200830#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200831#endif
832
Przemek Stekiel97d57402022-10-10 14:08:51 +0200833#if defined(MBEDTLS_SSL_TICKET_C) && \
834 !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
835#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
836#endif
837
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200838#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
839 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
840#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100841#endif
842
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200843#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
844 !defined(MBEDTLS_X509_CRT_PARSE_C)
845#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200846#endif
847
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200848#if defined(MBEDTLS_THREADING_PTHREAD)
849#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
850#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200851#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200852#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200853#endif
854
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200855#if defined(MBEDTLS_THREADING_ALT)
856#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
857#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200858#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200859#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200860#endif
861
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200862#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
863#error "MBEDTLS_THREADING_C defined, single threading implementation required"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200864#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200865#undef MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200866
Manuel Pégourié-Gonnardaeefa492018-10-22 12:14:52 +0200867#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C)
868#error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites"
869#endif
870
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200871#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
872#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200873#endif
874
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200875#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
876 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
877 !defined(MBEDTLS_PK_PARSE_C) )
878#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200879#endif
880
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200881#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
882 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
883 !defined(MBEDTLS_PK_WRITE_C) )
884#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200885#endif
886
Simon Butcher432e7022019-04-11 18:56:18 +0100887#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
888#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
889#endif
890
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200891#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
892#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200893#endif
894
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200895#if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
896#error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200897#endif
898
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200899#if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
900#error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200901#endif
902
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200903#if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
904#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200905#endif
906
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200907#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
908#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200909#endif
910
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100911#if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
912#error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
913#endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
914
Andres Amaya Garcia93db11a2017-07-20 12:11:19 +0100915#if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
916 defined(MBEDTLS_HAVE_ASM)
Andres Amaya Garciab39467d2017-07-20 13:21:15 +0100917#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100918#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
919
Andres Amaya Garcia88c2cc72018-11-29 09:56:02 +0000920#if defined(MBEDTLS_SSL_PROTO_SSL3)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000921#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000922#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 +0000923#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000924#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 +0000925#endif
926#endif /* MBEDTLS_SSL_PROTO_SSL3 */
927
Andres Amaya Garcia09634242018-11-29 09:55:41 +0000928#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000929#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000930#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 +0000931#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000932#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 +0000933#endif
934#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
935
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000936#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
937#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000938#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 +0000939#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000940#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 +0000941#endif /* MBEDTLS_DEPRECATED_REMOVED */
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000942#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
943
Ron Eldor3adb9922017-12-21 10:15:08 +0200944#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
945#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
946#endif
947
Andrzej Kurek557289b2020-10-21 15:12:39 +0200948#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
949#error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
950#endif
951
Przemek Stekiel864b43d2022-10-05 11:47:29 +0200952#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) && !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
953#error "MBEDTLS_SSL_CONTEXT_SERIALIZATION defined, but not all prerequisites"
954#endif
955
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200956/*
957 * Avoid warning from -pedantic. This is a convenient place for this
958 * workaround since this is included by every single file before the
Antonin Décimo36e89b52019-01-23 15:24:37 +0100959 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200960 */
961typedef int mbedtls_iso_c_forbids_empty_translation_units;
962
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200963#endif /* MBEDTLS_CHECK_CONFIG_H */