From 86fdfb9b5fa41172dced90b5262ab11281823430 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 3 Jul 2023 12:13:10 +0200 Subject: [PATCH] [nrf noup] Include PSA config file in TF-M PSA interface header Include the PSA config file in TF_M PSA interface header. This is a noup commit because it is and adapted change based on upstream commit that contains other changes that would cause merge conflicts. An additional PR was made to upstream to improve the way the config header is included. Upstream commit: 34a0ffd0d14bf98c8dc517e3982c4ed8cec9f56f Upstream PR: https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/21759 Signed-off-by: Joakim Andersson --- interface/include/psa/crypto.h | 11 +++++++++++ interface/include/psa/crypto_sizes.h | 5 ----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/interface/include/psa/crypto.h b/interface/include/psa/crypto.h index bb9d0caee..4fc53333d 100644 --- a/interface/include/psa/crypto.h +++ b/interface/include/psa/crypto.h @@ -12,6 +12,17 @@ #ifndef PSA_CRYPTO_H #define PSA_CRYPTO_H +/* In Mbed TLS, we would query the current config through inclusion of + * of mbedtls/build_info.h, but in TF-M, we don't rely on build_info.h + * hence we just include the current configuration if it has been passed + * through command line. These config defines are required in crypto_sizes.h + * to compute macros that define sizes which depend on algorithms supported + * by the implementation + */ +#if defined(MBEDTLS_PSA_CRYPTO_CONFIG_FILE) +#include MBEDTLS_PSA_CRYPTO_CONFIG_FILE +#endif /* MBEDTLS_PSA_CRYPTO_CONFIG_FILE */ + #include #ifdef __DOXYGEN_ONLY__ diff --git a/interface/include/psa/crypto_sizes.h b/interface/include/psa/crypto_sizes.h index 18a4b1f3a..b1225b5b6 100644 --- a/interface/include/psa/crypto_sizes.h +++ b/interface/include/psa/crypto_sizes.h @@ -179,11 +179,6 @@ /* The maximum size of an ECC key on this implementation, in bits. * This is a vendor-specific macro. */ #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) -#if defined(MBEDTLS_PSA_CRYPTO_CONFIG_FILE) -#include MBEDTLS_PSA_CRYPTO_CONFIG_FILE -#else -#include "psa/crypto_config.h" -#endif #if defined(PSA_WANT_ECC_SECP_R1_521) #define PSA_VENDOR_ECC_MAX_CURVE_BITS 521 #elif defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)