Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 1 | /** |
| 2 | * \file check_config.h |
| 3 | * |
| 4 | * \brief Consistency checks for configuration options |
Darryl Green | a40a101 | 2018-01-05 15:33:17 +0000 | [diff] [blame] | 5 | */ |
| 6 | /* |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 7 | * Copyright The Mbed TLS Contributors |
Manuel Pégourié-Gonnard | 37ff140 | 2015-09-04 14:21:07 +0200 | [diff] [blame] | 8 | * 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é-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 21 | */ |
| 22 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 23 | #ifndef MBEDTLS_CHECK_CONFIG_H |
| 24 | #define MBEDTLS_CHECK_CONFIG_H |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 25 | |
Manuel Pégourié-Gonnard | d14acbc | 2015-05-29 11:26:37 +0200 | [diff] [blame] | 26 | /* |
| 27 | * We assume CHAR_BIT is 8 in many places. In practice, this is true on our |
| 28 | * target platforms, so not an issue, but let's just be extra sure. |
| 29 | */ |
| 30 | #include <limits.h> |
| 31 | #if CHAR_BIT != 8 |
| 32 | #error "mbed TLS requires a platform with 8-bit chars" |
| 33 | #endif |
| 34 | |
Manuel Pégourié-Gonnard | 9db2887 | 2015-06-26 10:52:01 +0200 | [diff] [blame] | 35 | #if defined(_WIN32) |
| 36 | #if !defined(MBEDTLS_PLATFORM_C) |
Manuel Pégourié-Gonnard | 6c0c8e0 | 2015-06-22 10:23:34 +0200 | [diff] [blame] | 37 | #error "MBEDTLS_PLATFORM_C is required on Windows" |
| 38 | #endif |
| 39 | |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 40 | /* Fix the config here. Not convenient to put an #ifdef _WIN32 in mbedtls_config.h as |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 41 | * it would confuse config.py. */ |
Manuel Pégourié-Gonnard | 9db2887 | 2015-06-26 10:52:01 +0200 | [diff] [blame] | 42 | #if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \ |
| 43 | !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) |
| 44 | #define MBEDTLS_PLATFORM_SNPRINTF_ALT |
| 45 | #endif |
k-stachowiak | 6b5ef48 | 2019-01-07 16:53:29 +0100 | [diff] [blame] | 46 | |
| 47 | #if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \ |
| 48 | !defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) |
| 49 | #define MBEDTLS_PLATFORM_VSNPRINTF_ALT |
| 50 | #endif |
Manuel Pégourié-Gonnard | 9db2887 | 2015-06-26 10:52:01 +0200 | [diff] [blame] | 51 | #endif /* _WIN32 */ |
| 52 | |
Jaeden Amero | 197496a | 2021-06-08 18:31:27 +0100 | [diff] [blame] | 53 | #if defined(TARGET_LIKE_MBED) && defined(MBEDTLS_NET_C) |
| 54 | #error "The NET module is not available for mbed OS - please use the network functions provided by Mbed OS" |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 55 | #endif |
| 56 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 57 | #if defined(MBEDTLS_DEPRECATED_WARNING) && \ |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 58 | !defined(__GNUC__) && !defined(__clang__) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 59 | #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang" |
Manuel Pégourié-Gonnard | c70581c | 2015-03-23 13:58:27 +0100 | [diff] [blame] | 60 | #endif |
| 61 | |
Manuel Pégourié-Gonnard | 60c793b | 2015-06-18 20:52:58 +0200 | [diff] [blame] | 62 | #if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME) |
| 63 | #error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense" |
| 64 | #endif |
| 65 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 66 | #if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM) |
| 67 | #error "MBEDTLS_AESNI_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 68 | #endif |
| 69 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 70 | #if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C) |
| 71 | #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 72 | #endif |
| 73 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 74 | #if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C) |
| 75 | #error "MBEDTLS_DHM_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 76 | #endif |
| 77 | |
Brian Murray | 53e23b6 | 2016-09-13 14:00:15 -0700 | [diff] [blame] | 78 | #if defined(MBEDTLS_CMAC_C) && \ |
Simon Butcher | 69283e5 | 2016-10-06 12:49:58 +0100 | [diff] [blame] | 79 | !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C) |
Brian Murray | 53e23b6 | 2016-09-13 14:00:15 -0700 | [diff] [blame] | 80 | #error "MBEDTLS_CMAC_C defined, but not all prerequisites" |
| 81 | #endif |
| 82 | |
Ron Eldor | 466a57f | 2018-05-03 16:54:28 +0300 | [diff] [blame] | 83 | #if defined(MBEDTLS_NIST_KW_C) && \ |
| 84 | ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) ) |
| 85 | #error "MBEDTLS_NIST_KW_C defined, but not all prerequisites" |
| 86 | #endif |
| 87 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 88 | #if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C) |
| 89 | #error "MBEDTLS_ECDH_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 90 | #endif |
| 91 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 92 | #if defined(MBEDTLS_ECDSA_C) && \ |
| 93 | ( !defined(MBEDTLS_ECP_C) || \ |
Gilles Peskine | 799e576 | 2018-09-14 17:34:00 +0200 | [diff] [blame] | 94 | !( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \ |
| 95 | defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \ |
| 96 | defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \ |
| 97 | defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \ |
| 98 | defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \ |
| 99 | defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \ |
| 100 | defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \ |
| 101 | defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) || \ |
| 102 | defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \ |
| 103 | defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \ |
| 104 | defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) ) || \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 105 | !defined(MBEDTLS_ASN1_PARSE_C) || \ |
| 106 | !defined(MBEDTLS_ASN1_WRITE_C) ) |
| 107 | #error "MBEDTLS_ECDSA_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 108 | #endif |
| 109 | |
Manuel Pégourié-Gonnard | 4d8685b | 2015-08-05 15:44:42 +0200 | [diff] [blame] | 110 | #if defined(MBEDTLS_ECJPAKE_C) && \ |
| 111 | ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) ) |
| 112 | #error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites" |
| 113 | #endif |
| 114 | |
Ron Eldor | 5ed8c1e | 2018-11-05 14:04:26 +0200 | [diff] [blame] | 115 | #if defined(MBEDTLS_ECP_RESTARTABLE) && \ |
Hanno Becker | 85fd913 | 2019-02-22 12:50:35 +0000 | [diff] [blame] | 116 | ( defined(MBEDTLS_USE_PSA_CRYPTO) || \ |
Hanno Becker | 1ce51e4 | 2019-02-22 10:25:47 +0000 | [diff] [blame] | 117 | defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \ |
Ron Eldor | 5ed8c1e | 2018-11-05 14:04:26 +0200 | [diff] [blame] | 118 | defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \ |
| 119 | defined(MBEDTLS_ECDSA_SIGN_ALT) || \ |
| 120 | defined(MBEDTLS_ECDSA_VERIFY_ALT) || \ |
| 121 | defined(MBEDTLS_ECDSA_GENKEY_ALT) || \ |
Andrzej Kurek | c470b6b | 2019-01-31 08:20:20 -0500 | [diff] [blame] | 122 | defined(MBEDTLS_ECP_INTERNAL_ALT) || \ |
Ron Eldor | 5ed8c1e | 2018-11-05 14:04:26 +0200 | [diff] [blame] | 123 | defined(MBEDTLS_ECP_ALT) ) |
Hanno Becker | 1ce51e4 | 2019-02-22 10:25:47 +0000 | [diff] [blame] | 124 | #error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative or PSA-based ECP implementation" |
Ron Eldor | 5ed8c1e | 2018-11-05 14:04:26 +0200 | [diff] [blame] | 125 | #endif |
| 126 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 127 | #if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C) |
| 128 | #error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 129 | #endif |
| 130 | |
k-stachowiak | 5dbe7ca | 2019-05-31 20:13:58 +0200 | [diff] [blame] | 131 | #if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 132 | !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \ |
| 133 | !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \ |
| 134 | !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \ |
| 135 | !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \ |
| 136 | !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \ |
| 137 | !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \ |
| 138 | !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \ |
| 139 | !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \ |
| 140 | !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \ |
| 141 | !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \ |
k-stachowiak | 5dbe7ca | 2019-05-31 20:13:58 +0200 | [diff] [blame] | 142 | !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \ |
| 143 | !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \ |
| 144 | !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 145 | #error "MBEDTLS_ECP_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 146 | #endif |
| 147 | |
Andrzej Kurek | c470b6b | 2019-01-31 08:20:20 -0500 | [diff] [blame] | 148 | #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C) |
| 149 | #error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites" |
| 150 | #endif |
| 151 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 152 | #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \ |
| 153 | !defined(MBEDTLS_SHA256_C)) |
| 154 | #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 155 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 156 | #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \ |
| 157 | defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64) |
| 158 | #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 159 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 160 | #if defined(MBEDTLS_ENTROPY_C) && \ |
| 161 | ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \ |
| 162 | && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32) |
| 163 | #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 164 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 165 | #if defined(MBEDTLS_ENTROPY_C) && \ |
| 166 | defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C) |
| 167 | #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 168 | #endif |
| 169 | |
Manuel Pégourié-Gonnard | 6240def | 2020-07-10 09:35:54 +0200 | [diff] [blame] | 170 | #if defined(__has_feature) |
| 171 | #if __has_feature(memory_sanitizer) |
| 172 | #define MBEDTLS_HAS_MEMSAN |
| 173 | #endif |
| 174 | #endif |
| 175 | #if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN) |
| 176 | #error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer" |
| 177 | #endif |
| 178 | #undef MBEDTLS_HAS_MEMSAN |
| 179 | |
Gilles Peskine | 1984800 | 2021-09-02 10:33:57 +0200 | [diff] [blame] | 180 | #if defined(MBEDTLS_CCM_C) && ( \ |
Gilles Peskine | 104f6de | 2021-09-09 20:39:47 +0200 | [diff] [blame^] | 181 | !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) ) |
Gilles Peskine | 1984800 | 2021-09-02 10:33:57 +0200 | [diff] [blame] | 182 | #error "MBEDTLS_CCM_C defined, but not all prerequisites" |
| 183 | #endif |
| 184 | |
| 185 | #if defined(MBEDTLS_CCM_C) && !defined(MBEDTLS_CIPHER_C) |
| 186 | #error "MBEDTLS_CCM_C defined, but not all prerequisites" |
| 187 | #endif |
| 188 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 189 | #if defined(MBEDTLS_GCM_C) && ( \ |
Gilles Peskine | 104f6de | 2021-09-09 20:39:47 +0200 | [diff] [blame^] | 190 | !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 191 | #error "MBEDTLS_GCM_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 192 | #endif |
| 193 | |
Gilles Peskine | 1984800 | 2021-09-02 10:33:57 +0200 | [diff] [blame] | 194 | #if defined(MBEDTLS_GCM_C) && !defined(MBEDTLS_CIPHER_C) |
| 195 | #error "MBEDTLS_GCM_C defined, but not all prerequisites" |
| 196 | #endif |
| 197 | |
| 198 | #if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_CHACHA20_C) |
| 199 | #error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites" |
| 200 | #endif |
| 201 | |
| 202 | #if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_POLY1305_C) |
| 203 | #error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites" |
| 204 | #endif |
| 205 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 206 | #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 207 | #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites" |
| 208 | #endif |
| 209 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 210 | #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 211 | #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites" |
| 212 | #endif |
| 213 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 214 | #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 215 | #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites" |
| 216 | #endif |
| 217 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 218 | #if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 219 | #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites" |
| 220 | #endif |
| 221 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 222 | #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 223 | #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites" |
| 224 | #endif |
| 225 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 226 | #if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 227 | #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites" |
| 228 | #endif |
| 229 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 230 | #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 231 | #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites" |
| 232 | #endif |
| 233 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 234 | #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 235 | #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites" |
| 236 | #endif |
| 237 | |
Steven Cooreman | b587313 | 2021-01-21 13:59:17 +0100 | [diff] [blame] | 238 | #if defined(MBEDTLS_ECP_NO_FALLBACK) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
| 239 | #error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled" |
| 240 | #endif |
| 241 | |
Thomas Fossati | 656864b | 2016-07-17 08:51:22 +0100 | [diff] [blame] | 242 | #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C) |
| 243 | #error "MBEDTLS_HKDF_C defined, but not all prerequisites" |
| 244 | #endif |
| 245 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 246 | #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C) |
| 247 | #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 248 | #endif |
| 249 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 250 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \ |
Gilles Peskine | 7ab66a6 | 2018-09-14 17:47:41 +0200 | [diff] [blame] | 251 | ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \ |
| 252 | !defined(MBEDTLS_X509_CRT_PARSE_C) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 253 | #error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 254 | #endif |
| 255 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 256 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \ |
Gilles Peskine | 7ab66a6 | 2018-09-14 17:47:41 +0200 | [diff] [blame] | 257 | ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \ |
| 258 | !defined(MBEDTLS_X509_CRT_PARSE_C) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 259 | #error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 260 | #endif |
| 261 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 262 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C) |
| 263 | #error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 264 | #endif |
| 265 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 266 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \ |
| 267 | !defined(MBEDTLS_ECDH_C) |
| 268 | #error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 269 | #endif |
| 270 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 271 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \ |
| 272 | ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \ |
| 273 | !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) ) |
| 274 | #error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 275 | #endif |
| 276 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 277 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \ |
| 278 | ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) || \ |
| 279 | !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) ) |
| 280 | #error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 281 | #endif |
| 282 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 283 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \ |
| 284 | ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \ |
| 285 | !defined(MBEDTLS_X509_CRT_PARSE_C) ) |
| 286 | #error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 287 | #endif |
| 288 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 289 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \ |
| 290 | ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \ |
| 291 | !defined(MBEDTLS_PKCS1_V15) ) |
| 292 | #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 293 | #endif |
| 294 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 295 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \ |
| 296 | ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \ |
| 297 | !defined(MBEDTLS_PKCS1_V15) ) |
| 298 | #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 299 | #endif |
| 300 | |
Manuel Pégourié-Gonnard | 557535d | 2015-09-15 17:53:32 +0200 | [diff] [blame] | 301 | #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \ |
| 302 | ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \ |
| 303 | !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) ) |
| 304 | #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites" |
| 305 | #endif |
| 306 | |
Gilles Peskine | eccd888 | 2020-03-10 12:19:08 +0100 | [diff] [blame] | 307 | #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \ |
Hanno Becker | fe4ef0c | 2019-02-26 11:43:09 +0000 | [diff] [blame] | 308 | !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \ |
| 309 | ( !defined(MBEDTLS_SHA256_C) && \ |
| 310 | !defined(MBEDTLS_SHA512_C) && \ |
| 311 | !defined(MBEDTLS_SHA1_C) ) |
| 312 | #error "!MBEDTLS_SSL_KEEP_PEER_CERTIFICATE requires MBEDTLS_SHA512_C, MBEDTLS_SHA256_C or MBEDTLS_SHA1_C" |
| 313 | #endif |
| 314 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 315 | #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \ |
| 316 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) |
| 317 | #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 318 | #endif |
| 319 | |
Hanno Becker | af46c5f | 2019-02-26 13:50:21 +0000 | [diff] [blame] | 320 | #if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) |
| 321 | #error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites" |
| 322 | #endif |
| 323 | |
Hanno Becker | bfaa718 | 2019-06-03 16:31:32 +0100 | [diff] [blame] | 324 | #if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) |
| 325 | #error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites" |
| 326 | #endif |
| 327 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 328 | #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM) |
| 329 | #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 330 | #endif |
| 331 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 332 | #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C) |
| 333 | #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 334 | #endif |
| 335 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 336 | #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C) |
| 337 | #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 338 | #endif |
| 339 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 340 | #if defined(MBEDTLS_PK_C) && \ |
| 341 | ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) ) |
| 342 | #error "MBEDTLS_PK_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 94de331 | 2015-01-28 16:32:36 +0000 | [diff] [blame] | 343 | #endif |
| 344 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 345 | #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C) |
| 346 | #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 347 | #endif |
| 348 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 349 | #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C) |
| 350 | #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 351 | #endif |
| 352 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 353 | #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 354 | #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 355 | #endif |
| 356 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 357 | #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 358 | #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 359 | #endif |
| 360 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 361 | #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\ |
| 362 | ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\ |
| 363 | defined(MBEDTLS_PLATFORM_EXIT_ALT) ) |
| 364 | #error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 365 | #endif |
| 366 | |
Andres Amaya Garcia | 1e4ec66 | 2016-07-20 10:16:25 +0100 | [diff] [blame] | 367 | #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\ |
| 368 | ( !defined(MBEDTLS_PLATFORM_C) ||\ |
| 369 | !defined(MBEDTLS_HAVE_TIME) ) |
| 370 | #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites" |
| 371 | #endif |
| 372 | |
| 373 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\ |
| 374 | ( !defined(MBEDTLS_PLATFORM_C) ||\ |
| 375 | !defined(MBEDTLS_HAVE_TIME) ) |
| 376 | #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites" |
| 377 | #endif |
| 378 | |
| 379 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\ |
| 380 | ( !defined(MBEDTLS_PLATFORM_C) ||\ |
| 381 | !defined(MBEDTLS_HAVE_TIME) ) |
| 382 | #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites" |
| 383 | #endif |
| 384 | |
| 385 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\ |
| 386 | ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\ |
| 387 | defined(MBEDTLS_PLATFORM_TIME_ALT) ) |
| 388 | #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously" |
| 389 | #endif |
| 390 | |
| 391 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\ |
| 392 | ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\ |
| 393 | defined(MBEDTLS_PLATFORM_TIME_ALT) ) |
| 394 | #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously" |
| 395 | #endif |
| 396 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 397 | #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 398 | #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 399 | #endif |
| 400 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 401 | #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 402 | #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 403 | #endif |
| 404 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 405 | #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\ |
| 406 | ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\ |
| 407 | defined(MBEDTLS_PLATFORM_FPRINTF_ALT) ) |
| 408 | #error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 409 | #endif |
| 410 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 411 | #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\ |
| 412 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) |
| 413 | #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 414 | #endif |
| 415 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 416 | #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\ |
| 417 | defined(MBEDTLS_PLATFORM_STD_FREE) |
| 418 | #error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 419 | #endif |
| 420 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 421 | #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO) |
| 422 | #error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is" |
Rich Evans | 16f8cd8 | 2015-02-06 16:14:34 +0000 | [diff] [blame] | 423 | #endif |
| 424 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 425 | #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 426 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 427 | #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 428 | #endif |
| 429 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 430 | #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\ |
| 431 | defined(MBEDTLS_PLATFORM_STD_CALLOC) |
| 432 | #error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 433 | #endif |
| 434 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 435 | #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO) |
| 436 | #error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is" |
Rich Evans | 16f8cd8 | 2015-02-06 16:14:34 +0000 | [diff] [blame] | 437 | #endif |
| 438 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 439 | #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C) |
| 440 | #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 441 | #endif |
| 442 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 443 | #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 444 | #error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 445 | #endif |
| 446 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 447 | #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 448 | #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 449 | #endif |
| 450 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 451 | #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\ |
| 452 | ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\ |
| 453 | defined(MBEDTLS_PLATFORM_PRINTF_ALT) ) |
| 454 | #error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 455 | #endif |
| 456 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 457 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 458 | #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 459 | #endif |
| 460 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 461 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 462 | #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 463 | #endif |
| 464 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 465 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\ |
| 466 | ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\ |
| 467 | defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) ) |
| 468 | #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 469 | #endif |
| 470 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 471 | #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\ |
| 472 | !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) |
| 473 | #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 474 | #endif |
| 475 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 476 | #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY) |
| 477 | #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 478 | #endif |
| 479 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 480 | #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY) |
| 481 | #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 482 | #endif |
| 483 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 484 | #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\ |
| 485 | !defined(MBEDTLS_PLATFORM_EXIT_ALT) |
| 486 | #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 487 | #endif |
| 488 | |
Andres Amaya Garcia | 1e4ec66 | 2016-07-20 10:16:25 +0100 | [diff] [blame] | 489 | #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\ |
| 490 | ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\ |
| 491 | !defined(MBEDTLS_HAVE_TIME) ) |
| 492 | #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites" |
| 493 | #endif |
| 494 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 495 | #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\ |
| 496 | !defined(MBEDTLS_PLATFORM_FPRINTF_ALT) |
| 497 | #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 498 | #endif |
| 499 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 500 | #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\ |
| 501 | !defined(MBEDTLS_PLATFORM_PRINTF_ALT) |
| 502 | #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 503 | #endif |
| 504 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 505 | #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\ |
| 506 | !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) |
| 507 | #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 508 | #endif |
| 509 | |
Paul Bakker | cf0a9f9 | 2016-06-01 11:25:44 +0100 | [diff] [blame] | 510 | #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\ |
| 511 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) ) |
| 512 | #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites" |
| 513 | #endif |
| 514 | |
| 515 | #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\ |
| 516 | !defined(MBEDTLS_ENTROPY_NV_SEED) |
| 517 | #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites" |
| 518 | #endif |
| 519 | |
| 520 | #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\ |
| 521 | !defined(MBEDTLS_PLATFORM_NV_SEED_ALT) |
| 522 | #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites" |
| 523 | #endif |
| 524 | |
| 525 | #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\ |
| 526 | !defined(MBEDTLS_PLATFORM_NV_SEED_ALT) |
| 527 | #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites" |
| 528 | #endif |
| 529 | |
| 530 | #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\ |
| 531 | ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\ |
| 532 | defined(MBEDTLS_PLATFORM_NV_SEED_ALT) ) |
| 533 | #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously" |
| 534 | #endif |
| 535 | |
| 536 | #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\ |
| 537 | ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\ |
| 538 | defined(MBEDTLS_PLATFORM_NV_SEED_ALT) ) |
| 539 | #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously" |
| 540 | #endif |
| 541 | |
Gilles Peskine | f08b3f8 | 2020-11-13 17:36:48 +0100 | [diff] [blame] | 542 | #if defined(MBEDTLS_PSA_CRYPTO_C) && \ |
Gilles Peskine | 82e57d1 | 2020-11-13 21:31:17 +0100 | [diff] [blame] | 543 | !( ( ( defined(MBEDTLS_CTR_DRBG_C) || defined(MBEDTLS_HMAC_DRBG_C) ) && \ |
Gilles Peskine | f08b3f8 | 2020-11-13 17:36:48 +0100 | [diff] [blame] | 544 | defined(MBEDTLS_ENTROPY_C) ) || \ |
| 545 | defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) ) |
| 546 | #error "MBEDTLS_PSA_CRYPTO_C defined, but not all prerequisites (missing RNG)" |
Jaeden Amero | 484ee33 | 2018-10-25 17:38:05 +0100 | [diff] [blame] | 547 | #endif |
| 548 | |
Andrzej Kurek | c690523 | 2019-02-05 05:23:41 -0500 | [diff] [blame] | 549 | #if defined(MBEDTLS_PSA_CRYPTO_SPM) && !defined(MBEDTLS_PSA_CRYPTO_C) |
| 550 | #error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites" |
| 551 | #endif |
| 552 | |
Gilles Peskine | a8ade16 | 2019-06-26 11:24:49 +0200 | [diff] [blame] | 553 | #if defined(MBEDTLS_PSA_CRYPTO_SE_C) && \ |
| 554 | ! ( defined(MBEDTLS_PSA_CRYPTO_C) && \ |
| 555 | defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) ) |
| 556 | #error "MBEDTLS_PSA_CRYPTO_SE_C defined, but not all prerequisites" |
| 557 | #endif |
| 558 | |
Andrzej Kurek | c690523 | 2019-02-05 05:23:41 -0500 | [diff] [blame] | 559 | #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \ |
Jaeden Amero | 57f4d9e | 2019-03-15 16:14:19 +0000 | [diff] [blame] | 560 | ! defined(MBEDTLS_PSA_CRYPTO_C) |
Andrzej Kurek | c690523 | 2019-02-05 05:23:41 -0500 | [diff] [blame] | 561 | #error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites" |
| 562 | #endif |
| 563 | |
Jaeden Amero | 57f4d9e | 2019-03-15 16:14:19 +0000 | [diff] [blame] | 564 | #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \ |
| 565 | !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \ |
| 566 | defined(MBEDTLS_ENTROPY_NV_SEED) ) |
| 567 | #error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites" |
Andrzej Kurek | c690523 | 2019-02-05 05:23:41 -0500 | [diff] [blame] | 568 | #endif |
| 569 | |
Jaeden Amero | 57f4d9e | 2019-03-15 16:14:19 +0000 | [diff] [blame] | 570 | #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \ |
| 571 | !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) |
| 572 | #error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources" |
| 573 | #endif |
| 574 | |
Gilles Peskine | 4fc21fd | 2020-11-13 18:47:18 +0100 | [diff] [blame] | 575 | #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \ |
Gilles Peskine | 89ffb28 | 2020-11-18 15:23:08 +0100 | [diff] [blame] | 576 | defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) |
Gilles Peskine | 4fc21fd | 2020-11-13 18:47:18 +0100 | [diff] [blame] | 577 | #error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG" |
| 578 | #endif |
| 579 | |
Jaeden Amero | 57f4d9e | 2019-03-15 16:14:19 +0000 | [diff] [blame] | 580 | #if defined(MBEDTLS_PSA_ITS_FILE_C) && \ |
| 581 | !defined(MBEDTLS_FS_IO) |
| 582 | #error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites" |
Andrzej Kurek | c690523 | 2019-02-05 05:23:41 -0500 | [diff] [blame] | 583 | #endif |
| 584 | |
Ronald Cron | c3623db | 2020-10-29 10:51:32 +0100 | [diff] [blame] | 585 | #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \ |
| 586 | defined(MBEDTLS_USE_PSA_CRYPTO) |
| 587 | #error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO." |
| 588 | #endif |
| 589 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 590 | #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ |
| 591 | !defined(MBEDTLS_OID_C) ) |
| 592 | #error "MBEDTLS_RSA_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 593 | #endif |
| 594 | |
Paul Bakker | 4fde40f | 2016-05-09 15:13:04 +0100 | [diff] [blame] | 595 | #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \ |
Paul Bakker | 37068a7 | 2016-05-09 14:36:33 +0100 | [diff] [blame] | 596 | !defined(MBEDTLS_PKCS1_V15) ) |
| 597 | #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled" |
| 598 | #endif |
| 599 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 600 | #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \ |
| 601 | ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) ) |
| 602 | #error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 9df5c96 | 2014-01-24 14:37:29 +0100 | [diff] [blame] | 603 | #endif |
| 604 | |
Mateusz Starzyk | 3352a53 | 2021-04-06 14:28:22 +0200 | [diff] [blame] | 605 | #if defined(MBEDTLS_SHA384_C) && !defined(MBEDTLS_SHA512_C) |
| 606 | #error "MBEDTLS_SHA384_C defined without MBEDTLS_SHA512_C" |
Manuel Pégourié-Gonnard | 1e6fb01 | 2020-01-07 11:00:34 +0100 | [diff] [blame] | 607 | #endif |
| 608 | |
Mateusz Starzyk | e3c48b4 | 2021-04-19 16:46:28 +0200 | [diff] [blame] | 609 | #if defined(MBEDTLS_SHA224_C) && !defined(MBEDTLS_SHA256_C) |
| 610 | #error "MBEDTLS_SHA224_C defined without MBEDTLS_SHA256_C" |
| 611 | #endif |
| 612 | |
| 613 | #if defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA224_C) |
| 614 | #error "MBEDTLS_SHA256_C defined without MBEDTLS_SHA224_C" |
| 615 | #endif |
| 616 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 617 | #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \ |
| 618 | !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) ) |
| 619 | #error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 620 | #endif |
| 621 | |
Hanno Becker | afca47a | 2020-06-02 07:51:26 +0100 | [diff] [blame] | 622 | #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) && ( !defined(MBEDTLS_HKDF_C) && \ |
Hanno Becker | 6055a17 | 2020-06-02 06:20:23 +0100 | [diff] [blame] | 623 | !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) ) |
| 624 | #error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites" |
| 625 | #endif |
| 626 | |
TRodziewicz | 0f82ec6 | 2021-05-12 17:49:18 +0200 | [diff] [blame] | 627 | #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ |
Simon Butcher | 432e702 | 2019-04-11 18:56:18 +0100 | [diff] [blame] | 628 | !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ |
| 629 | defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ |
| 630 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ |
| 631 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ |
| 632 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ |
| 633 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \ |
| 634 | defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ |
| 635 | defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \ |
| 636 | defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \ |
| 637 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ |
| 638 | defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) ) |
| 639 | #error "One or more versions of the TLS protocol are enabled " \ |
| 640 | "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx" |
| 641 | #endif |
| 642 | |
Manuel Pégourié-Gonnard | 5a8d56d | 2015-05-13 10:10:00 +0200 | [diff] [blame] | 643 | #if defined(MBEDTLS_SSL_PROTO_DTLS) && \ |
Manuel Pégourié-Gonnard | 5a8d56d | 2015-05-13 10:10:00 +0200 | [diff] [blame] | 644 | !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 645 | #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 0b1ff29 | 2014-02-06 13:04:16 +0100 | [diff] [blame] | 646 | #endif |
| 647 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 648 | #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C) |
| 649 | #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 650 | #endif |
| 651 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 652 | #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \ |
| 653 | !defined(MBEDTLS_MD_C) ) |
| 654 | #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 655 | #endif |
| 656 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 657 | #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C) |
| 658 | #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 659 | #endif |
| 660 | |
TRodziewicz | 0f82ec6 | 2021-05-12 17:49:18 +0200 | [diff] [blame] | 661 | #if defined(MBEDTLS_SSL_TLS_C) && !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 662 | #error "MBEDTLS_SSL_TLS_C defined, but no protocols are active" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 663 | #endif |
| 664 | |
Manuel Pégourié-Gonnard | e057d3b | 2015-05-20 10:59:43 +0200 | [diff] [blame] | 665 | #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 666 | #error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 82202f0 | 2014-07-23 00:28:58 +0200 | [diff] [blame] | 667 | #endif |
| 668 | |
Manuel Pégourié-Gonnard | 62c74bb | 2015-09-08 17:50:29 +0200 | [diff] [blame] | 669 | #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \ |
Manuel Pégourié-Gonnard | ddfe5d2 | 2015-09-09 12:46:16 +0200 | [diff] [blame] | 670 | !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) |
Manuel Pégourié-Gonnard | 62c74bb | 2015-09-08 17:50:29 +0200 | [diff] [blame] | 671 | #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites" |
| 672 | #endif |
| 673 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 674 | #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \ |
| 675 | ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
| 676 | #error "MBEDTLS_SSL_DTLS_ANTI_REPLAY defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 8464a46 | 2014-09-24 14:05:32 +0200 | [diff] [blame] | 677 | #endif |
| 678 | |
Gilles Peskine | d3d0290 | 2020-03-04 21:35:27 +0100 | [diff] [blame] | 679 | #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ |
| 680 | ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
| 681 | #error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites" |
| 682 | #endif |
| 683 | |
| 684 | #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ |
| 685 | defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \ |
| 686 | MBEDTLS_SSL_CID_IN_LEN_MAX > 255 |
| 687 | #error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)" |
| 688 | #endif |
| 689 | |
| 690 | #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ |
| 691 | defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \ |
| 692 | MBEDTLS_SSL_CID_OUT_LEN_MAX > 255 |
| 693 | #error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)" |
| 694 | #endif |
| 695 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 696 | #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 697 | !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
| 698 | #error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites" |
Manuel Pégourié-Gonnard | 699cafa | 2014-10-27 13:57:03 +0100 | [diff] [blame] | 699 | #endif |
| 700 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 701 | #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 702 | !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
| 703 | #error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites" |
Manuel Pégourié-Gonnard | 769c6b6 | 2014-10-28 14:13:55 +0100 | [diff] [blame] | 704 | #endif |
| 705 | |
Manuel Pégourié-Gonnard | 4214e3a | 2015-05-25 19:34:49 +0200 | [diff] [blame] | 706 | #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C) |
Manuel Pégourié-Gonnard | 0c0f11f | 2015-05-20 09:55:50 +0200 | [diff] [blame] | 707 | #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 708 | #endif |
| 709 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 710 | #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \ |
| 711 | !defined(MBEDTLS_X509_CRT_PARSE_C) |
| 712 | #error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 713 | #endif |
| 714 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 715 | #if defined(MBEDTLS_THREADING_PTHREAD) |
| 716 | #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL) |
| 717 | #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 718 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 719 | #define MBEDTLS_THREADING_IMPL |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 720 | #endif |
| 721 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 722 | #if defined(MBEDTLS_THREADING_ALT) |
| 723 | #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL) |
| 724 | #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 725 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 726 | #define MBEDTLS_THREADING_IMPL |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 727 | #endif |
| 728 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 729 | #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL) |
| 730 | #error "MBEDTLS_THREADING_C defined, single threading implementation required" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 731 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 732 | #undef MBEDTLS_THREADING_IMPL |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 733 | |
Manuel Pégourié-Gonnard | aeefa49 | 2018-10-22 12:14:52 +0200 | [diff] [blame] | 734 | #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_PSA_CRYPTO_C) |
| 735 | #error "MBEDTLS_USE_PSA_CRYPTO defined, but not all prerequisites" |
| 736 | #endif |
| 737 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 738 | #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C) |
| 739 | #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 740 | #endif |
| 741 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 742 | #if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ |
| 743 | !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) || \ |
| 744 | !defined(MBEDTLS_PK_PARSE_C) ) |
| 745 | #error "MBEDTLS_X509_USE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 746 | #endif |
| 747 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 748 | #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ |
| 749 | !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \ |
| 750 | !defined(MBEDTLS_PK_WRITE_C) ) |
| 751 | #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 752 | #endif |
| 753 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 754 | #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) |
| 755 | #error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 756 | #endif |
| 757 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 758 | #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) |
| 759 | #error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 760 | #endif |
| 761 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 762 | #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) |
| 763 | #error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 764 | #endif |
| 765 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 766 | #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) ) |
| 767 | #error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 768 | #endif |
| 769 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 770 | #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) ) |
| 771 | #error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 772 | #endif |
| 773 | |
Andres Amaya Garcia | d7fce00 | 2017-07-20 11:49:32 +0100 | [diff] [blame] | 774 | #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64) |
| 775 | #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously" |
| 776 | #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */ |
| 777 | |
Andres Amaya Garcia | 93db11a | 2017-07-20 12:11:19 +0100 | [diff] [blame] | 778 | #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \ |
| 779 | defined(MBEDTLS_HAVE_ASM) |
Andres Amaya Garcia | b39467d | 2017-07-20 13:21:15 +0100 | [diff] [blame] | 780 | #error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously" |
Andres Amaya Garcia | d7fce00 | 2017-07-20 11:49:32 +0100 | [diff] [blame] | 781 | #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */ |
| 782 | |
Ron Eldor | 3adb992 | 2017-12-21 10:15:08 +0200 | [diff] [blame] | 783 | #if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
| 784 | #error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites" |
| 785 | #endif |
| 786 | |
Andrzej Kurek | 557289b | 2020-10-21 15:12:39 +0200 | [diff] [blame] | 787 | #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) && ( !defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) ) |
| 788 | #error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites" |
| 789 | #endif |
| 790 | |
Gilles Peskine | fa4e4b8 | 2021-04-21 18:45:41 +0200 | [diff] [blame] | 791 | |
| 792 | |
| 793 | /* Reject attempts to enable options that have been removed and that could |
| 794 | * cause a build to succeed but with features removed. */ |
| 795 | |
| 796 | #if defined(MBEDTLS_HAVEGE_C) //no-check-names |
| 797 | #error "MBEDTLS_HAVEGE_C was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/2599" |
| 798 | #endif |
| 799 | |
| 800 | #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) //no-check-names |
| 801 | #error "MBEDTLS_SSL_HW_RECORD_ACCEL was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031" |
| 802 | #endif |
| 803 | |
| 804 | #if defined(MBEDTLS_SSL_PROTO_SSL3) //no-check-names |
| 805 | #error "MBEDTLS_SSL_PROTO_SSL3 (SSL v3.0 support) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031" |
| 806 | #endif |
| 807 | |
| 808 | #if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO) //no-check-names |
| 809 | #error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO (SSL v2 ClientHello support) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031" |
| 810 | #endif |
| 811 | |
| 812 | #if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) //no-check-names |
| 813 | #error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT (compatibility with the buggy implementation of truncated HMAC in Mbed TLS up to 2.7) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031" |
| 814 | #endif |
| 815 | |
| 816 | #if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES) //no-check-names |
Gilles Peskine | cc26e3b | 2021-04-21 19:01:59 +0200 | [diff] [blame] | 817 | #error "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES was removed in Mbed TLS 3.0. See the ChangeLog entry if you really need SHA-1-signed certificates." |
Gilles Peskine | fa4e4b8 | 2021-04-21 18:45:41 +0200 | [diff] [blame] | 818 | #endif |
| 819 | |
| 820 | #if defined(MBEDTLS_ZLIB_SUPPORT) //no-check-names |
| 821 | #error "MBEDTLS_ZLIB_SUPPORT was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031" |
| 822 | #endif |
| 823 | |
TRodziewicz | cc70741 | 2021-05-14 15:08:04 +0200 | [diff] [blame] | 824 | #if defined(MBEDTLS_CHECK_PARAMS) //no-check-names |
| 825 | #error "MBEDTLS_CHECK_PARAMS was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4313" |
| 826 | #endif |
| 827 | |
TRodziewicz | 4e57f4c | 2021-05-31 12:58:25 +0200 | [diff] [blame] | 828 | #if defined(MBEDTLS_SSL_CID_PADDING_GRANULARITY) //no-check-names |
| 829 | #error "MBEDTLS_SSL_CID_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4335" |
| 830 | #endif |
| 831 | |
| 832 | #if defined(MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY) //no-check-names |
| 833 | #error "MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4335" |
| 834 | #endif |
| 835 | |
Thomas Daubney | 4a7010d | 2021-06-15 12:54:14 +0100 | [diff] [blame] | 836 | #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) //no-check-names |
| 837 | #error "MBEDTLS_SSL_TRUNCATED_HMAC was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4341" |
| 838 | #endif |
| 839 | |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 840 | /* |
| 841 | * Avoid warning from -pedantic. This is a convenient place for this |
| 842 | * workaround since this is included by every single file before the |
Antonin Décimo | 36e89b5 | 2019-01-23 15:24:37 +0100 | [diff] [blame] | 843 | * #if defined(MBEDTLS_xxx_C) that results in empty translation units. |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 844 | */ |
| 845 | typedef int mbedtls_iso_c_forbids_empty_translation_units; |
| 846 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 847 | #endif /* MBEDTLS_CHECK_CONFIG_H */ |