Mbed TLS v4.1.1
Loading...
Searching...
No Matches
tf-psa-crypto/include/tf-psa-crypto/build_info.h
Go to the documentation of this file.
1
9/*
10 * Copyright The Mbed TLS Contributors
11 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12 */
13
14#ifndef TF_PSA_CRYPTO_BUILD_INFO_H
15#define TF_PSA_CRYPTO_BUILD_INFO_H
16
17/*
18 * Version macros are defined in build_info.h rather than in version.h so that
19 * the user config files have access to them. That way, for example, users who
20 * deploy applications to multiple devices with different versions of
21 * TF-PSA-Crypto can write configurations that depend on the version.
22 */
27#define TF_PSA_CRYPTO_VERSION_MAJOR 1
28#define TF_PSA_CRYPTO_VERSION_MINOR 1
29#define TF_PSA_CRYPTO_VERSION_PATCH 1
30
36#define TF_PSA_CRYPTO_VERSION_NUMBER 0x01010100
37#define TF_PSA_CRYPTO_VERSION_STRING "1.1.1"
38#define TF_PSA_CRYPTO_VERSION_STRING_FULL "TF-PSA-Crypto 1.1.1"
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_THUMB) && \
54 defined(_M_ARMT) || defined(__thumb__) || defined(__thumb2__)
55#define MBEDTLS_ARCH_IS_THUMB
56#endif
57
58#if !defined(MBEDTLS_ARCH_IS_X64) && \
59 (defined(__amd64__) || defined(__x86_64__) || \
60 ((defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)))
61#define MBEDTLS_ARCH_IS_X64
62#endif
63
64#if !defined(MBEDTLS_ARCH_IS_X86) && \
65 (defined(__i386__) || defined(_X86_) || \
66 (defined(_M_IX86) && !defined(_M_I86)))
67#define MBEDTLS_ARCH_IS_X86
68#endif
69
70#if !defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64) && \
71 (defined(_M_ARM64) || defined(_M_ARM64EC))
72#define MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64
73#endif
74
75/* This is defined if the architecture is Armv8-A, or higher */
76#if !defined(MBEDTLS_ARCH_IS_ARMV8_A)
77#if defined(__ARM_ARCH) && defined(__ARM_ARCH_PROFILE)
78#if (__ARM_ARCH >= 8) && (__ARM_ARCH_PROFILE == 'A')
79/* GCC, clang, armclang and IAR */
80#define MBEDTLS_ARCH_IS_ARMV8_A
81#endif
82#elif defined(__ARM_ARCH_8A)
83/* Alternative defined by clang */
84#define MBEDTLS_ARCH_IS_ARMV8_A
85#elif defined(_M_ARM64) || defined(_M_ARM64EC)
86/* MSVC ARM64 is at least Armv8.0-A */
87#define MBEDTLS_ARCH_IS_ARMV8_A
88#endif
89#endif
90
91#if defined(__GNUC__) && !defined(__ARMCC_VERSION) && !defined(__clang__) \
92 && !defined(__llvm__) && !defined(__INTEL_COMPILER)
93/* Defined if the compiler really is gcc and not clang, etc */
94#define MBEDTLS_COMPILER_IS_GCC
95#define MBEDTLS_GCC_VERSION \
96 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
97#endif
98
99#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
100#define _CRT_SECURE_NO_DEPRECATE 1
101#endif
102
103#if defined(TF_PSA_CRYPTO_CONFIG_FILES_READ)
104#error \
105 "Something went wrong: TF_PSA_CRYPTO_CONFIG_FILES_READ defined before reading the config files!"
106#endif
107#if defined(TF_PSA_CRYPTO_CONFIG_IS_FINALIZED)
108#error \
109 "Something went wrong: TF_PSA_CRYPTO_CONFIG_IS_FINALIZED defined before reading the config files!"
110#endif
111
112/* PSA crypto configuration */
113#if defined(TF_PSA_CRYPTO_CONFIG_FILE)
114#include TF_PSA_CRYPTO_CONFIG_FILE
115#else
116#include "psa/crypto_config.h"
117#endif
118#if defined(TF_PSA_CRYPTO_USER_CONFIG_FILE)
119#include TF_PSA_CRYPTO_USER_CONFIG_FILE
120#endif
121
122/* For the sake of consistency checks in tf_psa_crypto_config.c */
123#if defined(TF_PSA_CRYPTO_INCLUDE_AFTER_RAW_CONFIG)
124#include TF_PSA_CRYPTO_INCLUDE_AFTER_RAW_CONFIG
125#endif
126
127/* Indicate that all configuration files have been read.
128 * It is now time to adjust the configuration (follow through on dependencies,
129 * make PSA and legacy crypto consistent, etc.).
130 */
131#define TF_PSA_CRYPTO_CONFIG_FILES_READ
132
133#if defined(TF_PSA_CRYPTO_CONFIG_VERSION)
134#if (TF_PSA_CRYPTO_CONFIG_VERSION < 0x01000000) || \
135 (TF_PSA_CRYPTO_CONFIG_VERSION > TF_PSA_CRYPTO_VERSION_NUMBER)
136#error "Invalid config version, defined value of TF_PSA_CRYPTO_CONFIG_VERSION is unsupported"
137#endif
138#endif
139
140/* Tweak the configuration of PSA mechanisms. */
145
146/* Define additional internal symbols based on the library configuration. */
148
149#if defined(MBEDTLS_PSA_CRYPTO_C)
150/* If we are implementing PSA crypto ourselves (as opposed to only
151 * having client-side stubs), enable built-in drivers for all the
152 * mechanisms activated with `PSA_WANT_xxx` that are not
153 * accelerated. */
154#include "mbedtls/private/crypto_adjust_config_enable_builtins.h"
155
156#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
157#include "mbedtls/private/libtestdriver1-crypto_adjust_config_enable_builtins.h"
158#endif
159
160/* Special header to adjust the configuration to make a build
161 * where all enabled mechanisms are provided both as built-in and
162 * through drivers. See the comment at the top of the
163 * header file for details. */
164#if defined(MBEDTLS_CONFIG_ADJUST_TEST_ACCELERATORS) //no-check-names
165#include "mbedtls/private/config_adjust_test_accelerators.h"
166#endif
167#endif /* MBEDTLS_PSA_CRYPTO_C */
168
169/* Define additional symbols used by support modules. */
171
172/* Define additional symbols used by built-in crypto modules. */
173#include "mbedtls/private/crypto_adjust_config_tweak_builtins.h"
174
175#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
176#include "mbedtls/private/libtestdriver1-crypto_adjust_config_tweak_builtins.h"
177#endif
178
179/* Indicate that all configuration symbols are set,
180 * even the ones that are calculated programmatically.
181 * It is now safe to query the configuration (to check it, to size buffers,
182 * etc.).
183 */
184#define TF_PSA_CRYPTO_CONFIG_IS_FINALIZED
185
186/*
187 * Avoid warning from -pedantic. This is a convenient place for this
188 * workaround since this is included by every single file before the
189 * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
190 */
192
193#endif /* TF_PSA_CRYPTO_BUILD_INFO_H */
Adjust PSA configuration: enable always-on features.
Adjust PSA configuration by resolving some dependencies.
Adjust PSA configuration by defining internal symbols.
Adjust PSA configuration for key pair types.
Adjust TF-PSA-Crypto configuration: support modules.
Adjust PSA configuration: enable quasi-synonyms.
PSA crypto configuration options (set of defines).