From 3a0a8aee7e37fcf2e61a7a29d72a420e4a6e0fe5 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Fri, 27 Sep 2024 09:55:26 +0200 Subject: [PATCH] psa_crypto_helpers: add guard for MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_xxx PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE() is not defined when there is no MBEDTLS_PSA_CRYPTO_CLIENT so we need this guard to define MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_[2048/4096]. Signed-off-by: Valerio Setti --- tests/include/test/psa_crypto_helpers.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index fd7248514a..5ee491e328 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -464,6 +464,8 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string); /* A couple of helper macros to verify if MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE is * large enough to contain an RSA key pair of the given size. This is meant to be * used in test cases where MBEDTLS_PSA_STATIC_KEY_SLOTS is enabled. */ +#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) + #if (MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE >= PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE(4096)) #define MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_4096 #endif @@ -472,6 +474,8 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string); #define MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_2048 #endif +#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */ + /* 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