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