blob: 46717608be30a503188e0513edc168f02a3c5416 [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
40#define MBEDTLS_VERSION_MINOR 0
Bence Szépkúti04982f72021-06-21 14:40:51 +020041#define MBEDTLS_VERSION_PATCH 0
42
43/**
44 * The single version number has the following structure:
45 * MMNNPP00
46 * Major version | Minor version | Patch version
47 */
Dave Rodgman1bc9e932021-07-01 09:20:13 +010048#define MBEDTLS_VERSION_NUMBER 0x03000000
49#define MBEDTLS_VERSION_STRING "3.0.0"
50#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 3.0.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 Peskine4b627af2021-07-07 21:02:36 +020056/** \def MBEDTLS_CHECK_RETURN
57 *
58 * This macro appearing at the beginning of the declaration of a function
59 * indicates that its return value should be checked.
60 *
61 * This should appear before most functions returning an error code
62 * (as \c int in the \c mbedtls_xxx API or
63 * as ::psa_status_t in the \c psa_xxx API).
64 */
65#if defined(__GNUC__)
66#define MBEDTLS_CHECK_RETURN __attribute__((warn_unused_result))
67#elif defined(_MSC_VER) && _MSC_VER >= 1700
68#include <sal.h>
69#define MBEDTLS_CHECK_RETURN _Check_return_
70#else
71#define MBEDTLS_CHECK_RETURN
72#endif
73
Bence Szépkúti5ab73032021-05-27 11:25:03 +020074#if !defined(MBEDTLS_CONFIG_FILE)
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +020075#include "mbedtls/mbedtls_config.h"
Bence Szépkúti5ab73032021-05-27 11:25:03 +020076#else
77#include MBEDTLS_CONFIG_FILE
78#endif
79
Bence Szépkúti1cafe5c2021-06-22 09:30:08 +020080#if defined(MBEDTLS_CONFIG_VERSION) && ( \
81 MBEDTLS_CONFIG_VERSION < 0x03000000 || \
Bence Szépkútia1d1f5b2021-06-28 09:49:04 +010082 MBEDTLS_CONFIG_VERSION > MBEDTLS_VERSION_NUMBER )
Bence Szépkútib2e23de2021-06-21 15:53:07 +020083#error "Invalid config version, defined value of MBEDTLS_CONFIG_VERSION is unsupported"
Bence Szépkútiba7248a2021-05-31 16:53:56 +020084#endif
85
Bence Szépkútic5c9eb42021-05-27 23:31:30 +020086/* Target and application specific configurations
87 *
88 * Allow user to override any previous default.
89 *
90 */
91#if defined(MBEDTLS_USER_CONFIG_FILE)
92#include MBEDTLS_USER_CONFIG_FILE
93#endif
94
95#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
96#include "mbedtls/config_psa.h"
97#endif
98
99#include "mbedtls/check_config.h"
100
Bence Szépkúti5ab73032021-05-27 11:25:03 +0200101#endif /* MBEDTLS_BUILD_INFO_H */