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 |
Minos Galanakis | 31ca313 | 2023-10-03 22:02:18 +0100 | [diff] [blame] | 40 | #define MBEDTLS_VERSION_MINOR 5 |
| 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 | */ |
Minos Galanakis | 31ca313 | 2023-10-03 22:02:18 +0100 | [diff] [blame] | 48 | #define MBEDTLS_VERSION_NUMBER 0x03050000 |
| 49 | #define MBEDTLS_VERSION_STRING "3.5.0" |
| 50 | #define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 3.5.0" |
Bence Szépkúti | 04982f7 | 2021-06-21 14:40:51 +0200 | [diff] [blame] | 51 | |
Jerry Yu | 926221a | 2023-08-18 15:09:02 +0800 | [diff] [blame] | 52 | /* Macros for build-time platform detection */ |
| 53 | |
| 54 | #if !defined(MBEDTLS_ARCH_IS_ARM64) && \ |
| 55 | (defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)) |
| 56 | #define MBEDTLS_ARCH_IS_ARM64 |
| 57 | #endif |
| 58 | |
| 59 | #if !defined(MBEDTLS_ARCH_IS_ARM32) && \ |
| 60 | (defined(__arm__) || defined(_M_ARM) || \ |
| 61 | defined(_M_ARMT) || defined(__thumb__) || defined(__thumb2__)) |
| 62 | #define MBEDTLS_ARCH_IS_ARM32 |
| 63 | #endif |
| 64 | |
| 65 | #if !defined(MBEDTLS_ARCH_IS_X64) && \ |
| 66 | (defined(__amd64__) || defined(__x86_64__) || \ |
| 67 | ((defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC))) |
| 68 | #define MBEDTLS_ARCH_IS_X64 |
| 69 | #endif |
| 70 | |
| 71 | #if !defined(MBEDTLS_ARCH_IS_X86) && \ |
| 72 | (defined(__i386__) || defined(_X86_) || \ |
| 73 | (defined(_M_IX86) && !defined(_M_I86))) |
| 74 | #define MBEDTLS_ARCH_IS_X86 |
| 75 | #endif |
Jerry Yu | 926221a | 2023-08-18 15:09:02 +0800 | [diff] [blame] | 76 | |
Dave Rodgman | 3e52184 | 2023-09-18 10:36:21 +0100 | [diff] [blame^] | 77 | #if !defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64) && \ |
| 78 | (defined(_M_ARM64) || defined(_M_ARM64EC)) |
Dave Rodgman | 0a48717 | 2023-09-15 11:52:06 +0100 | [diff] [blame] | 79 | #define MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64 |
| 80 | #endif |
| 81 | |
Bence Szépkúti | c5c9eb4 | 2021-05-27 23:31:30 +0200 | [diff] [blame] | 82 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) |
| 83 | #define _CRT_SECURE_NO_DEPRECATE 1 |
| 84 | #endif |
| 85 | |
Gilles Peskine | 6157fee | 2022-11-23 16:13:13 +0100 | [diff] [blame] | 86 | /* Define `inline` on some non-C99-compliant compilers. */ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 87 | #if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \ |
Gilles Peskine | 6157fee | 2022-11-23 16:13:13 +0100 | [diff] [blame] | 88 | !defined(inline) && !defined(__cplusplus) |
| 89 | #define inline __inline |
| 90 | #endif |
| 91 | |
Gilles Peskine | a458d48 | 2023-05-17 23:13:06 +0200 | [diff] [blame] | 92 | /* X.509, TLS and non-PSA crypto configuration */ |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 93 | #if !defined(MBEDTLS_CONFIG_FILE) |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 94 | #include "mbedtls/mbedtls_config.h" |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 95 | #else |
| 96 | #include MBEDTLS_CONFIG_FILE |
| 97 | #endif |
| 98 | |
Bence Szépkúti | 1cafe5c | 2021-06-22 09:30:08 +0200 | [diff] [blame] | 99 | #if defined(MBEDTLS_CONFIG_VERSION) && ( \ |
| 100 | MBEDTLS_CONFIG_VERSION < 0x03000000 || \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 101 | MBEDTLS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER) |
Bence Szépkúti | b2e23de | 2021-06-21 15:53:07 +0200 | [diff] [blame] | 102 | #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] | 103 | #endif |
| 104 | |
Bence Szépkúti | c5c9eb4 | 2021-05-27 23:31:30 +0200 | [diff] [blame] | 105 | /* Target and application specific configurations |
| 106 | * |
| 107 | * Allow user to override any previous default. |
| 108 | * |
| 109 | */ |
| 110 | #if defined(MBEDTLS_USER_CONFIG_FILE) |
| 111 | #include MBEDTLS_USER_CONFIG_FILE |
| 112 | #endif |
| 113 | |
Gilles Peskine | a458d48 | 2023-05-17 23:13:06 +0200 | [diff] [blame] | 114 | /* PSA crypto configuration */ |
| 115 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) |
| 116 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG_FILE) |
| 117 | #include MBEDTLS_PSA_CRYPTO_CONFIG_FILE |
| 118 | #else |
| 119 | #include "psa/crypto_config.h" |
| 120 | #endif |
Gilles Peskine | a458d48 | 2023-05-17 23:13:06 +0200 | [diff] [blame] | 121 | #if defined(MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE) |
| 122 | #include MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE |
| 123 | #endif |
Gilles Peskine | 7b7ecf5 | 2023-05-17 23:15:31 +0200 | [diff] [blame] | 124 | #endif /* defined(MBEDTLS_PSA_CRYPTO_CONFIG) */ |
Gilles Peskine | a458d48 | 2023-05-17 23:13:06 +0200 | [diff] [blame] | 125 | |
Yanray Wang | 1ed226f | 2023-05-05 11:31:11 +0800 | [diff] [blame] | 126 | /* Auto-enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY if |
| 127 | * MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH and MBEDTLS_CTR_DRBG_C defined |
| 128 | * to ensure a 128-bit key size in CTR_DRBG. |
| 129 | */ |
| 130 | #if defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && defined(MBEDTLS_CTR_DRBG_C) |
| 131 | #define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY |
| 132 | #endif |
| 133 | |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 134 | /* Auto-enable MBEDTLS_MD_C if needed by a module that didn't require it |
| 135 | * in a previous release, to ensure backwards compatibility. |
| 136 | */ |
| 137 | #if defined(MBEDTLS_PKCS5_C) |
| 138 | #define MBEDTLS_MD_C |
| 139 | #endif |
| 140 | |
Yanray Wang | 419a55e | 2023-05-17 18:22:00 +0800 | [diff] [blame] | 141 | /* PSA crypto specific configuration options |
| 142 | * - If config_psa.h reads a configuration option in preprocessor directive, |
Yanray Wang | 37db332 | 2023-05-22 16:50:35 +0800 | [diff] [blame] | 143 | * this symbol should be set before its inclusion. (e.g. MBEDTLS_MD_C) |
Yanray Wang | 419a55e | 2023-05-17 18:22:00 +0800 | [diff] [blame] | 144 | * - If config_psa.h writes a configuration option in conditional directive, |
| 145 | * this symbol should be consulted after its inclusion. |
| 146 | * (e.g. MBEDTLS_MD_LIGHT) |
| 147 | */ |
Yanray Wang | 6397673 | 2023-05-17 12:41:25 +0800 | [diff] [blame] | 148 | #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \ |
| 149 | defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */ |
| 150 | #include "mbedtls/config_psa.h" |
| 151 | #endif |
| 152 | |
Gilles Peskine | 9d6a63b | 2023-09-04 17:49:07 +0200 | [diff] [blame] | 153 | #include "mbedtls/config_adjust_legacy_crypto.h" |
Valerio Setti | 7c494e7 | 2023-07-27 14:58:53 +0200 | [diff] [blame] | 154 | |
Gilles Peskine | dc720b0 | 2023-09-04 17:50:28 +0200 | [diff] [blame] | 155 | #include "mbedtls/config_adjust_x509.h" |
| 156 | |
Gilles Peskine | edc2379 | 2023-09-04 17:53:11 +0200 | [diff] [blame] | 157 | #include "mbedtls/config_adjust_ssl.h" |
Ronald Cron | d8d2ea5 | 2022-10-04 15:48:06 +0200 | [diff] [blame] | 158 | |
Przemek Stekiel | a06787a | 2022-09-02 14:41:44 +0200 | [diff] [blame] | 159 | /* Make sure all configuration symbols are set before including check_config.h, |
| 160 | * even the ones that are calculated programmatically. */ |
Bence Szépkúti | c5c9eb4 | 2021-05-27 23:31:30 +0200 | [diff] [blame] | 161 | #include "mbedtls/check_config.h" |
| 162 | |
Bence Szépkúti | 5ab7303 | 2021-05-27 11:25:03 +0200 | [diff] [blame] | 163 | #endif /* MBEDTLS_BUILD_INFO_H */ |