1 /**
2  * \file mbedtls/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 OR GPL-2.0-or-later
12  */
13 
14 #ifndef MBEDTLS_BUILD_INFO_H
15 #define MBEDTLS_BUILD_INFO_H
16 
17 /*
18  * This set of compile-time defines can be used to determine the version number
19  * of the Mbed TLS library used. Run-time variables for the same can be found in
20  * version.h
21  */
22 
23 /**
24  * The version number x.y.z is split into three parts.
25  * Major, Minor, Patchlevel
26  */
27 #define MBEDTLS_VERSION_MAJOR  3
28 #define MBEDTLS_VERSION_MINOR  5
29 #define MBEDTLS_VERSION_PATCH  2
30 
31 /**
32  * The single version number has the following structure:
33  *    MMNNPP00
34  *    Major version | Minor version | Patch version
35  */
36 #define MBEDTLS_VERSION_NUMBER         0x03050200
37 #define MBEDTLS_VERSION_STRING         "3.5.2"
38 #define MBEDTLS_VERSION_STRING_FULL    "Mbed TLS 3.5.2"
39 
40 /* Macros for build-time platform detection */
41 
42 #if !defined(MBEDTLS_ARCH_IS_ARM64) && \
43     (defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC))
44 #define MBEDTLS_ARCH_IS_ARM64
45 #endif
46 
47 #if !defined(MBEDTLS_ARCH_IS_ARM32) && \
48     (defined(__arm__) || defined(_M_ARM) || \
49     defined(_M_ARMT) || defined(__thumb__) || defined(__thumb2__))
50 #define MBEDTLS_ARCH_IS_ARM32
51 #endif
52 
53 #if !defined(MBEDTLS_ARCH_IS_X64) && \
54     (defined(__amd64__) || defined(__x86_64__) || \
55     ((defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)))
56 #define MBEDTLS_ARCH_IS_X64
57 #endif
58 
59 #if !defined(MBEDTLS_ARCH_IS_X86) && \
60     (defined(__i386__) || defined(_X86_) || \
61     (defined(_M_IX86) && !defined(_M_I86)))
62 #define MBEDTLS_ARCH_IS_X86
63 #endif
64 
65 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
66 #define _CRT_SECURE_NO_DEPRECATE 1
67 #endif
68 
69 /* Define `inline` on some non-C99-compliant compilers. */
70 #if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \
71     !defined(inline) && !defined(__cplusplus)
72 #define inline __inline
73 #endif
74 
75 /* X.509, TLS and non-PSA crypto configuration */
76 #if !defined(MBEDTLS_CONFIG_FILE)
77 #include "mbedtls/mbedtls_config.h"
78 #else
79 #include MBEDTLS_CONFIG_FILE
80 #endif
81 
82 #if defined(MBEDTLS_CONFIG_VERSION) && ( \
83     MBEDTLS_CONFIG_VERSION < 0x03000000 || \
84                              MBEDTLS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER)
85 #error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported"
86 #endif
87 
88 /* Target and application specific configurations
89  *
90  * Allow user to override any previous default.
91  *
92  */
93 #if defined(MBEDTLS_USER_CONFIG_FILE)
94 #include MBEDTLS_USER_CONFIG_FILE
95 #endif
96 
97 /* PSA crypto configuration */
98 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
99 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG_FILE)
100 #include MBEDTLS_PSA_CRYPTO_CONFIG_FILE
101 #else
102 #include "psa/crypto_config.h"
103 #endif
104 #if defined(MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE)
105 #include MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
106 #endif
107 #endif /* defined(MBEDTLS_PSA_CRYPTO_CONFIG) */
108 
109 /* Auto-enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY if
110  * MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH and MBEDTLS_CTR_DRBG_C defined
111  * to ensure a 128-bit key size in CTR_DRBG.
112  */
113 #if defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && defined(MBEDTLS_CTR_DRBG_C)
114 #define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
115 #endif
116 
117 /* Auto-enable MBEDTLS_MD_C if needed by a module that didn't require it
118  * in a previous release, to ensure backwards compatibility.
119  */
120 #if defined(MBEDTLS_PKCS5_C)
121 #define MBEDTLS_MD_C
122 #endif
123 
124 /* PSA crypto specific configuration options
125  * - If config_psa.h reads a configuration option in preprocessor directive,
126  *   this symbol should be set before its inclusion. (e.g. MBEDTLS_MD_C)
127  * - If config_psa.h writes a configuration option in conditional directive,
128  *   this symbol should be consulted after its inclusion.
129  *   (e.g. MBEDTLS_MD_LIGHT)
130  */
131 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \
132     defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */
133 #include "mbedtls/config_psa.h"
134 #endif
135 
136 #include "mbedtls/config_adjust_legacy_crypto.h"
137 
138 #include "mbedtls/config_adjust_x509.h"
139 
140 #include "mbedtls/config_adjust_ssl.h"
141 
142 /* Make sure all configuration symbols are set before including check_config.h,
143  * even the ones that are calculated programmatically. */
144 #include "mbedtls/check_config.h"
145 
146 #endif /* MBEDTLS_BUILD_INFO_H */
147