blob: d271049857cb8afcc91dadd7f5f1e4259c940ab4 [file] [log] [blame]
Bence Szépkúti5ab73032021-05-27 11:25:03 +02001/**
Ronald Cron135f2ae2023-02-08 12:25:38 +01002 * \file mbedtls/build_info.h
Bence Szépkúti5ab73032021-05-27 11:25:03 +02003 *
4 * \brief Build-time configuration info
5 *
6 * Include this file if you need to depend on the
Bence Szépkútie55a8212021-06-28 15:15:56 +01007 * configuration options defined in mbedtls_config.h or MBEDTLS_CONFIG_FILE
Bence Szépkúti5ab73032021-05-27 11:25:03 +02008 */
Gilles Peskine449bd832023-01-11 14:50:10 +01009/*
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úti5ab73032021-05-27 11:25:03 +020025
26#ifndef MBEDTLS_BUILD_INFO_H
27#define MBEDTLS_BUILD_INFO_H
28
Bence Szépkúti04982f72021-06-21 14:40:51 +020029/*
30 * This set of compile-time defines can be used to determine the version number
Bence Szépkúti1b2a8832021-06-28 10:26:11 +010031 * of the Mbed TLS library used. Run-time variables for the same can be found in
Bence Szépkúti04982f72021-06-21 14:40:51 +020032 * version.h
33 */
34
35/**
36 * The version number x.y.z is split into three parts.
37 * Major, Minor, Patchlevel
38 */
Dave Rodgman1bc9e932021-07-01 09:20:13 +010039#define MBEDTLS_VERSION_MAJOR 3
Paul Elliottdb67e992023-03-23 10:57:39 +000040#define MBEDTLS_VERSION_MINOR 4
Dave Rodgman48223bc2022-12-08 14:43:19 +000041#define MBEDTLS_VERSION_PATCH 0
Bence Szépkúti04982f72021-06-21 14:40:51 +020042
43/**
44 * The single version number has the following structure:
45 * MMNNPP00
46 * Major version | Minor version | Patch version
47 */
Paul Elliottdb67e992023-03-23 10:57:39 +000048#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úti04982f72021-06-21 14:40:51 +020051
Bence Szépkútic5c9eb42021-05-27 23:31:30 +020052#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
53#define _CRT_SECURE_NO_DEPRECATE 1
54#endif
55
Gilles Peskine6157fee2022-11-23 16:13:13 +010056/* Define `inline` on some non-C99-compliant compilers. */
Gilles Peskine449bd832023-01-11 14:50:10 +010057#if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \
Gilles Peskine6157fee2022-11-23 16:13:13 +010058 !defined(inline) && !defined(__cplusplus)
59#define inline __inline
60#endif
61
Bence Szépkúti5ab73032021-05-27 11:25:03 +020062#if !defined(MBEDTLS_CONFIG_FILE)
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +020063#include "mbedtls/mbedtls_config.h"
Bence Szépkúti5ab73032021-05-27 11:25:03 +020064#else
65#include MBEDTLS_CONFIG_FILE
66#endif
67
Bence Szépkúti1cafe5c2021-06-22 09:30:08 +020068#if defined(MBEDTLS_CONFIG_VERSION) && ( \
69 MBEDTLS_CONFIG_VERSION < 0x03000000 || \
Gilles Peskine449bd832023-01-11 14:50:10 +010070 MBEDTLS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER)
Bence Szépkútib2e23de2021-06-21 15:53:07 +020071#error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported"
Bence Szépkútiba7248a2021-05-31 16:53:56 +020072#endif
73
Bence Szépkútic5c9eb42021-05-27 23:31:30 +020074/* 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
Manuel Pégourié-Gonnard49e67f82023-03-16 11:39:20 +010083/* Auto-enable MBEDTLS_MD_C if needed by a module that didn't require it
84 * in a previous release, to ensure backwards compatibility.
85 */
86#if defined(MBEDTLS_PKCS5_C)
87#define MBEDTLS_MD_C
88#endif
89
Yanray Wang63976732023-05-17 12:41:25 +080090/* PSA crypto specific configuration options */
91#if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \
92 defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */
93#include "mbedtls/config_psa.h"
94#endif
95
Manuel Pégourié-Gonnardb9b630d2023-02-16 19:07:31 +010096/* Auto-enable MBEDTLS_MD_LIGHT based on MBEDTLS_MD_C.
97 * This allows checking for MD_LIGHT rather than MD_LIGHT || MD_C.
98 */
99#if defined(MBEDTLS_MD_C)
100#define MBEDTLS_MD_LIGHT
101#endif
102
Manuel Pégourié-Gonnard49e67f82023-03-16 11:39:20 +0100103/* Auto-enable MBEDTLS_MD_LIGHT if needed by a module that didn't require it
104 * in a previous release, to ensure backwards compatibility.
Manuel Pégourié-Gonnard83162092023-03-06 23:58:50 +0100105 */
Manuel Pégourié-Gonnard41bc8b62023-03-14 23:59:24 +0100106#if defined(MBEDTLS_ECJPAKE_C) || \
107 defined(MBEDTLS_PEM_PARSE_C) || \
Manuel Pégourié-Gonnard5cd4b642023-02-02 13:14:59 +0100108 defined(MBEDTLS_ENTROPY_C) || \
Manuel Pégourié-Gonnardbe97afe2023-03-16 10:00:54 +0100109 defined(MBEDTLS_PKCS12_C) || \
Manuel Pégourié-Gonnardb33ef742023-03-07 00:04:16 +0100110 defined(MBEDTLS_RSA_C)
Manuel Pégourié-Gonnard83162092023-03-06 23:58:50 +0100111#define MBEDTLS_MD_LIGHT
112#endif
113
Valerio Setti151bdf92023-04-07 11:44:58 +0200114/* MBEDTLS_ECP_C now consists of MBEDTLS_ECP_LIGHT plus functions for curve
115 * arithmetic. As a consequence if MBEDTLS_ECP_C is required for some reason,
116 * then MBEDTLS_ECP_LIGHT should be enabled as well. */
Valerio Settifd122f42023-04-05 18:15:32 +0200117#if defined(MBEDTLS_ECP_C)
118#define MBEDTLS_ECP_LIGHT
119#endif
120
Gilles Peskine95c91522023-02-22 22:20:24 +0100121/* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT
122 * is defined as well to include all PSA code.
123 */
124#if defined(MBEDTLS_PSA_CRYPTO_C)
125#define MBEDTLS_PSA_CRYPTO_CLIENT
126#endif /* MBEDTLS_PSA_CRYPTO_C */
127
Gilles Peskinefd943042022-10-11 20:59:29 +0200128/* The PK wrappers need pk_write functions to format RSA key objects
129 * when they are dispatching to the PSA API. This happens under USE_PSA_CRYPTO,
Gilles Peskinebbccdd42022-10-04 23:00:42 +0200130 * and also even without USE_PSA_CRYPTO for mbedtls_pk_sign_ext(). */
Gilles Peskinefd943042022-10-11 20:59:29 +0200131#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C)
132#define MBEDTLS_PK_C
133#define MBEDTLS_PK_WRITE_C
Gilles Peskinefcee7402022-10-11 21:15:24 +0200134#define MBEDTLS_PK_PARSE_C
Gilles Peskinefd943042022-10-11 20:59:29 +0200135#endif
136
Manuel Pégourié-Gonnard5a51d0d2023-03-22 13:04:08 +0100137/* The following blocks make it easier to disable all of TLS,
138 * or of TLS 1.2 or 1.3 or DTLS, without having to manually disable all
Manuel Pégourié-Gonnard70a1b6d2023-03-24 10:30:40 +0100139 * key exchanges, options and extensions related to them. */
Manuel Pégourié-Gonnard5a51d0d2023-03-22 13:04:08 +0100140
141#if !defined(MBEDTLS_SSL_TLS_C)
142#undef MBEDTLS_SSL_CLI_C
143#undef MBEDTLS_SSL_SRV_C
144#undef MBEDTLS_SSL_PROTO_TLS1_3
145#undef MBEDTLS_SSL_PROTO_TLS1_2
146#undef MBEDTLS_SSL_PROTO_DTLS
147#endif
148
149#if !defined(MBEDTLS_SSL_PROTO_DTLS)
150#undef MBEDTLS_SSL_DTLS_ANTI_REPLAY
151#undef MBEDTLS_SSL_DTLS_CONNECTION_ID
152#undef MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT
153#undef MBEDTLS_SSL_DTLS_HELLO_VERIFY
154#undef MBEDTLS_SSL_DTLS_SRTP
155#undef MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
156#endif
157
Ronald Cron571f1ff2022-10-04 09:33:27 +0200158#if !defined(MBEDTLS_SSL_PROTO_TLS1_2)
Manuel Pégourié-Gonnard5a51d0d2023-03-22 13:04:08 +0100159#undef MBEDTLS_SSL_ENCRYPT_THEN_MAC
160#undef MBEDTLS_SSL_EXTENDED_MASTER_SECRET
161#undef MBEDTLS_SSL_RENEGOTIATION
Ronald Cron571f1ff2022-10-04 09:33:27 +0200162#undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
163#undef MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
164#undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
165#undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
166#undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
167#undef MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
168#undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
169#undef MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
170#undef MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
171#undef MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
172#undef MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
173#endif
174
Ronald Crond8d2ea52022-10-04 15:48:06 +0200175#if !defined(MBEDTLS_SSL_PROTO_TLS1_3)
176#undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
177#undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
178#undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
Xiaokang Qian4ef4c892022-10-25 13:39:16 +0000179#undef MBEDTLS_SSL_EARLY_DATA
Ronald Crond8d2ea52022-10-04 15:48:06 +0200180#endif
181
182#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED) || \
183 defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
184#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_PSK_ENABLED
185#endif
186
187#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) || \
188 defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
189#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED
190#endif
191
Przemek Stekiela06787a2022-09-02 14:41:44 +0200192/* Make sure all configuration symbols are set before including check_config.h,
193 * even the ones that are calculated programmatically. */
Bence Szépkútic5c9eb42021-05-27 23:31:30 +0200194#include "mbedtls/check_config.h"
195
Bence Szépkúti5ab73032021-05-27 11:25:03 +0200196#endif /* MBEDTLS_BUILD_INFO_H */