From 4cfec6ffbe88dbe82cb205d9817ff57574538df1 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Fri, 4 Oct 2024 07:14:35 +0200 Subject: [PATCH] psa: move definition of MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE is only used in tests so it should not be defined in a public header such as "crypto_extra.h". "psa_crypto_helpers.h" is a better option. Signed-off-by: Valerio Setti --- tests/include/test/psa_crypto_helpers.h | 7 +++++++ tf-psa-crypto/include/psa/crypto_extra.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 5ee491e328..f214394f30 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -476,6 +476,13 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string); #endif /* MBEDTLS_PSA_CRYPTO_CLIENT */ +/* Helper macro to get the size of the each key slot buffer. */ +#if defined(MBEDTLS_PSA_STATIC_KEY_SLOTS) +#define MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE +#else +#define MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE SIZE_MAX +#endif + /* Helper macro for the PK module to check whether MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE * is large enough to contain 4096 bits RSA key pairs. Of course this check is only * necessary if PK relies on PSA (i.e. MBEDTLS_USE_PSA_CRYPTO) to store and manage diff --git a/tf-psa-crypto/include/psa/crypto_extra.h b/tf-psa-crypto/include/psa/crypto_extra.h index 9bc68f6a26..f48c0873b5 100644 --- a/tf-psa-crypto/include/psa/crypto_extra.h +++ b/tf-psa-crypto/include/psa/crypto_extra.h @@ -42,13 +42,6 @@ extern "C" { PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE : PSA_CIPHER_MAX_KEY_LENGTH) #endif /* !MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE*/ -/* Define the size of the each key slot buffer. */ -#if defined(MBEDTLS_PSA_STATIC_KEY_SLOTS) -#define MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE -#else -#define MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE SIZE_MAX -#endif - /** \addtogroup attributes * @{ */