blob: 362ce2fd59c3e2132666a3b4618bca2d733f6c1d [file] [log] [blame]
Bence Szépkúti5ab73032021-05-27 11:25:03 +02001/**
2 * \file build_info.h
3 *
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 */
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 */
25
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 Elliott20362cd2022-07-08 12:21:35 +010040#define MBEDTLS_VERSION_MINOR 2
Paul Elliottcd08ba02022-07-12 10:36:53 +010041#define MBEDTLS_VERSION_PATCH 1
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 Elliottcd08ba02022-07-12 10:36:53 +010048#define MBEDTLS_VERSION_NUMBER 0x03020100
49#define MBEDTLS_VERSION_STRING "3.2.1"
50#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 3.2.1"
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. */
57#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
58 !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 || \
Bence Szépkútia1d1f5b2021-06-28 09:49:04 +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
Gilles Peskinefd943042022-10-11 20:59:29 +020083/* The PK wrappers need pk_write functions to format RSA key objects
84 * when they are dispatching to the PSA API. This happens under USE_PSA_CRYPTO,
85 * and also even without USE_PSA_CRYPTO for mbedtls_pk_sign_ext().
86 * PSA crypto also needs pk_write to export RSA keys (otherwise the build
87 * goes through but psa_export_key() and psa_export_public_key() fail on
Gilles Peskinefcee7402022-10-11 21:15:24 +020088 * RSA keys), and pk_parse to work with RSA keys in almost any way.
Gilles Peskinefd943042022-10-11 20:59:29 +020089 */
90#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C)
91#define MBEDTLS_PK_C
92#define MBEDTLS_PK_WRITE_C
Gilles Peskinefcee7402022-10-11 21:15:24 +020093#define MBEDTLS_PK_PARSE_C
Gilles Peskinefd943042022-10-11 20:59:29 +020094#endif
95
96/* Under MBEDTLS_USE_PSA_CRYPTO, the pk module needs pk_write functions
97 * to pass ECC keys to PSA. */
98#if defined(MBEDTLS_PK_C) && \
99 defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_ECP_C)
Andrzej Kurek8d2864d2022-01-17 15:30:06 +0100100#define MBEDTLS_PK_WRITE_C
101#endif
Przemek Stekiela06787a2022-09-02 14:41:44 +0200102
Ronald Cron571f1ff2022-10-04 09:33:27 +0200103#if !defined(MBEDTLS_SSL_PROTO_TLS1_2)
104#undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
105#undef MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
106#undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
107#undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
108#undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
109#undef MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
110#undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
111#undef MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
112#undef MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
113#undef MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
114#undef MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
115#endif
116
Ronald Crond8d2ea52022-10-04 15:48:06 +0200117#if !defined(MBEDTLS_SSL_PROTO_TLS1_3)
118#undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
119#undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
120#undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
Xiaokang Qian4ef4c892022-10-25 13:39:16 +0000121#undef MBEDTLS_SSL_EARLY_DATA
Ronald Crond8d2ea52022-10-04 15:48:06 +0200122#endif
123
124#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED) || \
125 defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
126#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_PSK_ENABLED
127#endif
128
129#if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) || \
130 defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
131#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED
132#endif
133
Przemek Stekiela06787a2022-09-02 14:41:44 +0200134/* Make sure all configuration symbols are set before including check_config.h,
135 * even the ones that are calculated programmatically. */
136#if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \
137 defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */
Bence Szépkútic5c9eb42021-05-27 23:31:30 +0200138#include "mbedtls/config_psa.h"
139#endif
140
141#include "mbedtls/check_config.h"
142
Bence Szépkúti5ab73032021-05-27 11:25:03 +0200143#endif /* MBEDTLS_BUILD_INFO_H */