Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:54:25

0001 /**
0002  * \file tf-psa-crypto/build_info.h
0003  *
0004  * \brief Build-time configuration info
0005  *
0006  *  Include this file if you need to depend on the
0007  *  configuration options defined in crypto_config.h or TF_PSA_CRYPTO_CONFIG_FILE.
0008  */
0009 /*
0010  *  Copyright The Mbed TLS Contributors
0011  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
0012  */
0013 
0014 #ifndef TF_PSA_CRYPTO_BUILD_INFO_H
0015 #define TF_PSA_CRYPTO_BUILD_INFO_H
0016 
0017 /*
0018  * Version macros are defined in build_info.h rather than in version.h so that
0019  * the user config files have access to them. That way, for example, users who
0020  * deploy applications to multiple devices with different versions of
0021  * TF-PSA-Crypto can write configurations that depend on the version.
0022  */
0023 /**
0024  * The version number x.y.z is split into three parts.
0025  * Major, Minor, Patchlevel
0026  */
0027 #define TF_PSA_CRYPTO_VERSION_MAJOR  1
0028 #define TF_PSA_CRYPTO_VERSION_MINOR  0
0029 #define TF_PSA_CRYPTO_VERSION_PATCH  0
0030 
0031 /**
0032  * The single version number has the following structure:
0033  *    MMNNPP00
0034  *    Major version | Minor version | Patch version
0035  */
0036 #define TF_PSA_CRYPTO_VERSION_NUMBER        0x01000000
0037 #define TF_PSA_CRYPTO_VERSION_STRING        "1.0.0"
0038 #define TF_PSA_CRYPTO_VERSION_STRING_FULL   "TF-PSA-Crypto 1.0.0"
0039 
0040 /* Macros for build-time platform detection */
0041 
0042 #if !defined(MBEDTLS_ARCH_IS_ARM64) && \
0043     (defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC))
0044 #define MBEDTLS_ARCH_IS_ARM64
0045 #endif
0046 
0047 #if !defined(MBEDTLS_ARCH_IS_ARM32) && \
0048     (defined(__arm__) || defined(_M_ARM) || \
0049     defined(_M_ARMT) || defined(__thumb__) || defined(__thumb2__))
0050 #define MBEDTLS_ARCH_IS_ARM32
0051 #endif
0052 
0053 #if !defined(MBEDTLS_ARCH_IS_X64) && \
0054     (defined(__amd64__) || defined(__x86_64__) || \
0055     ((defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)))
0056 #define MBEDTLS_ARCH_IS_X64
0057 #endif
0058 
0059 #if !defined(MBEDTLS_ARCH_IS_X86) && \
0060     (defined(__i386__) || defined(_X86_) || \
0061     (defined(_M_IX86) && !defined(_M_I86)))
0062 #define MBEDTLS_ARCH_IS_X86
0063 #endif
0064 
0065 #if !defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64) && \
0066     (defined(_M_ARM64) || defined(_M_ARM64EC))
0067 #define MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64
0068 #endif
0069 
0070 /* This is defined if the architecture is Armv8-A, or higher */
0071 #if !defined(MBEDTLS_ARCH_IS_ARMV8_A)
0072 #if defined(__ARM_ARCH) && defined(__ARM_ARCH_PROFILE)
0073 #if (__ARM_ARCH >= 8) && (__ARM_ARCH_PROFILE == 'A')
0074 /* GCC, clang, armclang and IAR */
0075 #define MBEDTLS_ARCH_IS_ARMV8_A
0076 #endif
0077 #elif defined(__ARM_ARCH_8A)
0078 /* Alternative defined by clang */
0079 #define MBEDTLS_ARCH_IS_ARMV8_A
0080 #elif defined(_M_ARM64) || defined(_M_ARM64EC)
0081 /* MSVC ARM64 is at least Armv8.0-A */
0082 #define MBEDTLS_ARCH_IS_ARMV8_A
0083 #endif
0084 #endif
0085 
0086 #if defined(__GNUC__) && !defined(__ARMCC_VERSION) && !defined(__clang__) \
0087     && !defined(__llvm__) && !defined(__INTEL_COMPILER)
0088 /* Defined if the compiler really is gcc and not clang, etc */
0089 #define MBEDTLS_COMPILER_IS_GCC
0090 #define MBEDTLS_GCC_VERSION \
0091     (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
0092 #endif
0093 
0094 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
0095 #define _CRT_SECURE_NO_DEPRECATE 1
0096 #endif
0097 
0098 /* Define `inline` on some non-C99-compliant compilers. */
0099 #if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \
0100     !defined(inline) && !defined(__cplusplus)
0101 #define inline __inline
0102 #endif
0103 
0104 #if defined(TF_PSA_CRYPTO_CONFIG_FILES_READ)
0105 #error \
0106     "Something went wrong: TF_PSA_CRYPTO_CONFIG_FILES_READ defined before reading the config files!"
0107 #endif
0108 #if defined(TF_PSA_CRYPTO_CONFIG_IS_FINALIZED)
0109 #error \
0110     "Something went wrong: TF_PSA_CRYPTO_CONFIG_IS_FINALIZED defined before reading the config files!"
0111 #endif
0112 
0113 /* PSA crypto configuration */
0114 #if defined(TF_PSA_CRYPTO_CONFIG_FILE)
0115 #include TF_PSA_CRYPTO_CONFIG_FILE
0116 #else
0117 #include "psa/crypto_config.h"
0118 #endif
0119 #if defined(TF_PSA_CRYPTO_USER_CONFIG_FILE)
0120 #include TF_PSA_CRYPTO_USER_CONFIG_FILE
0121 #endif
0122 
0123 /* For the sake of consistency checks in tf_psa_crypto_config.c */
0124 #if defined(TF_PSA_CRYPTO_INCLUDE_AFTER_RAW_CONFIG)
0125 #include TF_PSA_CRYPTO_INCLUDE_AFTER_RAW_CONFIG
0126 #endif
0127 
0128 /* Indicate that all configuration files have been read.
0129  * It is now time to adjust the configuration (follow through on dependencies,
0130  * make PSA and legacy crypto consistent, etc.).
0131  */
0132 #define TF_PSA_CRYPTO_CONFIG_FILES_READ
0133 
0134 #if defined(TF_PSA_CRYPTO_CONFIG_VERSION)
0135 #if (TF_PSA_CRYPTO_CONFIG_VERSION < 0x01000000) ||                      \
0136     (TF_PSA_CRYPTO_CONFIG_VERSION > TF_PSA_CRYPTO_VERSION_NUMBER)
0137 #error "Invalid config version, defined value of TF_PSA_CRYPTO_CONFIG_VERSION is unsupported"
0138 #endif
0139 #endif
0140 
0141 /* Auto-enable MBEDTLS_MD_C if needed by a module that didn't require it
0142  * in a previous release, to ensure backwards compatibility.
0143  */
0144 #if defined(MBEDTLS_PKCS5_C)
0145 #define MBEDTLS_MD_C
0146 #endif
0147 
0148 /* PSA crypto specific configuration options
0149  * - If config_psa.h reads a configuration option in preprocessor directive,
0150  *   this symbol should be set before its inclusion. (e.g. MBEDTLS_MD_C)
0151  * - If config_psa.h writes a configuration option in conditional directive,
0152  *   this symbol should be consulted after its inclusion.
0153  *   (e.g. MBEDTLS_MD_LIGHT)
0154  */
0155 #include "mbedtls/private/config_psa.h"
0156 
0157 #include "mbedtls/config_adjust_legacy_crypto.h"
0158 
0159 /* Indicate that all configuration symbols are set,
0160  * even the ones that are calculated programmatically.
0161  * It is now safe to query the configuration (to check it, to size buffers,
0162  * etc.).
0163  */
0164 #define TF_PSA_CRYPTO_CONFIG_IS_FINALIZED
0165 
0166 /* Up to Mbed TLS 3.6, build_info.h included check_config.h which included
0167  * <limits.h>. Keep including it until it's explicitly included everywhere
0168  * that uses definitions from <limits.h>.
0169  * https://github.com/Mbed-TLS/mbedtls/issues/10305
0170  */
0171 #include <limits.h>
0172 
0173 /*
0174  * Avoid warning from -pedantic. This is a convenient place for this
0175  * workaround since this is included by every single file before the
0176  * #if defined(MBEDTLS_xxx_C) that results in empty translation units.
0177  */
0178 typedef int mbedtls_iso_c_forbids_empty_translation_units;
0179 
0180 #endif /* TF_PSA_CRYPTO_BUILD_INFO_H */