Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 1 | /** |
Ronald Cron | 135f2ae | 2023-02-08 12:25:38 +0100 | [diff] [blame] | 2 | * \file mbedtls/build_info.h |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 3 | * |
| 4 | * \brief Build-time configuration info |
| 5 | * |
| 6 | * Include this file if you need to depend on the |
Bence Szépkúti | e55a821 | 2021-06-28 15:15:56 +0100 | [diff] [blame] | 7 | * configuration options defined in mbedtls_config.h or MBEDTLS_CONFIG_FILE |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 8 | */ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 9 | /* |
| 10 | * Copyright The Mbed TLS Contributors |
| 11 | * SPDX-License-Identifier: Apache-2.0 |
| 12 | * |
| 13 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 14 | * not use this file except in compliance with the License. |
| 15 | * You may obtain a copy of the License at |
| 16 | * |
| 17 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 18 | * |
| 19 | * Unless required by applicable law or agreed to in writing, software |
| 20 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 | * See the License for the specific language governing permissions and |
| 23 | * limitations under the License. |
| 24 | */ |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 25 | |
| 26 | #ifndef MBEDTLS_BUILD_INFO_H |
| 27 | #define MBEDTLS_BUILD_INFO_H |
| 28 | |
Bence Szépkúti | 04982f7 | 2021-06-21 14:40:51 +0200 | [diff] [blame] | 29 | /* |
| 30 | * This set of compile-time defines can be used to determine the version number |
Bence Szépkúti | 1b2a883 | 2021-06-28 10:26:11 +0100 | [diff] [blame] | 31 | * of the Mbed TLS library used. Run-time variables for the same can be found in |
Bence Szépkúti | 04982f7 | 2021-06-21 14:40:51 +0200 | [diff] [blame] | 32 | * version.h |
| 33 | */ |
| 34 | |
| 35 | /** |
| 36 | * The version number x.y.z is split into three parts. |
| 37 | * Major, Minor, Patchlevel |
| 38 | */ |
Dave Rodgman | 1bc9e93 | 2021-07-01 09:20:13 +0100 | [diff] [blame] | 39 | #define MBEDTLS_VERSION_MAJOR 3 |
Paul Elliott | db67e99 | 2023-03-23 10:57:39 +0000 | [diff] [blame] | 40 | #define MBEDTLS_VERSION_MINOR 4 |
Dave Rodgman | 48223bc | 2022-12-08 14:43:19 +0000 | [diff] [blame] | 41 | #define MBEDTLS_VERSION_PATCH 0 |
Bence Szépkúti | 04982f7 | 2021-06-21 14:40:51 +0200 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * The single version number has the following structure: |
| 45 | * MMNNPP00 |
| 46 | * Major version | Minor version | Patch version |
| 47 | */ |
Paul Elliott | db67e99 | 2023-03-23 10:57:39 +0000 | [diff] [blame] | 48 | #define MBEDTLS_VERSION_NUMBER 0x03040000 |
| 49 | #define MBEDTLS_VERSION_STRING "3.4.0" |
| 50 | #define MBEDTLS_VERSION_STRING_FULL "mbed TLS 3.4.0" |
Bence Szépkúti | 04982f7 | 2021-06-21 14:40:51 +0200 | [diff] [blame] | 51 | |
Bence Szépkúti | c5c9eb4 | 2021-05-27 23:31:30 +0200 | [diff] [blame] | 52 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) |
| 53 | #define _CRT_SECURE_NO_DEPRECATE 1 |
| 54 | #endif |
| 55 | |
Gilles Peskine | 6157fee | 2022-11-23 16:13:13 +0100 | [diff] [blame] | 56 | /* Define `inline` on some non-C99-compliant compilers. */ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 57 | #if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \ |
Gilles Peskine | 6157fee | 2022-11-23 16:13:13 +0100 | [diff] [blame] | 58 | !defined(inline) && !defined(__cplusplus) |
| 59 | #define inline __inline |
| 60 | #endif |
| 61 | |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 62 | #if !defined(MBEDTLS_CONFIG_FILE) |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 63 | #include "mbedtls/mbedtls_config.h" |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 64 | #else |
| 65 | #include MBEDTLS_CONFIG_FILE |
| 66 | #endif |
| 67 | |
Bence Szépkúti | 1cafe5c | 2021-06-22 09:30:08 +0200 | [diff] [blame] | 68 | #if defined(MBEDTLS_CONFIG_VERSION) && ( \ |
| 69 | MBEDTLS_CONFIG_VERSION < 0x03000000 || \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 70 | MBEDTLS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER) |
Bence Szépkúti | b2e23de | 2021-06-21 15:53:07 +0200 | [diff] [blame] | 71 | #error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported" |
Bence Szépkúti | ba7248a | 2021-05-31 16:53:56 +0200 | [diff] [blame] | 72 | #endif |
| 73 | |
Bence Szépkúti | c5c9eb4 | 2021-05-27 23:31:30 +0200 | [diff] [blame] | 74 | /* Target and application specific configurations |
| 75 | * |
| 76 | * Allow user to override any previous default. |
| 77 | * |
| 78 | */ |
| 79 | #if defined(MBEDTLS_USER_CONFIG_FILE) |
| 80 | #include MBEDTLS_USER_CONFIG_FILE |
| 81 | #endif |
| 82 | |
Yanray Wang | 1ed226f | 2023-05-05 11:31:11 +0800 | [diff] [blame^] | 83 | /* Auto-enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY if |
| 84 | * MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH and MBEDTLS_CTR_DRBG_C defined |
| 85 | * to ensure a 128-bit key size in CTR_DRBG. |
| 86 | */ |
| 87 | #if defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && defined(MBEDTLS_CTR_DRBG_C) |
| 88 | #define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY |
| 89 | #endif |
| 90 | |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 91 | /* Auto-enable MBEDTLS_MD_C if needed by a module that didn't require it |
| 92 | * in a previous release, to ensure backwards compatibility. |
| 93 | */ |
| 94 | #if defined(MBEDTLS_PKCS5_C) |
| 95 | #define MBEDTLS_MD_C |
| 96 | #endif |
| 97 | |
Manuel Pégourié-Gonnard | b9b630d | 2023-02-16 19:07:31 +0100 | [diff] [blame] | 98 | /* Auto-enable MBEDTLS_MD_LIGHT based on MBEDTLS_MD_C. |
| 99 | * This allows checking for MD_LIGHT rather than MD_LIGHT || MD_C. |
| 100 | */ |
| 101 | #if defined(MBEDTLS_MD_C) |
| 102 | #define MBEDTLS_MD_LIGHT |
| 103 | #endif |
| 104 | |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 105 | /* Auto-enable MBEDTLS_MD_LIGHT if needed by a module that didn't require it |
| 106 | * in a previous release, to ensure backwards compatibility. |
Manuel Pégourié-Gonnard | 8316209 | 2023-03-06 23:58:50 +0100 | [diff] [blame] | 107 | */ |
Manuel Pégourié-Gonnard | 41bc8b6 | 2023-03-14 23:59:24 +0100 | [diff] [blame] | 108 | #if defined(MBEDTLS_ECJPAKE_C) || \ |
| 109 | defined(MBEDTLS_PEM_PARSE_C) || \ |
Manuel Pégourié-Gonnard | 5cd4b64 | 2023-02-02 13:14:59 +0100 | [diff] [blame] | 110 | defined(MBEDTLS_ENTROPY_C) || \ |
Manuel Pégourié-Gonnard | be97afe | 2023-03-16 10:00:54 +0100 | [diff] [blame] | 111 | defined(MBEDTLS_PKCS12_C) || \ |
Manuel Pégourié-Gonnard | b33ef74 | 2023-03-07 00:04:16 +0100 | [diff] [blame] | 112 | defined(MBEDTLS_RSA_C) |
Manuel Pégourié-Gonnard | 8316209 | 2023-03-06 23:58:50 +0100 | [diff] [blame] | 113 | #define MBEDTLS_MD_LIGHT |
| 114 | #endif |
| 115 | |
Valerio Setti | 151bdf9 | 2023-04-07 11:44:58 +0200 | [diff] [blame] | 116 | /* MBEDTLS_ECP_C now consists of MBEDTLS_ECP_LIGHT plus functions for curve |
| 117 | * arithmetic. As a consequence if MBEDTLS_ECP_C is required for some reason, |
| 118 | * then MBEDTLS_ECP_LIGHT should be enabled as well. */ |
Valerio Setti | fd122f4 | 2023-04-05 18:15:32 +0200 | [diff] [blame] | 119 | #if defined(MBEDTLS_ECP_C) |
| 120 | #define MBEDTLS_ECP_LIGHT |
| 121 | #endif |
| 122 | |
Gilles Peskine | 95c9152 | 2023-02-22 22:20:24 +0100 | [diff] [blame] | 123 | /* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT |
| 124 | * is defined as well to include all PSA code. |
| 125 | */ |
| 126 | #if defined(MBEDTLS_PSA_CRYPTO_C) |
| 127 | #define MBEDTLS_PSA_CRYPTO_CLIENT |
| 128 | #endif /* MBEDTLS_PSA_CRYPTO_C */ |
| 129 | |
Gilles Peskine | fd94304 | 2022-10-11 20:59:29 +0200 | [diff] [blame] | 130 | /* The PK wrappers need pk_write functions to format RSA key objects |
| 131 | * when they are dispatching to the PSA API. This happens under USE_PSA_CRYPTO, |
Gilles Peskine | bbccdd4 | 2022-10-04 23:00:42 +0200 | [diff] [blame] | 132 | * and also even without USE_PSA_CRYPTO for mbedtls_pk_sign_ext(). */ |
Gilles Peskine | fd94304 | 2022-10-11 20:59:29 +0200 | [diff] [blame] | 133 | #if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C) |
| 134 | #define MBEDTLS_PK_C |
| 135 | #define MBEDTLS_PK_WRITE_C |
Gilles Peskine | fcee740 | 2022-10-11 21:15:24 +0200 | [diff] [blame] | 136 | #define MBEDTLS_PK_PARSE_C |
Gilles Peskine | fd94304 | 2022-10-11 20:59:29 +0200 | [diff] [blame] | 137 | #endif |
| 138 | |
Manuel Pégourié-Gonnard | 5a51d0d | 2023-03-22 13:04:08 +0100 | [diff] [blame] | 139 | /* The following blocks make it easier to disable all of TLS, |
| 140 | * or of TLS 1.2 or 1.3 or DTLS, without having to manually disable all |
Manuel Pégourié-Gonnard | 70a1b6d | 2023-03-24 10:30:40 +0100 | [diff] [blame] | 141 | * key exchanges, options and extensions related to them. */ |
Manuel Pégourié-Gonnard | 5a51d0d | 2023-03-22 13:04:08 +0100 | [diff] [blame] | 142 | |
| 143 | #if !defined(MBEDTLS_SSL_TLS_C) |
| 144 | #undef MBEDTLS_SSL_CLI_C |
| 145 | #undef MBEDTLS_SSL_SRV_C |
| 146 | #undef MBEDTLS_SSL_PROTO_TLS1_3 |
| 147 | #undef MBEDTLS_SSL_PROTO_TLS1_2 |
| 148 | #undef MBEDTLS_SSL_PROTO_DTLS |
| 149 | #endif |
| 150 | |
| 151 | #if !defined(MBEDTLS_SSL_PROTO_DTLS) |
| 152 | #undef MBEDTLS_SSL_DTLS_ANTI_REPLAY |
| 153 | #undef MBEDTLS_SSL_DTLS_CONNECTION_ID |
| 154 | #undef MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT |
| 155 | #undef MBEDTLS_SSL_DTLS_HELLO_VERIFY |
| 156 | #undef MBEDTLS_SSL_DTLS_SRTP |
| 157 | #undef MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE |
| 158 | #endif |
| 159 | |
Ronald Cron | 571f1ff | 2022-10-04 09:33:27 +0200 | [diff] [blame] | 160 | #if !defined(MBEDTLS_SSL_PROTO_TLS1_2) |
Manuel Pégourié-Gonnard | 5a51d0d | 2023-03-22 13:04:08 +0100 | [diff] [blame] | 161 | #undef MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 162 | #undef MBEDTLS_SSL_EXTENDED_MASTER_SECRET |
| 163 | #undef MBEDTLS_SSL_RENEGOTIATION |
Ronald Cron | 571f1ff | 2022-10-04 09:33:27 +0200 | [diff] [blame] | 164 | #undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
| 165 | #undef MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 166 | #undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 167 | #undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 168 | #undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED |
| 169 | #undef MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED |
| 170 | #undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED |
| 171 | #undef MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED |
| 172 | #undef MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 173 | #undef MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 174 | #undef MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED |
| 175 | #endif |
| 176 | |
Ronald Cron | d8d2ea5 | 2022-10-04 15:48:06 +0200 | [diff] [blame] | 177 | #if !defined(MBEDTLS_SSL_PROTO_TLS1_3) |
| 178 | #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 179 | #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 180 | #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
Xiaokang Qian | 4ef4c89 | 2022-10-25 13:39:16 +0000 | [diff] [blame] | 181 | #undef MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | d8d2ea5 | 2022-10-04 15:48:06 +0200 | [diff] [blame] | 182 | #endif |
| 183 | |
| 184 | #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED) || \ |
| 185 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED) |
| 186 | #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_PSK_ENABLED |
| 187 | #endif |
| 188 | |
| 189 | #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) || \ |
| 190 | defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED) |
| 191 | #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED |
| 192 | #endif |
| 193 | |
Przemek Stekiel | a06787a | 2022-09-02 14:41:44 +0200 | [diff] [blame] | 194 | /* Make sure all configuration symbols are set before including check_config.h, |
| 195 | * even the ones that are calculated programmatically. */ |
| 196 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \ |
| 197 | defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */ |
Bence Szépkúti | c5c9eb4 | 2021-05-27 23:31:30 +0200 | [diff] [blame] | 198 | #include "mbedtls/config_psa.h" |
| 199 | #endif |
| 200 | |
| 201 | #include "mbedtls/check_config.h" |
| 202 | |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 203 | #endif /* MBEDTLS_BUILD_INFO_H */ |