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 | /* |
Thomas Fossati | 656864b | 2016-07-17 08:51:22 +0100 | [diff] [blame] | 7 | * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved |
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 | * |
Manuel Pégourié-Gonnard | fe44643 | 2015-03-06 13:17:10 +0000 | [diff] [blame] | 22 | * This file is part of mbed TLS (https://tls.mbed.org) |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 23 | */ |
| 24 | |
| 25 | /* |
| 26 | * It is recommended to include this file from your config.h |
| 27 | * in order to catch dependency issues early. |
| 28 | */ |
| 29 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 30 | #ifndef MBEDTLS_CHECK_CONFIG_H |
| 31 | #define MBEDTLS_CHECK_CONFIG_H |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 32 | |
Manuel Pégourié-Gonnard | d14acbc | 2015-05-29 11:26:37 +0200 | [diff] [blame] | 33 | /* |
| 34 | * We assume CHAR_BIT is 8 in many places. In practice, this is true on our |
| 35 | * target platforms, so not an issue, but let's just be extra sure. |
| 36 | */ |
| 37 | #include <limits.h> |
| 38 | #if CHAR_BIT != 8 |
| 39 | #error "mbed TLS requires a platform with 8-bit chars" |
| 40 | #endif |
| 41 | |
Manuel Pégourié-Gonnard | 9db2887 | 2015-06-26 10:52:01 +0200 | [diff] [blame] | 42 | #if defined(_WIN32) |
| 43 | #if !defined(MBEDTLS_PLATFORM_C) |
Manuel Pégourié-Gonnard | 6c0c8e0 | 2015-06-22 10:23:34 +0200 | [diff] [blame] | 44 | #error "MBEDTLS_PLATFORM_C is required on Windows" |
| 45 | #endif |
| 46 | |
Manuel Pégourié-Gonnard | 9db2887 | 2015-06-26 10:52:01 +0200 | [diff] [blame] | 47 | /* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as |
| 48 | * it would confuse config.pl. */ |
| 49 | #if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \ |
| 50 | !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) |
| 51 | #define MBEDTLS_PLATFORM_SNPRINTF_ALT |
| 52 | #endif |
| 53 | #endif /* _WIN32 */ |
| 54 | |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 55 | #if defined(TARGET_LIKE_MBED) && \ |
| 56 | ( defined(MBEDTLS_NET_C) || defined(MBEDTLS_TIMING_C) ) |
| 57 | #error "The NET and TIMING modules are not available for mbed OS - please use the network and timing functions provided by mbed OS" |
| 58 | #endif |
| 59 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 60 | #if defined(MBEDTLS_DEPRECATED_WARNING) && \ |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 61 | !defined(__GNUC__) && !defined(__clang__) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 62 | #error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang" |
Manuel Pégourié-Gonnard | c70581c | 2015-03-23 13:58:27 +0100 | [diff] [blame] | 63 | #endif |
| 64 | |
Manuel Pégourié-Gonnard | 60c793b | 2015-06-18 20:52:58 +0200 | [diff] [blame] | 65 | #if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME) |
| 66 | #error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense" |
| 67 | #endif |
| 68 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 69 | #if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM) |
| 70 | #error "MBEDTLS_AESNI_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 71 | #endif |
| 72 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 73 | #if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C) |
| 74 | #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 75 | #endif |
| 76 | |
Arto Kinnunen | 265d162 | 2019-10-16 10:17:48 +0300 | [diff] [blame] | 77 | #if defined(MBEDTLS_CTR_DRBG_C) && defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) |
| 78 | #error "MBEDTLS_CTR_DRBG_C and MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH defined, but MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is not defined" |
| 79 | #endif |
| 80 | |
Shelly Liberman | 11c6488 | 2020-11-26 22:48:23 +0200 | [diff] [blame] | 81 | #if defined(MBEDTLS_AES_128_BIT_MASKED) && ( !defined(MBEDTLS_AES_SCA_COUNTERMEASURES) || \ |
| 82 | !defined(MBEDTLS_AES_ONLY_ENCRYPT) || \ |
| 83 | !defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) ) |
| 84 | #error "MBEDTLS_AES_128_BIT_MASKED defined, but not all prerequisites" |
| 85 | #endif |
| 86 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 87 | #if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C) |
| 88 | #error "MBEDTLS_DHM_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 89 | #endif |
| 90 | |
Hanno Becker | e89353a | 2017-11-20 16:36:41 +0000 | [diff] [blame] | 91 | #if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC) |
| 92 | #error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites" |
| 93 | #endif |
| 94 | |
Brian Murray | 53e23b6 | 2016-09-13 14:00:15 -0700 | [diff] [blame] | 95 | #if defined(MBEDTLS_CMAC_C) && \ |
Simon Butcher | 69283e5 | 2016-10-06 12:49:58 +0100 | [diff] [blame] | 96 | !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C) |
Brian Murray | 53e23b6 | 2016-09-13 14:00:15 -0700 | [diff] [blame] | 97 | #error "MBEDTLS_CMAC_C defined, but not all prerequisites" |
| 98 | #endif |
| 99 | |
Hanno Becker | 483fd66 | 2019-09-02 12:39:24 +0100 | [diff] [blame] | 100 | #if defined(MBEDTLS_SSL_CONF_SINGLE_EC) && \ |
| 101 | ( !defined(MBEDTLS_SSL_CONF_SINGLE_EC_TLS_ID) || \ |
| 102 | ( defined(MBEDTLS_USE_TINYCRYPT) && \ |
| 103 | !defined(MBEDTLS_SSL_CONF_SINGLE_UECC_GRP_ID) ) || \ |
| 104 | ( defined(MBEDTLS_ECP_C) && \ |
| 105 | !defined(MBEDTLS_SSL_CONF_SINGLE_EC_GRP_ID) ) ) |
Hanno Becker | c1096e7 | 2019-06-19 12:30:41 +0100 | [diff] [blame] | 106 | #error "MBEDTLS_SSL_CONF_SINGLE_EC defined, but not all prerequesites" |
| 107 | #endif |
| 108 | |
Hanno Becker | 56595f4 | 2019-06-19 16:31:38 +0100 | [diff] [blame] | 109 | #if defined(MBEDTLS_SSL_CONF_SINGLE_SIG_HASH) && \ |
| 110 | ( !defined(MBEDTLS_SSL_CONF_SINGLE_SIG_HASH_MD_ID) || \ |
| 111 | !defined(MBEDTLS_SSL_CONF_SINGLE_SIG_HASH_TLS_ID) ) |
| 112 | #error "MBEDTLS_SSL_CONF_SINGLE_SIG_HASH defined, but not all prerequesites" |
| 113 | #endif |
| 114 | |
Manuel Pégourié-Gonnard | afdc1b5 | 2019-05-09 11:24:11 +0200 | [diff] [blame] | 115 | #if defined(MBEDTLS_USE_TINYCRYPT) && defined(MBEDTLS_NO_64BIT_MULTIPLICATION) |
| 116 | #error "MBEDTLS_USE_TINYCRYPT defined, but it cannot be defined with MBEDTLS_NO_64BIT_MULTIPLICATION" |
Jarno Lamsa | 5b87128 | 2019-04-29 10:29:06 +0300 | [diff] [blame] | 117 | #endif |
| 118 | |
Manuel Pégourié-Gonnard | 2b90961 | 2019-11-21 13:37:00 +0100 | [diff] [blame] | 119 | #if defined(MBEDTLS_USE_TINYCRYPT) && !defined(MBEDTLS_SHA256_C) |
| 120 | #error "MBEDTLS_USE_TINYCRYPT defined, but not MBEDTLS_SHA256_C" |
| 121 | #endif |
| 122 | |
Hanno Becker | 483fd66 | 2019-09-02 12:39:24 +0100 | [diff] [blame] | 123 | #if defined(MBEDTLS_USE_TINYCRYPT) && \ |
| 124 | !( defined(MBEDTLS_SSL_CONF_SINGLE_EC) && \ |
| 125 | MBEDTLS_SSL_CONF_SINGLE_EC_TLS_ID == 23 && \ |
| 126 | MBEDTLS_SSL_CONF_SINGLE_UECC_GRP_ID == MBEDTLS_UECC_DP_SECP256R1 ) |
| 127 | #error "MBEDTLS_USE_TINYCRYPT requires the use of MBEDTLS_SSL_CONF_SINGLE_UECC_GRP_ID to hardcode the choice of Secp256r1" |
Hanno Becker | af9ff4a | 2019-07-24 11:40:53 +0100 | [diff] [blame] | 128 | #endif |
| 129 | |
Hanno Becker | 52c52f3 | 2019-09-02 11:47:20 +0100 | [diff] [blame] | 130 | #if defined(MBEDTLS_USE_TINYCRYPT) && defined(MBEDTLS_ECP_C) |
| 131 | #error "MBEDTLS_USE_TINYCRYPT and MBEDTLS_ECP_C cannot be used simultaneously" |
| 132 | #endif |
| 133 | |
Hanno Becker | 00a9b6d | 2019-07-24 09:43:44 +0100 | [diff] [blame] | 134 | #if defined(MBEDTLS_USE_TINYCRYPT) && \ |
| 135 | !defined(MBEDTLS_SSL_CONF_RNG) |
| 136 | #error "MBEDTLS_USE_TINYCRYPT defined, but not all prerequesites" |
| 137 | #endif |
| 138 | |
Andrzej Kurek | db0e50e | 2020-10-14 12:24:20 +0200 | [diff] [blame] | 139 | #if defined(MBEDTLS_OPTIMIZE_TINYCRYPT_ASM) && \ |
| 140 | ( !defined(MBEDTLS_HAVE_ASM) || \ |
| 141 | !defined(MBEDTLS_USE_TINYCRYPT) ) |
| 142 | #error "MBEDTLS_OPTIMIZE_TINYCRYPT_ASM defined, but not all prerequesites" |
| 143 | #endif |
| 144 | |
Ron Eldor | 466a57f | 2018-05-03 16:54:28 +0300 | [diff] [blame] | 145 | #if defined(MBEDTLS_NIST_KW_C) && \ |
| 146 | ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) ) |
| 147 | #error "MBEDTLS_NIST_KW_C defined, but not all prerequisites" |
| 148 | #endif |
| 149 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 150 | #if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C) |
| 151 | #error "MBEDTLS_ECDH_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 152 | #endif |
| 153 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 154 | #if defined(MBEDTLS_ECDSA_C) && \ |
| 155 | ( !defined(MBEDTLS_ECP_C) || \ |
| 156 | !defined(MBEDTLS_ASN1_PARSE_C) || \ |
| 157 | !defined(MBEDTLS_ASN1_WRITE_C) ) |
| 158 | #error "MBEDTLS_ECDSA_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 159 | #endif |
| 160 | |
Manuel Pégourié-Gonnard | 4d8685b | 2015-08-05 15:44:42 +0200 | [diff] [blame] | 161 | #if defined(MBEDTLS_ECJPAKE_C) && \ |
| 162 | ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) ) |
| 163 | #error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites" |
| 164 | #endif |
| 165 | |
Ron Eldor | 5ed8c1e | 2018-11-05 14:04:26 +0200 | [diff] [blame] | 166 | #if defined(MBEDTLS_ECP_RESTARTABLE) && \ |
| 167 | ( defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \ |
| 168 | defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) || \ |
| 169 | defined(MBEDTLS_ECDSA_SIGN_ALT) || \ |
| 170 | defined(MBEDTLS_ECDSA_VERIFY_ALT) || \ |
| 171 | defined(MBEDTLS_ECDSA_GENKEY_ALT) || \ |
Janos Follath | 172ba63 | 2018-12-07 12:13:54 +0000 | [diff] [blame] | 172 | defined(MBEDTLS_ECP_INTERNAL_ALT) || \ |
Ron Eldor | 5ed8c1e | 2018-11-05 14:04:26 +0200 | [diff] [blame] | 173 | defined(MBEDTLS_ECP_ALT) ) |
| 174 | #error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative ECP implementation" |
| 175 | #endif |
| 176 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 177 | #if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C) |
| 178 | #error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 179 | #endif |
| 180 | |
k-stachowiak | c775ee1 | 2019-05-31 20:13:58 +0200 | [diff] [blame] | 181 | #if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 182 | !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \ |
| 183 | !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \ |
| 184 | !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \ |
| 185 | !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) && \ |
| 186 | !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) && \ |
| 187 | !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) && \ |
| 188 | !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) && \ |
| 189 | !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \ |
| 190 | !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \ |
| 191 | !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \ |
k-stachowiak | c775ee1 | 2019-05-31 20:13:58 +0200 | [diff] [blame] | 192 | !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \ |
| 193 | !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \ |
| 194 | !defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 195 | #error "MBEDTLS_ECP_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 196 | #endif |
| 197 | |
Hanno Becker | 054deec | 2019-09-02 13:47:00 +0100 | [diff] [blame] | 198 | #if ( defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \ |
| 199 | defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \ |
| 200 | defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \ |
| 201 | defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \ |
| 202 | defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \ |
| 203 | defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \ |
| 204 | defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \ |
| 205 | defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) || \ |
| 206 | defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \ |
| 207 | defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \ |
| 208 | defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) && \ |
| 209 | !defined(MBEDTLS_ECP_C) |
| 210 | #error "At least one ECP curve enabled, but not all prerequesites" |
| 211 | #endif |
| 212 | |
Hanno Becker | cb9debd | 2018-10-12 10:44:27 +0100 | [diff] [blame] | 213 | #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C) |
| 214 | #error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites" |
| 215 | #endif |
| 216 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 217 | #if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \ |
| 218 | !defined(MBEDTLS_SHA256_C)) |
| 219 | #error "MBEDTLS_ENTROPY_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 220 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 221 | #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) && \ |
| 222 | defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64) |
| 223 | #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 224 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 225 | #if defined(MBEDTLS_ENTROPY_C) && \ |
| 226 | ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \ |
| 227 | && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32) |
| 228 | #error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 229 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 230 | #if defined(MBEDTLS_ENTROPY_C) && \ |
| 231 | defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C) |
| 232 | #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 233 | #endif |
| 234 | |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 235 | #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \ |
| 236 | ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) ) |
| 237 | #error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites" |
Janos Follath | 53de784 | 2016-06-08 15:29:18 +0100 | [diff] [blame] | 238 | #endif |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 239 | #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \ |
| 240 | ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \ |
| 241 | defined(MBEDTLS_HAVEGE_C) ) |
| 242 | #error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too" |
Janos Follath | 53de784 | 2016-06-08 15:29:18 +0100 | [diff] [blame] | 243 | #endif |
| 244 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 245 | #if defined(MBEDTLS_GCM_C) && ( \ |
| 246 | !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) ) |
| 247 | #error "MBEDTLS_GCM_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 248 | #endif |
| 249 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 250 | #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 251 | #error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites" |
| 252 | #endif |
| 253 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 254 | #if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 255 | #error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites" |
| 256 | #endif |
| 257 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 258 | #if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 259 | #error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites" |
| 260 | #endif |
| 261 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 262 | #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] | 263 | #error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites" |
| 264 | #endif |
| 265 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 266 | #if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 267 | #error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites" |
| 268 | #endif |
| 269 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 270 | #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] | 271 | #error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites" |
| 272 | #endif |
| 273 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 274 | #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 275 | #error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites" |
| 276 | #endif |
| 277 | |
Janos Follath | c44ab97 | 2016-11-18 16:38:23 +0000 | [diff] [blame] | 278 | #if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT) |
Janos Follath | b069753 | 2016-08-18 12:38:46 +0100 | [diff] [blame] | 279 | #error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites" |
| 280 | #endif |
| 281 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 282 | #if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C) |
| 283 | #error "MBEDTLS_HAVEGE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 284 | #endif |
| 285 | |
Thomas Fossati | 656864b | 2016-07-17 08:51:22 +0100 | [diff] [blame] | 286 | #if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C) |
| 287 | #error "MBEDTLS_HKDF_C defined, but not all prerequisites" |
| 288 | #endif |
| 289 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 290 | #if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C) |
| 291 | #error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 292 | #endif |
| 293 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 294 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \ |
Hanno Becker | 6f212d0 | 2019-09-02 13:05:27 +0100 | [diff] [blame] | 295 | ( !( defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_USE_TINYCRYPT) ) || \ |
| 296 | !defined(MBEDTLS_X509_CRT_PARSE_C) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 297 | #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] | 298 | #endif |
| 299 | |
Hanno Becker | 6f212d0 | 2019-09-02 13:05:27 +0100 | [diff] [blame] | 300 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \ |
| 301 | ( !( defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_USE_TINYCRYPT) ) || \ |
| 302 | !defined(MBEDTLS_X509_CRT_PARSE_C) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 303 | #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] | 304 | #endif |
| 305 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 306 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C) |
| 307 | #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] | 308 | #endif |
| 309 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 310 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) && \ |
Hanno Becker | 6f212d0 | 2019-09-02 13:05:27 +0100 | [diff] [blame] | 311 | !(defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_USE_TINYCRYPT) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 312 | #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] | 313 | #endif |
| 314 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 315 | #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \ |
| 316 | ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) || \ |
| 317 | !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) ) |
| 318 | #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] | 319 | #endif |
| 320 | |
Hanno Becker | 49dc8ed | 2019-07-24 10:08:11 +0100 | [diff] [blame] | 321 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \ |
| 322 | ( !( defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_USE_TINYCRYPT) ) || \ |
| 323 | !defined(MBEDTLS_RSA_C) || \ |
| 324 | !defined(MBEDTLS_X509_CRT_PARSE_C) || \ |
| 325 | !defined(MBEDTLS_PKCS1_V15) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 326 | #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] | 327 | #endif |
| 328 | |
Hanno Becker | 490277c | 2019-08-23 11:51:10 +0100 | [diff] [blame] | 329 | #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \ |
| 330 | ( !( defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_USE_TINYCRYPT) ) || \ |
| 331 | !( defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_USE_TINYCRYPT) ) || \ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 332 | !defined(MBEDTLS_X509_CRT_PARSE_C) ) |
| 333 | #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] | 334 | #endif |
| 335 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 336 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) && \ |
| 337 | ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \ |
| 338 | !defined(MBEDTLS_PKCS1_V15) ) |
| 339 | #error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 340 | #endif |
| 341 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 342 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \ |
| 343 | ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \ |
| 344 | !defined(MBEDTLS_PKCS1_V15) ) |
| 345 | #error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 346 | #endif |
| 347 | |
Manuel Pégourié-Gonnard | 557535d | 2015-09-15 17:53:32 +0200 | [diff] [blame] | 348 | #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \ |
| 349 | ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \ |
| 350 | !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) ) |
| 351 | #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites" |
| 352 | #endif |
| 353 | |
Hanno Becker | 2984bd2 | 2019-02-26 11:43:09 +0000 | [diff] [blame] | 354 | #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) && \ |
| 355 | !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) && \ |
| 356 | ( !defined(MBEDTLS_SHA256_C) && \ |
| 357 | !defined(MBEDTLS_SHA512_C) && \ |
| 358 | !defined(MBEDTLS_SHA1_C) ) |
Hanno Becker | d972f00 | 2019-06-18 12:41:15 +0100 | [diff] [blame] | 359 | #error "MBEDTLS_SSL_KEEP_PEER_CERTIFICATE defined, but not all prerequesites" |
Hanno Becker | 2984bd2 | 2019-02-26 11:43:09 +0000 | [diff] [blame] | 360 | #endif |
| 361 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 362 | #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \ |
| 363 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) |
| 364 | #error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 365 | #endif |
| 366 | |
Hanno Becker | e29e7eb | 2019-02-26 13:50:21 +0000 | [diff] [blame] | 367 | #if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) |
| 368 | #error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites" |
| 369 | #endif |
| 370 | |
Hanno Becker | 9ae9da9 | 2019-06-03 16:31:32 +0100 | [diff] [blame] | 371 | #if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) |
| 372 | #error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites" |
| 373 | #endif |
| 374 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 375 | #if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM) |
| 376 | #error "MBEDTLS_PADLOCK_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 377 | #endif |
| 378 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 379 | #if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C) |
| 380 | #error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 381 | #endif |
| 382 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 383 | #if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C) |
| 384 | #error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 385 | #endif |
| 386 | |
Hanno Becker | 490277c | 2019-08-23 11:51:10 +0100 | [diff] [blame] | 387 | #if defined(MBEDTLS_PK_C) && \ |
| 388 | ( !defined(MBEDTLS_RSA_C) && \ |
| 389 | !defined(MBEDTLS_ECP_C) && \ |
| 390 | !defined(MBEDTLS_USE_TINYCRYPT) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 391 | #error "MBEDTLS_PK_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 94de331 | 2015-01-28 16:32:36 +0000 | [diff] [blame] | 392 | #endif |
| 393 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 394 | #if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C) |
| 395 | #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 396 | #endif |
| 397 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 398 | #if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C) |
| 399 | #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 400 | #endif |
| 401 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 402 | #if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C) |
| 403 | #error "MBEDTLS_PKCS11_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 404 | #endif |
| 405 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 406 | #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 407 | #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 408 | #endif |
| 409 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 410 | #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 411 | #error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 412 | #endif |
| 413 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 414 | #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\ |
| 415 | ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\ |
| 416 | defined(MBEDTLS_PLATFORM_EXIT_ALT) ) |
| 417 | #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] | 418 | #endif |
| 419 | |
Andres Amaya Garcia | 1e4ec66 | 2016-07-20 10:16:25 +0100 | [diff] [blame] | 420 | #if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\ |
| 421 | ( !defined(MBEDTLS_PLATFORM_C) ||\ |
| 422 | !defined(MBEDTLS_HAVE_TIME) ) |
| 423 | #error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites" |
| 424 | #endif |
| 425 | |
| 426 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\ |
| 427 | ( !defined(MBEDTLS_PLATFORM_C) ||\ |
| 428 | !defined(MBEDTLS_HAVE_TIME) ) |
| 429 | #error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites" |
| 430 | #endif |
| 431 | |
| 432 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\ |
| 433 | ( !defined(MBEDTLS_PLATFORM_C) ||\ |
| 434 | !defined(MBEDTLS_HAVE_TIME) ) |
| 435 | #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites" |
| 436 | #endif |
| 437 | |
| 438 | #if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\ |
| 439 | ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\ |
| 440 | defined(MBEDTLS_PLATFORM_TIME_ALT) ) |
| 441 | #error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously" |
| 442 | #endif |
| 443 | |
| 444 | #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\ |
| 445 | ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\ |
| 446 | defined(MBEDTLS_PLATFORM_TIME_ALT) ) |
| 447 | #error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously" |
| 448 | #endif |
| 449 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 450 | #if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 451 | #error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 452 | #endif |
| 453 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 454 | #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 455 | #error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 456 | #endif |
| 457 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 458 | #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\ |
| 459 | ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\ |
| 460 | defined(MBEDTLS_PLATFORM_FPRINTF_ALT) ) |
| 461 | #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] | 462 | #endif |
| 463 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 464 | #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\ |
| 465 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) |
| 466 | #error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 467 | #endif |
| 468 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 469 | #if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\ |
| 470 | defined(MBEDTLS_PLATFORM_STD_FREE) |
| 471 | #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] | 472 | #endif |
| 473 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 474 | #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO) |
| 475 | #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] | 476 | #endif |
| 477 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 478 | #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\ |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 479 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) ) |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 480 | #error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 481 | #endif |
| 482 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 483 | #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\ |
| 484 | defined(MBEDTLS_PLATFORM_STD_CALLOC) |
| 485 | #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] | 486 | #endif |
| 487 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 488 | #if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO) |
| 489 | #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] | 490 | #endif |
| 491 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 492 | #if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C) |
| 493 | #error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 494 | #endif |
| 495 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 496 | #if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 497 | #error "MBEDTLS_PLATFORM_PRINTF_ALT 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_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 501 | #error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 502 | #endif |
| 503 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 504 | #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\ |
| 505 | ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\ |
| 506 | defined(MBEDTLS_PLATFORM_PRINTF_ALT) ) |
| 507 | #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] | 508 | #endif |
| 509 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 510 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C) |
| 511 | #error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 512 | #endif |
| 513 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 514 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C) |
| 515 | #error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites" |
Rich Evans | 4cc8a22 | 2015-02-03 11:26:31 +0000 | [diff] [blame] | 516 | #endif |
| 517 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 518 | #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\ |
| 519 | ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\ |
| 520 | defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) ) |
| 521 | #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] | 522 | #endif |
| 523 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 524 | #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\ |
| 525 | !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS) |
| 526 | #error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 527 | #endif |
| 528 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 529 | #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY) |
| 530 | #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 531 | #endif |
| 532 | |
Manuel Pégourié-Gonnard | a7f8033 | 2015-05-27 20:26:40 +0200 | [diff] [blame] | 533 | #if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY) |
| 534 | #error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 535 | #endif |
| 536 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 537 | #if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY) |
| 538 | #error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 539 | #endif |
| 540 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 541 | #if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\ |
| 542 | !defined(MBEDTLS_PLATFORM_EXIT_ALT) |
| 543 | #error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 544 | #endif |
| 545 | |
Andres Amaya Garcia | 1e4ec66 | 2016-07-20 10:16:25 +0100 | [diff] [blame] | 546 | #if defined(MBEDTLS_PLATFORM_STD_TIME) &&\ |
| 547 | ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\ |
| 548 | !defined(MBEDTLS_HAVE_TIME) ) |
| 549 | #error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites" |
| 550 | #endif |
| 551 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 552 | #if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\ |
| 553 | !defined(MBEDTLS_PLATFORM_FPRINTF_ALT) |
| 554 | #error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 555 | #endif |
| 556 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 557 | #if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\ |
| 558 | !defined(MBEDTLS_PLATFORM_PRINTF_ALT) |
| 559 | #error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 560 | #endif |
| 561 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 562 | #if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\ |
| 563 | !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) |
| 564 | #error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites" |
Rich Evans | c0b6da3 | 2015-02-03 10:58:06 +0000 | [diff] [blame] | 565 | #endif |
| 566 | |
Paul Bakker | cf0a9f9 | 2016-06-01 11:25:44 +0100 | [diff] [blame] | 567 | #if defined(MBEDTLS_ENTROPY_NV_SEED) &&\ |
| 568 | ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) ) |
| 569 | #error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites" |
| 570 | #endif |
| 571 | |
| 572 | #if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\ |
| 573 | !defined(MBEDTLS_ENTROPY_NV_SEED) |
| 574 | #error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites" |
| 575 | #endif |
| 576 | |
| 577 | #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\ |
| 578 | !defined(MBEDTLS_PLATFORM_NV_SEED_ALT) |
| 579 | #error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites" |
| 580 | #endif |
| 581 | |
| 582 | #if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\ |
| 583 | !defined(MBEDTLS_PLATFORM_NV_SEED_ALT) |
| 584 | #error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites" |
| 585 | #endif |
| 586 | |
| 587 | #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\ |
| 588 | ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\ |
| 589 | defined(MBEDTLS_PLATFORM_NV_SEED_ALT) ) |
| 590 | #error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously" |
| 591 | #endif |
| 592 | |
| 593 | #if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\ |
| 594 | ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\ |
| 595 | defined(MBEDTLS_PLATFORM_NV_SEED_ALT) ) |
| 596 | #error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously" |
| 597 | #endif |
| 598 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 599 | #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ |
| 600 | !defined(MBEDTLS_OID_C) ) |
| 601 | #error "MBEDTLS_RSA_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 602 | #endif |
| 603 | |
Paul Bakker | 4fde40f | 2016-05-09 15:13:04 +0100 | [diff] [blame] | 604 | #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) && \ |
Paul Bakker | 37068a7 | 2016-05-09 14:36:33 +0100 | [diff] [blame] | 605 | !defined(MBEDTLS_PKCS1_V15) ) |
| 606 | #error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled" |
| 607 | #endif |
| 608 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 609 | #if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) && \ |
| 610 | ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) ) |
| 611 | #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] | 612 | #endif |
| 613 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 614 | #if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \ |
| 615 | !defined(MBEDTLS_SHA1_C) ) |
| 616 | #error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 617 | #endif |
| 618 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 619 | #if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \ |
| 620 | !defined(MBEDTLS_SHA1_C) ) |
| 621 | #error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 622 | #endif |
| 623 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 624 | #if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) || \ |
| 625 | !defined(MBEDTLS_SHA1_C) ) |
| 626 | #error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 627 | #endif |
| 628 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 629 | #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) && \ |
| 630 | !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) ) |
| 631 | #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] | 632 | #endif |
| 633 | |
Andrzej Kurek | 825ebd4 | 2020-05-18 11:47:25 -0400 | [diff] [blame] | 634 | #if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ |
| 635 | defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \ |
| 636 | !(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ |
| 637 | defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ |
| 638 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ |
| 639 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ |
| 640 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ |
| 641 | defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \ |
| 642 | defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ |
| 643 | defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \ |
| 644 | defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \ |
| 645 | defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ |
| 646 | defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) ) |
| 647 | #error "One or more versions of the TLS protocol are enabled " \ |
| 648 | "but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx" |
| 649 | #endif |
| 650 | |
Manuel Pégourié-Gonnard | 5a8d56d | 2015-05-13 10:10:00 +0200 | [diff] [blame] | 651 | #if defined(MBEDTLS_SSL_PROTO_DTLS) && \ |
| 652 | !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \ |
| 653 | !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 654 | #error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 0b1ff29 | 2014-02-06 13:04:16 +0100 | [diff] [blame] | 655 | #endif |
| 656 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 657 | #if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C) |
| 658 | #error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 659 | #endif |
| 660 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 661 | #if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) || \ |
| 662 | !defined(MBEDTLS_MD_C) ) |
| 663 | #error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 664 | #endif |
| 665 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 666 | #if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C) |
| 667 | #error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 668 | #endif |
| 669 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 670 | #if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \ |
| 671 | !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \ |
| 672 | !defined(MBEDTLS_SSL_PROTO_TLS1_2)) |
Manuel Pégourié-Gonnard | a771160 | 2019-03-18 10:18:37 +0100 | [diff] [blame] | 673 | #error "MBEDTLS_SSL_TLS_C defined, but no protocol version is active" |
| 674 | #endif |
| 675 | |
Manuel Pégourié-Gonnard | c84511f | 2019-06-18 10:32:25 +0200 | [diff] [blame] | 676 | /* PROTO_TLS is not a documented option so far, but still check for conflicts |
| 677 | * involving it, in preparation for making it the documented option later */ |
| 678 | #if defined(MBEDTLS_SSL_PROTO_TLS) && defined(MBEDTLS_SSL_PROTO_NO_TLS) |
| 679 | #error "MBEDTLS_SSL_PROTO_TLS and MBEDTLS_SSL_PROTO_NO_TLS both defined" |
| 680 | #endif |
| 681 | |
Manuel Pégourié-Gonnard | a771160 | 2019-03-18 10:18:37 +0100 | [diff] [blame] | 682 | #if defined(MBEDTLS_SSL_TLS_C) && \ |
Manuel Pégourié-Gonnard | ba8b1eb | 2019-06-17 15:21:07 +0200 | [diff] [blame] | 683 | ( defined(MBEDTLS_SSL_PROTO_NO_TLS) && !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
Manuel Pégourié-Gonnard | a771160 | 2019-03-18 10:18:37 +0100 | [diff] [blame] | 684 | #error "MBEDTLS_SSL_TLS_C defined, but neither TLS or DTLS is active" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 685 | #endif |
| 686 | |
Andrzej Kurek | 1175044 | 2020-09-17 07:12:06 -0400 | [diff] [blame] | 687 | #if defined(MBEDTLS_SSL_TLS_C) && defined(MBEDTLS_SSL_TRANSFORM_OPTIMIZE_CIPHERS) && \ |
| 688 | defined(MBEDTLS_ARC4_C) |
| 689 | #error "MBEDTLS_ARC4_C cannot be defined with MBEDTLS_SSL_TRANSFORM_OPTIMIZE_CIPHERS on" |
| 690 | #endif |
| 691 | |
Andrzej Kurek | a793237 | 2020-09-19 07:56:06 +0200 | [diff] [blame] | 692 | #if defined(MBEDTLS_VALIDATE_SSL_KEYS_INTEGRITY) && !defined(MBEDTLS_SSL_TRANSFORM_OPTIMIZE_CIPHERS) && \ |
| 693 | defined(MBEDTLS_ARC4_C) |
| 694 | #error "MBEDTLS_VALIDATE_SSL_KEYS_INTEGRITY requires MBEDTLS_SSL_TRANSFORM_OPTIMIZE_CIPHERS to be defined." |
| 695 | #endif |
| 696 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 697 | #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \ |
| 698 | defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1)) |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 699 | #error "Illegal protocol selection" |
| 700 | #endif |
| 701 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 702 | #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \ |
| 703 | defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1)) |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 704 | #error "Illegal protocol selection" |
| 705 | #endif |
| 706 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 707 | #if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \ |
| 708 | defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \ |
| 709 | !defined(MBEDTLS_SSL_PROTO_TLS1_1))) |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 710 | #error "Illegal protocol selection" |
| 711 | #endif |
| 712 | |
Manuel Pégourié-Gonnard | e057d3b | 2015-05-20 10:59:43 +0200 | [diff] [blame] | 713 | #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] | 714 | #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] | 715 | #endif |
| 716 | |
Manuel Pégourié-Gonnard | 62c74bb | 2015-09-08 17:50:29 +0200 | [diff] [blame] | 717 | #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \ |
Manuel Pégourié-Gonnard | ddfe5d2 | 2015-09-09 12:46:16 +0200 | [diff] [blame] | 718 | !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) |
Manuel Pégourié-Gonnard | 62c74bb | 2015-09-08 17:50:29 +0200 | [diff] [blame] | 719 | #error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE defined, but not all prerequisites" |
| 720 | #endif |
| 721 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 722 | #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) && \ |
| 723 | ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
| 724 | #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] | 725 | #endif |
| 726 | |
Hanno Becker | cb8774b | 2019-07-05 11:20:49 +0100 | [diff] [blame] | 727 | #if defined(MBEDTLS_SSL_CONF_MIN_MINOR_VER) || \ |
| 728 | defined(MBEDTLS_SSL_CONF_MAX_MINOR_VER) || \ |
| 729 | defined(MBEDTLS_SSL_CONF_MIN_MAJOR_VER) || \ |
| 730 | defined(MBEDTLS_SSL_CONF_MAX_MAJOR_VER) |
| 731 | #if !( defined(MBEDTLS_SSL_CONF_MIN_MINOR_VER) && \ |
| 732 | defined(MBEDTLS_SSL_CONF_MAX_MINOR_VER) && \ |
| 733 | defined(MBEDTLS_SSL_CONF_MIN_MAJOR_VER) && \ |
| 734 | defined(MBEDTLS_SSL_CONF_MAX_MAJOR_VER) ) |
| 735 | #error "MBEDTLS_SSL_CONF_MIN_MINOR_VER, MBEDTLS_SSL_CONF_MAX_MINOR_VER, MBEDTLS_SSL_CONF_MIN_MAJOR_VER, MBEDTLS_SSL_CONF_MAX_MAJOR_VER must be defined simultaneously" |
| 736 | #endif |
| 737 | #endif |
| 738 | |
Hanno Becker | a5a2b08 | 2019-05-15 14:03:01 +0100 | [diff] [blame] | 739 | #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ |
Hanno Becker | 29a54c8 | 2019-04-09 15:14:28 +0100 | [diff] [blame] | 740 | ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
Hanno Becker | a5a2b08 | 2019-05-15 14:03:01 +0100 | [diff] [blame] | 741 | #error "MBEDTLS_SSL_DTLS_CONNECTION_ID defined, but not all prerequisites" |
Hanno Becker | 29a54c8 | 2019-04-09 15:14:28 +0100 | [diff] [blame] | 742 | #endif |
| 743 | |
Hanno Becker | a5a2b08 | 2019-05-15 14:03:01 +0100 | [diff] [blame] | 744 | #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ |
Hanno Becker | 4662971 | 2019-04-25 16:47:57 +0100 | [diff] [blame] | 745 | defined(MBEDTLS_SSL_CID_IN_LEN_MAX) && \ |
| 746 | MBEDTLS_SSL_CID_IN_LEN_MAX > 255 |
| 747 | #error "MBEDTLS_SSL_CID_IN_LEN_MAX too large (max 255)" |
| 748 | #endif |
| 749 | |
Hanno Becker | a5a2b08 | 2019-05-15 14:03:01 +0100 | [diff] [blame] | 750 | #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ |
Hanno Becker | 4662971 | 2019-04-25 16:47:57 +0100 | [diff] [blame] | 751 | defined(MBEDTLS_SSL_CID_OUT_LEN_MAX) && \ |
| 752 | MBEDTLS_SSL_CID_OUT_LEN_MAX > 255 |
| 753 | #error "MBEDTLS_SSL_CID_OUT_LEN_MAX too large (max 255)" |
| 754 | #endif |
| 755 | |
Hanno Becker | e0200da | 2019-06-13 09:23:43 +0100 | [diff] [blame] | 756 | #if ( defined(MBEDTLS_SSL_CONF_CID_LEN) && \ |
| 757 | !defined(MBEDTLS_SSL_CONF_IGNORE_UNEXPECTED_CID) ) || \ |
| 758 | ( !defined(MBEDTLS_SSL_CONF_CID_LEN) && \ |
| 759 | defined(MBEDTLS_SSL_CONF_IGNORE_UNEXPECTED_CID) ) |
| 760 | #error "MBEDTLS_SSL_CONF_CID_LEN and MBEDTLS_SSL_CONF_IGNORE_UNEXPECTED_CID must be defined simultaneously" |
| 761 | #endif |
| 762 | |
Hanno Becker | 1f835fa | 2019-06-13 10:14:59 +0100 | [diff] [blame] | 763 | #if ( defined(MBEDTLS_SSL_CONF_HS_TIMEOUT_MIN) && \ |
| 764 | !defined(MBEDTLS_SSL_CONF_HS_TIMEOUT_MAX) ) || \ |
| 765 | ( !defined(MBEDTLS_SSL_CONF_HS_TIMEOUT_MIN) && \ |
| 766 | defined(MBEDTLS_SSL_CONF_HS_TIMEOUT_MAX) ) |
| 767 | #error "MBEDTLS_SSL_CONF_HS_TIMEOUT_MIN and MBEDTLS_SSL_CONF_HS_TIMEOUT_MAX must be defined simultaneously" |
| 768 | #endif |
| 769 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 770 | #if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) && \ |
| 771 | ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) ) |
| 772 | #error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | b0643d1 | 2014-10-14 18:30:36 +0200 | [diff] [blame] | 773 | #endif |
| 774 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 775 | #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) && \ |
| 776 | !defined(MBEDTLS_SSL_PROTO_TLS1) && \ |
| 777 | !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \ |
| 778 | !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
| 779 | #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] | 780 | #endif |
| 781 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 782 | #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \ |
| 783 | !defined(MBEDTLS_SSL_PROTO_TLS1) && \ |
| 784 | !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \ |
| 785 | !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
| 786 | #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] | 787 | #endif |
| 788 | |
Hanno Becker | f765ce6 | 2019-06-21 13:17:14 +0100 | [diff] [blame] | 789 | #if ( defined(MBEDTLS_SSL_CONF_EXTENDED_MASTER_SECRET) && \ |
| 790 | !defined(MBEDTLS_SSL_CONF_ENFORCE_EXTENDED_MASTER_SECRET) ) || \ |
| 791 | ( !defined(MBEDTLS_SSL_CONF_EXTENDED_MASTER_SECRET) && \ |
| 792 | defined(MBEDTLS_SSL_CONF_ENFORCE_EXTENDED_MASTER_SECRET) ) |
Hanno Becker | 62327ab | 2019-07-01 15:57:20 +0100 | [diff] [blame] | 793 | #error "MBEDTLS_SSL_CONF_EXTENDED_MASTER_SECRET and MBEDTLS_SSL_CONF_ENFORCE_EXTENDED_MASTER_SECRET must be defined together." |
Hanno Becker | f765ce6 | 2019-06-21 13:17:14 +0100 | [diff] [blame] | 794 | #endif |
| 795 | |
Hanno Becker | a58a896 | 2019-06-13 16:11:15 +0100 | [diff] [blame] | 796 | #if ( defined(MBEDTLS_SSL_CONF_SEND) && \ |
| 797 | !( defined(MBEDTLS_SSL_CONF_RECV) && \ |
| 798 | defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) ) ) || \ |
| 799 | ( defined(MBEDTLS_SSL_CONF_RECV) && \ |
| 800 | !( defined(MBEDTLS_SSL_CONF_SEND) && \ |
| 801 | defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) ) ) || \ |
| 802 | ( defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) && \ |
| 803 | !( defined(MBEDTLS_SSL_CONF_SEND) && \ |
| 804 | defined(MBEDTLS_SSL_CONF_RECV) ) ) |
Hanno Becker | 62327ab | 2019-07-01 15:57:20 +0100 | [diff] [blame] | 805 | #error "MBEDTLS_SSL_CONF_SEND/RECV/RECV_TIMEOUT must be defined simultaneously" |
Hanno Becker | a58a896 | 2019-06-13 16:11:15 +0100 | [diff] [blame] | 806 | #endif |
| 807 | |
Hanno Becker | 0ae6b24 | 2019-06-13 16:45:36 +0100 | [diff] [blame] | 808 | #if ( defined(MBEDTLS_SSL_CONF_GET_TIMER) && \ |
| 809 | !defined(MBEDTLS_SSL_CONF_SET_TIMER) ) || \ |
| 810 | ( !defined(MBEDTLS_SSL_CONF_GET_TIMER) && \ |
| 811 | defined(MBEDTLS_SSL_CONF_SET_TIMER) ) |
Hanno Becker | 62327ab | 2019-07-01 15:57:20 +0100 | [diff] [blame] | 812 | #error "MBEDTLS_SSL_CONF_GET_TIMER and MBEDTLS_SSL_CONF_SET_TIMER must be defined together." |
Hanno Becker | 0ae6b24 | 2019-06-13 16:45:36 +0100 | [diff] [blame] | 813 | #endif |
| 814 | |
Manuel Pégourié-Gonnard | 4214e3a | 2015-05-25 19:34:49 +0200 | [diff] [blame] | 815 | #if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C) |
Manuel Pégourié-Gonnard | 0c0f11f | 2015-05-20 09:55:50 +0200 | [diff] [blame] | 816 | #error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 817 | #endif |
| 818 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 819 | #if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \ |
| 820 | !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1) |
| 821 | #error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | d76314c | 2015-01-07 12:39:44 +0100 | [diff] [blame] | 822 | #endif |
| 823 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 824 | #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \ |
| 825 | !defined(MBEDTLS_X509_CRT_PARSE_C) |
| 826 | #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] | 827 | #endif |
| 828 | |
Jarno Lamsa | 29f2dd0 | 2019-06-20 15:31:52 +0300 | [diff] [blame] | 829 | #if defined(MBEDTLS_SSL_SESSION_TICKETS) && \ |
| 830 | defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION) |
| 831 | #error "MBEDTLS_SSL_SESSION_TICKETS cannot be defined with MBEDTLS_SSL_NO_SESSION_RESUMPTION" |
| 832 | #endif |
| 833 | |
| 834 | #if !defined(MBEDTLS_SSL_NO_SESSION_CACHE) && \ |
| 835 | defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION) |
Manuel Pégourié-Gonnard | c27fabf | 2019-07-01 13:05:39 +0200 | [diff] [blame] | 836 | #error "MBEDTLS_SSL_NO_SESSION_CACHE needs to be defined with MBEDTLS_SSL_NO_SESSION_RESUMPTION" |
Jarno Lamsa | 59bd12b | 2019-06-18 13:49:02 +0300 | [diff] [blame] | 837 | #endif |
| 838 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 839 | #if defined(MBEDTLS_THREADING_PTHREAD) |
| 840 | #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL) |
| 841 | #error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 842 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 843 | #define MBEDTLS_THREADING_IMPL |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 844 | #endif |
| 845 | |
Hanno Becker | f6cc3cd | 2019-09-06 11:59:11 +0100 | [diff] [blame] | 846 | /* Ensure that precisely one hash is enabled. */ |
Hanno Becker | 8fbacf9 | 2019-09-03 13:55:19 +0100 | [diff] [blame] | 847 | #if defined(MBEDTLS_MD_SINGLE_HASH) |
| 848 | |
| 849 | #if defined(MBEDTLS_SHA256_C) |
| 850 | #define MBEDTLS_SHA256_ENABLED 1 |
| 851 | #else |
| 852 | #define MBEDTLS_SHA256_ENABLED 0 |
| 853 | #endif /* MBEDTLS_SHA256_C */ |
| 854 | |
| 855 | #if defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA256_NO_SHA224) |
| 856 | #define MBEDTLS_SHA224_ENABLED 1 |
| 857 | #else |
| 858 | #define MBEDTLS_SHA224_ENABLED 0 |
| 859 | #endif /* MBEDTLS_SHA256_C && !MBEDTLS_SHA256_NO_SHA224 */ |
| 860 | |
| 861 | #if defined(MBEDTLS_SHA512_C) |
| 862 | #define MBEDTLS_SHA512_ENABLED 2 |
| 863 | #else |
| 864 | #define MBEDTLS_SHA512_ENABLED 0 |
| 865 | #endif /* MBEDTLS_SHA512_C */ |
| 866 | |
| 867 | #if defined(MBEDTLS_SHA1_C) |
| 868 | #define MBEDTLS_SHA1_ENABLED 1 |
| 869 | #else |
| 870 | #define MBEDTLS_SHA1_ENABLED 0 |
| 871 | #endif /* MBEDTLS_SHA1_C */ |
| 872 | |
| 873 | #if defined(MBEDTLS_MD2_C) |
| 874 | #define MBEDTLS_MD2_ENABLED 1 |
| 875 | #else |
| 876 | #define MBEDTLS_MD2_ENABLED 0 |
| 877 | #endif /* MBEDTLS_MD2_C */ |
| 878 | |
| 879 | #if defined(MBEDTLS_MD4_C) |
| 880 | #define MBEDTLS_MD4_ENABLED 1 |
| 881 | #else |
| 882 | #define MBEDTLS_MD4_ENABLED 0 |
| 883 | #endif /* MBEDTLS_MD4_C */ |
| 884 | |
| 885 | #if defined(MBEDTLS_MD5_C) |
| 886 | #define MBEDTLS_MD5_ENABLED 1 |
| 887 | #else |
| 888 | #define MBEDTLS_MD5_ENABLED 0 |
| 889 | #endif /* MBEDTLS_MD5_C */ |
| 890 | |
| 891 | #if defined(MBEDTLS_RIPEMD160_C) |
| 892 | #define MBEDTLS_RIPEMD160_ENABLED 1 |
| 893 | #else |
| 894 | #define MBEDTLS_RIPEMD160_ENABLED 0 |
| 895 | #endif /* MBEDTLS_RIPEMD160_C */ |
| 896 | |
| 897 | #define MBEDTLS_HASHES_ENABLED \ |
| 898 | ( MBEDTLS_MD2_ENABLED + \ |
| 899 | MBEDTLS_MD4_ENABLED + \ |
| 900 | MBEDTLS_MD5_ENABLED + \ |
| 901 | MBEDTLS_RIPEMD160_ENABLED + \ |
| 902 | MBEDTLS_SHA1_ENABLED + \ |
| 903 | MBEDTLS_SHA256_ENABLED + \ |
| 904 | MBEDTLS_SHA512_ENABLED ) |
| 905 | |
| 906 | #if MBEDTLS_HASHES_ENABLED != 1 |
| 907 | #error "MBEDTLS_MD_SINGLE_HASH must be used with precisely one hash algorithm enabled." |
| 908 | #endif |
| 909 | |
| 910 | #undef MBEDTLS_HASHES_ENABLED |
| 911 | #endif /* MBEDTLS_MD_SINGLE_HASH */ |
| 912 | |
Andrzej Kurek | ad3c4ff | 2020-12-21 08:11:36 -0500 | [diff] [blame] | 913 | #if defined(MBEDTLS_SSL_DELAYED_SERVER_CERT_VERIFICATION) && !defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) |
| 914 | #error "MBEDTLS_SSL_DELAYED_SERVER_CERT_VERIFICATION can only be used with MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
Hannes Tschofenig | c7f6d7f | 2020-12-03 15:47:31 +0100 | [diff] [blame] | 915 | #endif |
| 916 | |
Hannes Tschofenig | 3cb3db7 | 2020-12-03 17:35:06 +0100 | [diff] [blame] | 917 | |
Andrzej Kurek | 6b5c9a3 | 2020-12-21 08:02:59 -0500 | [diff] [blame] | 918 | #if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) && !defined(MBEDTLS_USE_TINYCRYPT) |
| 919 | #error "MBEDTLS_SSL_EARLY_KEY_COMPUTATION can only be used with MBEDTLS_USE_TINYCRYPT" |
Hannes Tschofenig | 3cb3db7 | 2020-12-03 17:35:06 +0100 | [diff] [blame] | 920 | #endif |
| 921 | |
Manuel Pégourié-Gonnard | 8b5e6bd | 2019-09-20 08:57:18 +0200 | [diff] [blame] | 922 | /* |
| 923 | * Note: the dependency on TinyCrypt is reflected in several ways in the code: |
| 924 | * |
| 925 | * 1. We only define the various MBEDTLS_PK_INFO_{TYPE}_{FIELD} macros for |
| 926 | * TYPE == ECKEY, resolving to the TinyCrypt version. |
| 927 | * 2. In pk_init() and pk_free() we assume that zeroization is a proper way |
| 928 | * to init/free the context, which is true of mbedtls_uecc_keypair, but |
| 929 | * might not always hold otherwise (think hardware-accelerated ECP_ALT). |
| 930 | * 3. We rely on the fact that MBEDTLS_ECP_RESTARTABLE is disabled - code |
| 931 | * paths (and pk_info fields) that are guarded by this are currently not |
| 932 | * handled by the internal abstraction layers enabling PK_SINGLE_TYPE. |
| 933 | * |
| 934 | * If this dependency is ever removed, the above points need to be addressed |
| 935 | * in the code. |
| 936 | */ |
Manuel Pégourié-Gonnard | 1c1cc0d | 2019-09-19 10:45:14 +0200 | [diff] [blame] | 937 | #if defined(MBEDTLS_PK_SINGLE_TYPE) && !defined(MBEDTLS_USE_TINYCRYPT) |
| 938 | #error "MBEDTLS_PK_SINGLE_TYPE can only be used with MBEDTLS_USE_TINYCRYPT" |
| 939 | #endif |
| 940 | |
Manuel Pégourié-Gonnard | 8b5e6bd | 2019-09-20 08:57:18 +0200 | [diff] [blame] | 941 | /* Note: code paths that depend on MBEDTLS_PK_RSA_ALT_SUPPORT are not ported |
| 942 | * to the internal abstraction layers that enable PK_SINGLE_TYPE. */ |
Manuel Pégourié-Gonnard | 1c1cc0d | 2019-09-19 10:45:14 +0200 | [diff] [blame] | 943 | #if defined(MBEDTLS_PK_SINGLE_TYPE) && defined(MBEDTLS_PK_RSA_ALT_SUPPORT) |
| 944 | #error "MBEDTLS_PK_SINGLE_TYPE is not compatible with MBEDTLS_PK_RSA_ALT_SUPPORT" |
| 945 | #endif |
| 946 | |
Manuel Pégourié-Gonnard | 8b5e6bd | 2019-09-20 08:57:18 +0200 | [diff] [blame] | 947 | /* This is to avoid a situation where RSA is available, but not through the PK |
| 948 | * layer, which might surprise user code. */ |
Manuel Pégourié-Gonnard | 1c1cc0d | 2019-09-19 10:45:14 +0200 | [diff] [blame] | 949 | #if defined(MBEDTLS_PK_SINGLE_TYPE) && defined(MBEDTLS_RSA_C) |
| 950 | #error "MBEDTLS_PK_SINGLE_TYPE is not compatible with MBEDTLS_RSA_C" |
| 951 | #endif |
| 952 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 953 | #if defined(MBEDTLS_THREADING_ALT) |
| 954 | #if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL) |
| 955 | #error "MBEDTLS_THREADING_ALT defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 956 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 957 | #define MBEDTLS_THREADING_IMPL |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 958 | #endif |
| 959 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 960 | #if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL) |
| 961 | #error "MBEDTLS_THREADING_C defined, single threading implementation required" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 962 | #endif |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 963 | #undef MBEDTLS_THREADING_IMPL |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 964 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 965 | #if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C) |
| 966 | #error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 967 | #endif |
| 968 | |
Hanno Becker | 61b05e5 | 2019-08-23 15:24:34 +0100 | [diff] [blame] | 969 | #if defined(MBEDTLS_X509_USE_C) && \ |
| 970 | ( !defined(MBEDTLS_OID_C) || \ |
| 971 | !defined(MBEDTLS_ASN1_PARSE_C) || \ |
| 972 | !defined(MBEDTLS_PK_PARSE_C) ) |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 973 | #error "MBEDTLS_X509_USE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 974 | #endif |
| 975 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 976 | #if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ |
| 977 | !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) || \ |
| 978 | !defined(MBEDTLS_PK_WRITE_C) ) |
| 979 | #error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites" |
Manuel Pégourié-Gonnard | 14d5595 | 2014-04-30 12:35:08 +0200 | [diff] [blame] | 980 | #endif |
| 981 | |
Andrzej Kurek | 825ebd4 | 2020-05-18 11:47:25 -0400 | [diff] [blame] | 982 | #if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C) |
| 983 | #error "MBEDTLS_CERTS_C defined, but not all prerequisites" |
| 984 | #endif |
| 985 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 986 | #if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) |
| 987 | #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] | 988 | #endif |
| 989 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 990 | #if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) |
| 991 | #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] | 992 | #endif |
| 993 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 994 | #if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) ) |
| 995 | #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] | 996 | #endif |
| 997 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 998 | #if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) ) |
| 999 | #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] | 1000 | #endif |
| 1001 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1002 | #if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) ) |
| 1003 | #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] | 1004 | #endif |
| 1005 | |
Hanno Becker | 843b71a | 2019-06-25 09:39:21 +0100 | [diff] [blame] | 1006 | #if defined(MBEDTLS_X509_CRT_REMOVE_TIME) && \ |
| 1007 | defined(MBEDTLS_HAVE_TIME_DATE) |
| 1008 | #error "MBEDTLS_X509_CRT_REMOVE_TIME and MBEDTLS_HAVE_TIME_DATE cannot be defined simultaneously" |
| 1009 | #endif |
| 1010 | |
Andres Amaya Garcia | d7fce00 | 2017-07-20 11:49:32 +0100 | [diff] [blame] | 1011 | #if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64) |
| 1012 | #error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously" |
| 1013 | #endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */ |
| 1014 | |
Andres Amaya Garcia | 93db11a | 2017-07-20 12:11:19 +0100 | [diff] [blame] | 1015 | #if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \ |
| 1016 | defined(MBEDTLS_HAVE_ASM) |
Andres Amaya Garcia | b39467d | 2017-07-20 13:21:15 +0100 | [diff] [blame] | 1017 | #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] | 1018 | #endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */ |
| 1019 | |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 1020 | /* |
| 1021 | * Avoid warning from -pedantic. This is a convenient place for this |
| 1022 | * workaround since this is included by every single file before the |
Antonin Décimo | d5f4759 | 2019-01-23 15:24:37 +0100 | [diff] [blame] | 1023 | * #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] | 1024 | */ |
| 1025 | typedef int mbedtls_iso_c_forbids_empty_translation_units; |
| 1026 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 1027 | #endif /* MBEDTLS_CHECK_CONFIG_H */ |