blob: 2ab99823eda983524210bf2007ba543bd897a39c [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_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
73#error "MBEDTLS_AESNI_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_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
77#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020078#endif
79
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020080#if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
81#error "MBEDTLS_DHM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +020082#endif
83
Hanno Beckere89353a2017-11-20 16:36:41 +000084#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
85#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
86#endif
87
Brian Murray53e23b62016-09-13 14:00:15 -070088#if defined(MBEDTLS_CMAC_C) && \
Simon Butcher69283e52016-10-06 12:49:58 +010089 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
Brian Murray53e23b62016-09-13 14:00:15 -070090#error "MBEDTLS_CMAC_C defined, but not all prerequisites"
91#endif
92
Ron Eldor466a57f2018-05-03 16:54:28 +030093#if defined(MBEDTLS_NIST_KW_C) && \
94 ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) )
95#error "MBEDTLS_NIST_KW_C defined, but not all prerequisites"
96#endif
97
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020098#if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
99#error "MBEDTLS_ECDH_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200100#endif
101
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200102#if defined(MBEDTLS_ECDSA_C) && \
103 ( !defined(MBEDTLS_ECP_C) || \
Gilles Peskine799e5762018-09-14 17:34:00 +0200104 !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
105 defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
106 defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
107 defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
108 defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
109 defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
110 defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
111 defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \
112 defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
113 defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
114 defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200115 !defined(MBEDTLS_ASN1_PARSE_C) || \
116 !defined(MBEDTLS_ASN1_WRITE_C) )
117#error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200118#endif
119
Manuel Pégourié-Gonnard4d8685b2015-08-05 15:44:42 +0200120#if defined(MBEDTLS_ECJPAKE_C) && \
121 ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
122#error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
123#endif
124
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200125#if defined(MBEDTLS_ECP_RESTARTABLE) && \
Hanno Becker85fd9132019-02-22 12:50:35 +0000126 ( defined(MBEDTLS_USE_PSA_CRYPTO) || \
Hanno Becker1ce51e42019-02-22 10:25:47 +0000127 defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200128 defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \
129 defined(MBEDTLS_ECDSA_SIGN_ALT) || \
130 defined(MBEDTLS_ECDSA_VERIFY_ALT) || \
131 defined(MBEDTLS_ECDSA_GENKEY_ALT) || \
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500132 defined(MBEDTLS_ECP_INTERNAL_ALT) || \
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200133 defined(MBEDTLS_ECP_ALT) )
Hanno Becker1ce51e42019-02-22 10:25:47 +0000134#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative or PSA-based ECP implementation"
Ron Eldor5ed8c1e2018-11-05 14:04:26 +0200135#endif
136
Gilles Peskine43f564f2019-02-22 12:14:02 +0100137#if defined(MBEDTLS_ECP_RESTARTABLE) && \
138 ! defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
139#error "MBEDTLS_ECP_RESTARTABLE defined, but not MBEDTLS_ECDH_LEGACY_CONTEXT"
140#endif
141
Christoph M. Wintersteiger9c1b56b2019-04-15 11:09:33 +0100142#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) && \
143 defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
144#error "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED defined, but MBEDTLS_ECDH_LEGACY_CONTEXT not disabled"
145#endif
146
Manuel Pégourié-Gonnard3dc7f232022-12-06 13:20:06 +0100147#if defined(MBEDTLS_ECP_RESTARTABLE) && \
148 !defined(MBEDTLS_ECP_C)
149#error "MBEDTLS_ECP_RESTARTABLE defined, but not all prerequisites"
150#endif
151
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200152#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
153#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200154#endif
155
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200156#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200157 !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
158 !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
159 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
160 !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \
161 !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \
162 !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \
163 !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \
164 !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
165 !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
166 !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
k-stachowiak5dbe7ca2019-05-31 20:13:58 +0200167 !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
168 !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
169 !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200170#error "MBEDTLS_ECP_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200171#endif
172
Manuel Pégourié-Gonnard1a3f9ed2020-05-19 12:38:31 +0200173#if defined(MBEDTLS_ECP_C) && !( \
174 defined(MBEDTLS_ECP_ALT) || \
175 defined(MBEDTLS_CTR_DRBG_C) || \
176 defined(MBEDTLS_HMAC_DRBG_C) || \
177 defined(MBEDTLS_ECP_NO_INTERNAL_RNG))
178#error "MBEDTLS_ECP_C requires a DRBG module unless MBEDTLS_ECP_NO_INTERNAL_RNG is defined or an alternative implementation is used"
179#endif
180
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500181#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800182#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500183#endif
184
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100185#if defined(MBEDTLS_PKCS5_C) && !defined(MBEDTLS_MD_C)
Andrzej Kurek293e4522022-04-13 14:28:52 -0400186#error "MBEDTLS_PKCS5_C defined, but not all prerequisites"
Sebastian Bøe9db51a62022-01-19 12:04:35 +0100187#endif
188
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200189#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
190 !defined(MBEDTLS_SHA256_C))
191#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
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) && defined(MBEDTLS_SHA512_C) && \
194 defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
195#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200196#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200197#if defined(MBEDTLS_ENTROPY_C) && \
198 ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
199 && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
200#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200201#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200202#if defined(MBEDTLS_ENTROPY_C) && \
203 defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
204#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200205#endif
206
Manuel Pégourié-Gonnard6240def2020-07-10 09:35:54 +0200207#if defined(__has_feature)
208#if __has_feature(memory_sanitizer)
209#define MBEDTLS_HAS_MEMSAN
210#endif
211#endif
212#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
213#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
214#endif
215#undef MBEDTLS_HAS_MEMSAN
216
Simon Butcherab5df402016-06-11 02:31:21 +0100217#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
218 ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
219#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
Janos Follath53de7842016-06-08 15:29:18 +0100220#endif
Simon Butcherab5df402016-06-11 02:31:21 +0100221#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
222 ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
223 defined(MBEDTLS_HAVEGE_C) )
224#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
Janos Follath53de7842016-06-08 15:29:18 +0100225#endif
226
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200227#if defined(MBEDTLS_CCM_C) && ( \
Gilles Peskinefa21dda2021-09-09 20:39:47 +0200228 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200229#error "MBEDTLS_CCM_C defined, but not all prerequisites"
230#endif
231
232#if defined(MBEDTLS_CCM_C) && !defined(MBEDTLS_CIPHER_C)
233#error "MBEDTLS_CCM_C defined, but not all prerequisites"
234#endif
235
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200236#if defined(MBEDTLS_GCM_C) && ( \
Gilles Peskinefa21dda2021-09-09 20:39:47 +0200237 !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200238#error "MBEDTLS_GCM_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200239#endif
240
Gilles Peskine9130b5b2021-09-02 10:33:57 +0200241#if defined(MBEDTLS_GCM_C) && !defined(MBEDTLS_CIPHER_C)
242#error "MBEDTLS_GCM_C defined, but not all prerequisites"
243#endif
244
245#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_CHACHA20_C)
246#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
247#endif
248
249#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_POLY1305_C)
250#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
251#endif
252
Janos Follathc44ab972016-11-18 16:38:23 +0000253#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100254#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
255#endif
256
Janos Follathc44ab972016-11-18 16:38:23 +0000257#if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100258#error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
259#endif
260
Janos Follathc44ab972016-11-18 16:38:23 +0000261#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100262#error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
263#endif
264
Janos Follathc44ab972016-11-18 16:38:23 +0000265#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100266#error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
267#endif
268
Janos Follathc44ab972016-11-18 16:38:23 +0000269#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100270#error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
271#endif
272
Janos Follathc44ab972016-11-18 16:38:23 +0000273#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100274#error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
275#endif
276
Janos Follathc44ab972016-11-18 16:38:23 +0000277#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100278#error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
279#endif
280
Janos Follathc44ab972016-11-18 16:38:23 +0000281#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
Janos Follathb0697532016-08-18 12:38:46 +0100282#error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
283#endif
284
Steven Cooremanb5873132021-01-21 13:59:17 +0100285#if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
286#error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled"
287#endif
288
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200289#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
290#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200291#endif
292
Thomas Fossati656864b2016-07-17 08:51:22 +0100293#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
294#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
295#endif
296
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200297#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
298#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200299#endif
300
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200301#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200302 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
303 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200304#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200305#endif
306
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200307#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
Gilles Peskine7ab66a62018-09-14 17:47:41 +0200308 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
309 !defined(MBEDTLS_X509_CRT_PARSE_C) )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200310#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_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_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
314#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200315#endif
316
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200317#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \
318 !defined(MBEDTLS_ECDH_C)
319#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200320#endif
321
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200322#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \
323 ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \
324 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
325#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200326#endif
327
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200328#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \
329 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \
330 !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
331#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200332#endif
333
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200334#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
335 ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
336 !defined(MBEDTLS_X509_CRT_PARSE_C) )
337#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200338#endif
339
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200340#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \
341 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
342 !defined(MBEDTLS_PKCS1_V15) )
343#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200344#endif
345
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200346#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
347 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
348 !defined(MBEDTLS_PKCS1_V15) )
349#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200350#endif
351
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200352#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
353 ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
354 !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
355#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
356#endif
357
Gilles Peskineeccd8882020-03-10 12:19:08 +0100358#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
Hanno Beckerfe4ef0c2019-02-26 11:43:09 +0000359 !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \
360 ( !defined(MBEDTLS_SHA256_C) && \
361 !defined(MBEDTLS_SHA512_C) && \
362 !defined(MBEDTLS_SHA1_C) )
363#error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C"
364#endif
365
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200366#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
367 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
368#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200369#endif
370
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000371#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800372#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequisites"
Hanno Beckeraf46c5f2019-02-26 13:50:21 +0000373#endif
374
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100375#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
Shaun Case0e7791f2021-12-20 21:14:10 -0800376#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequisites"
Hanno Beckerbfaa7182019-06-03 16:31:32 +0100377#endif
378
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200379#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
380#error "MBEDTLS_PADLOCK_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_PARSE_C) && !defined(MBEDTLS_BASE64_C)
384#error "MBEDTLS_PEM_PARSE_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_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
388#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200389#endif
390
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200391#if defined(MBEDTLS_PK_C) && \
392 ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
393#error "MBEDTLS_PK_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard94de3312015-01-28 16:32:36 +0000394#endif
395
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200396#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
397#error "MBEDTLS_PK_PARSE_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_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
401#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200402#endif
403
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200404#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
405#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200406#endif
407
Manuel Pégourié-Gonnard320f4d92020-02-04 09:17:29 +0100408#if defined(MBEDTLS_PKCS11_C)
409#if defined(MBEDTLS_DEPRECATED_REMOVED)
410#error "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
411#elif defined(MBEDTLS_DEPRECATED_WARNING)
412#warning "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
413#endif
414#endif /* MBEDTLS_PKCS11_C */
415
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200416#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
417#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000418#endif
419
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200420#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
421#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000422#endif
423
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200424#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
425 ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
426 defined(MBEDTLS_PLATFORM_EXIT_ALT) )
427#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 +0000428#endif
429
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100430#if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
431 ( !defined(MBEDTLS_PLATFORM_C) ||\
432 !defined(MBEDTLS_HAVE_TIME) )
433#error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
434#endif
435
436#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
437 ( !defined(MBEDTLS_PLATFORM_C) ||\
438 !defined(MBEDTLS_HAVE_TIME) )
439#error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
440#endif
441
442#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
443 ( !defined(MBEDTLS_PLATFORM_C) ||\
444 !defined(MBEDTLS_HAVE_TIME) )
445#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
446#endif
447
448#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
449 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
450 defined(MBEDTLS_PLATFORM_TIME_ALT) )
451#error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
452#endif
453
454#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
455 ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
456 defined(MBEDTLS_PLATFORM_TIME_ALT) )
457#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
458#endif
459
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200460#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
461#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000462#endif
463
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200464#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
465#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000466#endif
467
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200468#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
469 ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
470 defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
471#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 +0000472#endif
473
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200474#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
475 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
476#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000477#endif
478
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200479#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
480 defined(MBEDTLS_PLATFORM_STD_FREE)
481#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000482#endif
483
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200484#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
485#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000486#endif
487
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200488#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200489 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200490#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000491#endif
492
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200493#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
494 defined(MBEDTLS_PLATFORM_STD_CALLOC)
495#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
Rich Evans4cc8a222015-02-03 11:26:31 +0000496#endif
497
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200498#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
499#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
Rich Evans16f8cd82015-02-06 16:14:34 +0000500#endif
501
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200502#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
503#error "MBEDTLS_PLATFORM_MEMORY 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_ALT) && !defined(MBEDTLS_PLATFORM_C)
507#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000508#endif
509
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200510#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
511#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000512#endif
513
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200514#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
515 ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
516 defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
517#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 +0000518#endif
519
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200520#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
521#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000522#endif
523
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200524#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
525#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
Rich Evans4cc8a222015-02-03 11:26:31 +0000526#endif
527
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200528#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
529 ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
530 defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
531#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 +0000532#endif
533
Gilles Peskine9c764bf2022-09-18 14:05:23 +0200534#if defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
535#error "MBEDTLS_PLATFORM_VSNPRINTF_ALT defined, but not all prerequisites"
536#endif
537
538#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
539#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO defined, but not all prerequisites"
540#endif
541
542#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) &&\
543 ( defined(MBEDTLS_PLATFORM_STD_VSNPRINTF) ||\
544 defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) )
545#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_VSNPRINTF/MBEDTLS_PLATFORM_VSNPRINTF_ALT cannot be defined simultaneously"
546#endif
547
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200548#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
549 !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
550#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000551#endif
552
Manuel Pégourié-Gonnarda7f80332015-05-27 20:26:40 +0200553#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
554#error "MBEDTLS_PLATFORM_STD_CALLOC 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_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
558#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000559#endif
560
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200561#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
562 !defined(MBEDTLS_PLATFORM_EXIT_ALT)
563#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000564#endif
565
Andres Amaya Garcia1e4ec662016-07-20 10:16:25 +0100566#if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
567 ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
568 !defined(MBEDTLS_HAVE_TIME) )
569#error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
570#endif
571
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200572#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
573 !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
574#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000575#endif
576
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200577#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
578 !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
579#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000580#endif
581
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200582#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
583 !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
584#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
Rich Evansc0b6da32015-02-03 10:58:06 +0000585#endif
586
Paul Bakkercf0a9f92016-06-01 11:25:44 +0100587#if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
588 ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
589#error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
590#endif
591
592#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
593 !defined(MBEDTLS_ENTROPY_NV_SEED)
594#error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
595#endif
596
597#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
598 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
599#error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
600#endif
601
602#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
603 !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
604#error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
605#endif
606
607#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
608 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
609 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
610#error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
611#endif
612
613#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
614 ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
615 defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
616#error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
617#endif
618
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100619#if defined(MBEDTLS_PSA_CRYPTO_C) && \
Gilles Peskine82e57d12020-11-13 21:31:17 +0100620 !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \
Gilles Peskinef08b3f82020-11-13 17:36:48 +0100621 defined(MBEDTLS_ENTROPY_C) ) || \
622 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) )
623#error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)"
Jaeden Amero484ee332018-10-25 17:38:05 +0100624#endif
625
Andrzej Kurekc6905232019-02-05 05:23:41 -0500626#if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C)
627#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
628#endif
629
Gilles Peskinea8ade162019-06-26 11:24:49 +0200630#if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \
631 ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \
632 defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) )
633#error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites"
634#endif
635
Andrzej Kurekc6905232019-02-05 05:23:41 -0500636#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000637 ! defined(MBEDTLS_PSA_CRYPTO_C)
Andrzej Kurekc6905232019-02-05 05:23:41 -0500638#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
639#endif
640
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000641#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
642 !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
643 defined(MBEDTLS_ENTROPY_NV_SEED) )
644#error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500645#endif
646
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000647#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
648 !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
649#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources"
650#endif
651
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100652#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
Gilles Peskine89ffb282020-11-18 15:23:08 +0100653 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
Gilles Peskine4fc21fd2020-11-13 18:47:18 +0100654#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG"
655#endif
656
Jaeden Amero57f4d9e2019-03-15 16:14:19 +0000657#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
658 !defined(MBEDTLS_FS_IO)
659#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
Andrzej Kurekc6905232019-02-05 05:23:41 -0500660#endif
661
Ronald Cronc3623db2020-10-29 10:51:32 +0100662#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
663 defined(MBEDTLS_USE_PSA_CRYPTO)
664#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
665#endif
666
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500667#if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
Andrzej Kurekd08ed952022-01-27 11:03:09 -0500668 !defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_ECDSA_C)
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500669#error "MBEDTLS_PK_C in configuration with MBEDTLS_USE_PSA_CRYPTO and \
Andrzej Kurekd08ed952022-01-27 11:03:09 -0500670 MBEDTLS_ECDSA_C requires MBEDTLS_PK_WRITE_C to be defined."
Andrzej Kurek1faa2a32022-01-27 11:00:24 -0500671#endif
672
Gilles Peskine8fb928f2022-10-25 20:24:29 +0200673#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C) && \
674 !( defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PK_WRITE_C) )
675#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 -0500676#endif
677
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200678#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
679 !defined(MBEDTLS_OID_C) )
680#error "MBEDTLS_RSA_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200681#endif
682
Paul Bakker4fde40f2016-05-09 15:13:04 +0100683#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \
Paul Bakker37068a72016-05-09 14:36:33 +0100684 !defined(MBEDTLS_PKCS1_V15) )
685#error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
686#endif
687
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200688#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \
689 ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
690#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
Manuel Pégourié-Gonnard9df5c962014-01-24 14:37:29 +0100691#endif
692
Manuel Pégourié-Gonnard1e6fb012020-01-07 11:00:34 +0100693#if defined(MBEDTLS_SHA512_NO_SHA384) && !defined(MBEDTLS_SHA512_C)
694#error "MBEDTLS_SHA512_NO_SHA384 defined without MBEDTLS_SHA512_C"
695#endif
696
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200697#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
698 !defined(MBEDTLS_SHA1_C) )
699#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200700#endif
701
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200702#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
703 !defined(MBEDTLS_SHA1_C) )
704#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200705#endif
706
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200707#if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \
708 !defined(MBEDTLS_SHA1_C) )
709#error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200710#endif
711
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200712#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \
713 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
714#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200715#endif
716
Hanno Beckerafca47a2020-06-02 07:51:26 +0100717#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) && ( !defined(MBEDTLS_HKDF_C) && \
Hanno Becker6055a172020-06-02 06:20:23 +0100718 !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
719#error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites"
720#endif
721
Simon Butcher432e7022019-04-11 18:56:18 +0100722#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
723 defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
724 !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
725 defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
726 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
727 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
728 defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
729 defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
730 defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
731 defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
732 defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
733 defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
734 defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
735#error "One or more versions of the TLS protocol are enabled " \
736 "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
737#endif
738
Manuel Pégourié-Gonnard5a8d56d2015-05-13 10:10:00 +0200739#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
740 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
741 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200742#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100743#endif
744
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200745#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
746#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200747#endif
748
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200749#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \
750 !defined(MBEDTLS_MD_C) )
751#error "MBEDTLS_SSL_TLS_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_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
755#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200756#endif
757
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200758#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
759 !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
760 !defined(MBEDTLS_SSL_PROTO_TLS1_2))
761#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200762#endif
763
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200764#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
765 defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200766#error "Illegal protocol selection"
767#endif
768
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200769#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
770 defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200771#error "Illegal protocol selection"
772#endif
773
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200774#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
775 defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
776 !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200777#error "Illegal protocol selection"
778#endif
779
Manuel Pégourié-Gonnarde057d3b2015-05-20 10:59:43 +0200780#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200781#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
Manuel Pégourié-Gonnard82202f02014-07-23 00:28:58 +0200782#endif
783
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200784#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
Manuel Pégourié-Gonnardddfe5d22015-09-09 12:46:16 +0200785 !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
Manuel Pégourié-Gonnard62c74bb2015-09-08 17:50:29 +0200786#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites"
787#endif
788
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200789#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \
790 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
791#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites"
Manuel Pégourié-Gonnard8464a462014-09-24 14:05:32 +0200792#endif
793
Gilles Peskined3d02902020-03-04 21:35:27 +0100794#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
795 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
796#error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites"
797#endif
798
799#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
800 defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \
801 MBEDTLS_SSL_CID_IN_LEN_MAX > 255
802#error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)"
803#endif
804
805#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
806 defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \
807 MBEDTLS_SSL_CID_OUT_LEN_MAX > 255
808#error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)"
809#endif
810
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200811#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \
812 ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
813#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites"
Manuel Pégourié-Gonnardb0643d12014-10-14 18:30:36 +0200814#endif
815
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200816#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \
817 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
818 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
819 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Shaun Case0e7791f2021-12-20 21:14:10 -0800820#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequisites"
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100821#endif
822
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200823#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
824 !defined(MBEDTLS_SSL_PROTO_TLS1) && \
825 !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
826 !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Shaun Case0e7791f2021-12-20 21:14:10 -0800827#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequisites"
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100828#endif
829
Manuel Pégourié-Gonnard4214e3a2015-05-25 19:34:49 +0200830#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
Manuel Pégourié-Gonnard0c0f11f2015-05-20 09:55:50 +0200831#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200832#endif
833
Przemek Stekiel97d57402022-10-10 14:08:51 +0200834#if defined(MBEDTLS_SSL_TICKET_C) && \
835 !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
836#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
837#endif
838
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200839#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
840 !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
841#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
Manuel Pégourié-Gonnardd76314c2015-01-07 12:39:44 +0100842#endif
843
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200844#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
845 !defined(MBEDTLS_X509_CRT_PARSE_C)
846#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200847#endif
848
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200849#if defined(MBEDTLS_THREADING_PTHREAD)
850#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
851#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200852#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200853#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200854#endif
855
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200856#if defined(MBEDTLS_THREADING_ALT)
857#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
858#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200859#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200860#define MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200861#endif
862
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200863#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
864#error "MBEDTLS_THREADING_C defined, single threading implementation required"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200865#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200866#undef MBEDTLS_THREADING_IMPL
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200867
Manuel Pégourié-Gonnardaeefa492018-10-22 12:14:52 +0200868#if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C)
869#error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites"
870#endif
871
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200872#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
873#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200874#endif
875
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200876#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
877 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \
878 !defined(MBEDTLS_PK_PARSE_C) )
879#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200880#endif
881
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200882#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
883 !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \
884 !defined(MBEDTLS_PK_WRITE_C) )
885#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200886#endif
887
Simon Butcher432e7022019-04-11 18:56:18 +0100888#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
889#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
890#endif
891
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200892#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
893#error "MBEDTLS_X509_CRT_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_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
897#error "MBEDTLS_X509_CRL_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_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
901#error "MBEDTLS_X509_CSR_PARSE_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_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
905#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200906#endif
907
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200908#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
909#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
Manuel Pégourié-Gonnard14d55952014-04-30 12:35:08 +0200910#endif
911
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100912#if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
913#error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
914#endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
915
Andres Amaya Garcia93db11a2017-07-20 12:11:19 +0100916#if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
917 defined(MBEDTLS_HAVE_ASM)
Andres Amaya Garciab39467d2017-07-20 13:21:15 +0100918#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
Andres Amaya Garciad7fce002017-07-20 11:49:32 +0100919#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
920
Andres Amaya Garcia88c2cc72018-11-29 09:56:02 +0000921#if defined(MBEDTLS_SSL_PROTO_SSL3)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000922#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000923#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 +0000924#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000925#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 +0000926#endif
927#endif /* MBEDTLS_SSL_PROTO_SSL3 */
928
Andres Amaya Garcia09634242018-11-29 09:55:41 +0000929#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
Andres Amaya Garciae58532e2018-12-05 20:29:07 +0000930#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000931#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 +0000932#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garcia835b2992019-01-15 19:36:00 +0000933#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 +0000934#endif
935#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
936
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000937#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
938#if defined(MBEDTLS_DEPRECATED_REMOVED)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000939#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 +0000940#elif defined(MBEDTLS_DEPRECATED_WARNING)
Andres Amaya Garciada154092019-01-15 18:43:48 +0000941#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 +0000942#endif /* MBEDTLS_DEPRECATED_REMOVED */
Andres Amaya Garcia84b4e792018-12-05 22:39:38 +0000943#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
944
Ron Eldor3adb9922017-12-21 10:15:08 +0200945#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
946#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
947#endif
948
Andrzej Kurek557289b2020-10-21 15:12:39 +0200949#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
950#error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
951#endif
952
Przemek Stekiel864b43d2022-10-05 11:47:29 +0200953#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) && !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
954#error "MBEDTLS_SSL_CONTEXT_SERIALIZATION defined, but not all prerequisites"
955#endif
956
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200957/*
958 * Avoid warning from -pedantic. This is a convenient place for this
959 * workaround since this is included by every single file before the
Antonin Décimo36e89b52019-01-23 15:24:37 +0100960 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200961 */
962typedef int mbedtls_iso_c_forbids_empty_translation_units;
963
David Horstmannd2c83be2022-11-14 15:40:46 +0000964/* *INDENT-ON* */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200965#endif /* MBEDTLS_CHECK_CONFIG_H */