• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * \file build_info.h
3  *
4  * \brief Build-time configuration info
5  *
6  *  Include this file if you need to depend on the
7  *  configuration options defined in mbedtls_config.h or MBEDTLS_CONFIG_FILE
8  */
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 
29 /*
30  * This set of compile-time defines can be used to determine the version number
31  * of the Mbed TLS library used. Run-time variables for the same can be found in
32  * version.h
33  */
34 
35 /**
36  * The version number x.y.z is split into three parts.
37  * Major, Minor, Patchlevel
38  */
39 #define MBEDTLS_VERSION_MAJOR  3
40 #define MBEDTLS_VERSION_MINOR  4
41 #define MBEDTLS_VERSION_PATCH  1
42 
43 /**
44  * The single version number has the following structure:
45  *    MMNNPP00
46  *    Major version | Minor version | Patch version
47  */
48 #define MBEDTLS_VERSION_NUMBER         0x03040100
49 #define MBEDTLS_VERSION_STRING         "3.4.1"
50 #define MBEDTLS_VERSION_STRING_FULL    "mbed TLS 3.4.1"
51 
52 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
53 #define _CRT_SECURE_NO_DEPRECATE 1
54 #endif
55 
56 /* 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 
62 #if !defined(MBEDTLS_CONFIG_FILE)
63 #include "mbedtls/mbedtls_config.h"
64 #else
65 #include MBEDTLS_CONFIG_FILE
66 #endif
67 
68 #if !defined(MBEDTLS_ECP_RESTARTABLE)
69 #define MBEDTLS_ECP_RESTARTABLE
70 #endif
71 
72 #if defined(MBEDTLS_CONFIG_VERSION) && ( \
73     MBEDTLS_CONFIG_VERSION < 0x03000000 || \
74                              MBEDTLS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER)
75 #error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported"
76 #endif
77 
78 /* Target and application specific configurations
79  *
80  * Allow user to override any previous default.
81  *
82  */
83 #if defined(MBEDTLS_USER_CONFIG_FILE)
84 #include MBEDTLS_USER_CONFIG_FILE
85 #endif
86 
87 /* Auto-enable MBEDTLS_MD_LIGHT based on MBEDTLS_MD_C.
88  * This allows checking for MD_LIGHT rather than MD_LIGHT || MD_C.
89  */
90 #if defined(MBEDTLS_MD_C)
91 #define MBEDTLS_MD_LIGHT
92 #endif
93 
94 /* Auto-enable MBEDTLS_MD_LIGHT if some module needs it.
95  */
96 #if defined(MBEDTLS_PEM_PARSE_C) || \
97     defined(MBEDTLS_RSA_C)
98 #define MBEDTLS_MD_LIGHT
99 #endif
100 
101 /* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT
102  * is defined as well to include all PSA code.
103  */
104 #if defined(MBEDTLS_PSA_CRYPTO_C)
105 #define MBEDTLS_PSA_CRYPTO_CLIENT
106 #endif /* MBEDTLS_PSA_CRYPTO_C */
107 
108 /* The PK wrappers need pk_write functions to format RSA key objects
109  * when they are dispatching to the PSA API. This happens under USE_PSA_CRYPTO,
110  * and also even without USE_PSA_CRYPTO for mbedtls_pk_sign_ext(). */
111 #if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_RSA_C)
112 #define MBEDTLS_PK_C
113 #define MBEDTLS_PK_WRITE_C
114 #define MBEDTLS_PK_PARSE_C
115 #endif
116 
117 #if !defined(MBEDTLS_SSL_PROTO_TLS1_2)
118 #undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
119 #undef MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
120 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
121 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
122 #undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
123 #undef MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
124 #undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
125 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
126 #undef MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
127 #undef MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
128 #undef MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
129 #endif
130 
131 #if !defined(MBEDTLS_SSL_PROTO_TLS1_3)
132 #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
133 #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
134 #undef MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
135 #undef MBEDTLS_SSL_EARLY_DATA
136 #endif
137 
138 #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED) || \
139     defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
140 #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_PSK_ENABLED
141 #endif
142 
143 #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) || \
144     defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED)
145 #define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED
146 #endif
147 
148 /* Make sure all configuration symbols are set before including check_config.h,
149  * even the ones that are calculated programmatically. */
150 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \
151     defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */
152 #include "mbedtls/config_psa.h"
153 #endif
154 
155 #include "mbedtls/check_config.h"
156 
157 #endif /* MBEDTLS_BUILD_INFO_H */
158