From cfe684f44bb744fc63b1899e79b49c3cc3019298 Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Tue, 17 Jun 2025 01:18:22 +0200 Subject: [PATCH 1/5] Modifications done by executing the script for each private header (in the tf-psa-crypto section) Signed-off-by: Anton Matkin --- tests/include/test/bignum_helpers.h | 2 +- tests/include/test/drivers/cipher.h | 2 +- tests/include/test/drivers/test_driver.h | 2 +- tests/include/test/helpers.h | 2 +- tests/include/test/psa_crypto_helpers.h | 2 +- tests/src/bignum_helpers.c | 2 +- tests/src/drivers/test_driver_asymmetric_encryption.c | 2 +- tests/src/drivers/test_driver_cipher.c | 4 ++-- tests/src/drivers/test_driver_key_management.c | 2 +- tests/src/drivers/test_driver_signature.c | 4 ++-- tests/src/fake_external_rng_for_test.c | 2 +- tests/src/psa_crypto_helpers.c | 4 ++-- tests/src/psa_exercise_key.c | 2 +- tests/src/random.c | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/include/test/bignum_helpers.h b/tests/include/test/bignum_helpers.h index a5e49cbe57..bc94a2a88d 100644 --- a/tests/include/test/bignum_helpers.h +++ b/tests/include/test/bignum_helpers.h @@ -17,7 +17,7 @@ #if defined(MBEDTLS_BIGNUM_C) -#include +#include #include /** Allocate and populate a core MPI from a test case argument. diff --git a/tests/include/test/drivers/cipher.h b/tests/include/test/drivers/cipher.h index 38c75aba72..2df1dc777e 100644 --- a/tests/include/test/drivers/cipher.h +++ b/tests/include/test/drivers/cipher.h @@ -16,7 +16,7 @@ #include #include -#include "mbedtls/cipher.h" +#include "mbedtls/private/cipher.h" typedef struct { /* If non-null, on success, copy this to the output. */ diff --git a/tests/include/test/drivers/test_driver.h b/tests/include/test/drivers/test_driver.h index 74605d6b82..c2e30054d1 100644 --- a/tests/include/test/drivers/test_driver.h +++ b/tests/include/test/drivers/test_driver.h @@ -19,7 +19,7 @@ #define PSA_CRYPTO_TEST_DRIVER_LOCATION 0x7fffff #include "test/drivers/aead.h" -#include "test/drivers/cipher.h" +#include "test/drivers/private/cipher.h" #include "test/drivers/hash.h" #include "test/drivers/mac.h" #include "test/drivers/key_management.h" diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h index aff84748f0..6776d4f180 100644 --- a/tests/include/test/helpers.h +++ b/tests/include/test/helpers.h @@ -51,7 +51,7 @@ #include #if defined(MBEDTLS_BIGNUM_C) -#include "mbedtls/bignum.h" +#include "mbedtls/private/bignum.h" #endif /** The type of test case arguments that contain binary data. */ diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 9b7dbd57a7..70f3d356bc 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -17,7 +17,7 @@ #endif #include -#include +#include #if defined(MBEDTLS_PSA_CRYPTO_C) /** Initialize the PSA Crypto subsystem. */ diff --git a/tests/src/bignum_helpers.c b/tests/src/bignum_helpers.c index 913f5e3870..db725326a3 100644 --- a/tests/src/bignum_helpers.c +++ b/tests/src/bignum_helpers.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/tests/src/drivers/test_driver_asymmetric_encryption.c b/tests/src/drivers/test_driver_asymmetric_encryption.c index 6fdbe43aee..6689036a7b 100644 --- a/tests/src/drivers/test_driver_asymmetric_encryption.c +++ b/tests/src/drivers/test_driver_asymmetric_encryption.c @@ -9,7 +9,7 @@ #if defined(PSA_CRYPTO_DRIVER_TEST) #include "psa/crypto.h" -#include "mbedtls/rsa.h" +#include "mbedtls/private/rsa.h" #include "psa_crypto_rsa.h" #include "string.h" #include "test/drivers/asymmetric_encryption.h" diff --git a/tests/src/drivers/test_driver_cipher.c b/tests/src/drivers/test_driver_cipher.c index 9a9a77c702..ac51fe9898 100644 --- a/tests/src/drivers/test_driver_cipher.c +++ b/tests/src/drivers/test_driver_cipher.c @@ -12,9 +12,9 @@ #include "psa/crypto.h" #include "psa_crypto_cipher.h" #include "psa_crypto_core.h" -#include "mbedtls/cipher.h" +#include "mbedtls/private/cipher.h" -#include "test/drivers/cipher.h" +#include "test/drivers/private/cipher.h" #include "test/random.h" diff --git a/tests/src/drivers/test_driver_key_management.c b/tests/src/drivers/test_driver_key_management.c index d2ca157b8b..e0434f6902 100644 --- a/tests/src/drivers/test_driver_key_management.c +++ b/tests/src/drivers/test_driver_key_management.c @@ -14,7 +14,7 @@ #include "psa_crypto_ecp.h" #include "psa_crypto_rsa.h" #include "psa_crypto_ffdh.h" -#include "mbedtls/ecp.h" +#include "mbedtls/private/ecp.h" #include "mbedtls/error.h" #include "test/drivers/key_management.h" diff --git a/tests/src/drivers/test_driver_signature.c b/tests/src/drivers/test_driver_signature.c index a6eef573b2..af20a21fe3 100644 --- a/tests/src/drivers/test_driver_signature.c +++ b/tests/src/drivers/test_driver_signature.c @@ -15,13 +15,13 @@ #include "psa_crypto_ecp.h" #include "psa_crypto_hash.h" #include "psa_crypto_rsa.h" -#include "mbedtls/ecp.h" +#include "mbedtls/private/ecp.h" #include "test/drivers/hash.h" #include "test/drivers/signature.h" #include "test/drivers/hash.h" -#include "mbedtls/ecdsa.h" +#include "mbedtls/private/ecdsa.h" #include "test/random.h" diff --git a/tests/src/fake_external_rng_for_test.c b/tests/src/fake_external_rng_for_test.c index 21da1414a3..dc3625d630 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -54,7 +54,7 @@ psa_status_t mbedtls_psa_external_get_random( #if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) #include -#include +#include static int platform_get_entropy_force_failure; static size_t platform_get_entropy_forced_entropy_content = SIZE_MAX; diff --git a/tests/src/psa_crypto_helpers.c b/tests/src/psa_crypto_helpers.c index 9de2861e9f..c253cef261 100644 --- a/tests/src/psa_crypto_helpers.c +++ b/tests/src/psa_crypto_helpers.c @@ -14,7 +14,7 @@ #include #if defined(MBEDTLS_CTR_DRBG_C) -#include +#include #endif #if defined(MBEDTLS_PSA_CRYPTO_C) @@ -249,7 +249,7 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string) #if defined(MBEDTLS_PSA_INJECT_ENTROPY) -#include +#include #include int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len) diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c index 1b30c44c51..a57aeec58b 100644 --- a/tests/src/psa_exercise_key.c +++ b/tests/src/psa_exercise_key.c @@ -25,7 +25,7 @@ #include #endif #if defined(MBEDTLS_ECP_C) -#include +#include #endif #if defined(MBEDTLS_RSA_C) #include diff --git a/tests/src/random.c b/tests/src/random.c index d041f36a1f..1bcee2fd17 100644 --- a/tests/src/random.c +++ b/tests/src/random.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include int mbedtls_test_rnd_std_rand(void *rng_state, From f222d1156e532508e1654c5291cf094a93d96d55 Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Tue, 17 Jun 2025 18:21:28 +0200 Subject: [PATCH 2/5] Fix erroneous include change Signed-off-by: Anton Matkin --- tests/include/test/drivers/test_driver.h | 2 +- tests/src/drivers/test_driver_cipher.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/include/test/drivers/test_driver.h b/tests/include/test/drivers/test_driver.h index c2e30054d1..74605d6b82 100644 --- a/tests/include/test/drivers/test_driver.h +++ b/tests/include/test/drivers/test_driver.h @@ -19,7 +19,7 @@ #define PSA_CRYPTO_TEST_DRIVER_LOCATION 0x7fffff #include "test/drivers/aead.h" -#include "test/drivers/private/cipher.h" +#include "test/drivers/cipher.h" #include "test/drivers/hash.h" #include "test/drivers/mac.h" #include "test/drivers/key_management.h" diff --git a/tests/src/drivers/test_driver_cipher.c b/tests/src/drivers/test_driver_cipher.c index ac51fe9898..31fbe33bf0 100644 --- a/tests/src/drivers/test_driver_cipher.c +++ b/tests/src/drivers/test_driver_cipher.c @@ -14,7 +14,7 @@ #include "psa_crypto_core.h" #include "mbedtls/private/cipher.h" -#include "test/drivers/private/cipher.h" +#include "test/drivers/cipher.h" #include "test/random.h" From 37fe490488ef3e2f07277396323727dd7caed86a Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Wed, 18 Jun 2025 08:14:56 +0200 Subject: [PATCH 3/5] Fix check_names.py script, now accounts for newly moved headers too Signed-off-by: Anton Matkin --- scripts/check_names.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/check_names.py b/scripts/check_names.py index 57d2e1104d..7f95dded9c 100755 --- a/scripts/check_names.py +++ b/scripts/check_names.py @@ -703,6 +703,8 @@ def comprehensive_parse(self): "include/tf-psa-crypto/*.h", "include/mbedtls/*.h", "drivers/builtin/include/mbedtls/*.h", + "include/mbedtls/private/*.h", + "drivers/builtin/include/mbedtls/private/*.h", "drivers/everest/include/everest/everest.h", "drivers/everest/include/everest/x25519.h", "drivers/everest/include/tf-psa-crypto/private/everest/everest.h", @@ -722,6 +724,8 @@ def comprehensive_parse(self): "include/tf-psa-crypto/*.h", "include/mbedtls/*.h", "drivers/builtin/include/mbedtls/*.h", + "include/mbedtls/private/*.h", + "drivers/builtin/include/mbedtls/private/*.h", "core/*.h", "drivers/builtin/src/*.h", "core/*.c", @@ -736,6 +740,8 @@ def comprehensive_parse(self): "include/tf-psa-crypto/*.h", "include/mbedtls/*.h", "drivers/builtin/include/mbedtls/*.h", + "include/mbedtls/private/*.h", + "drivers/builtin/include/mbedtls/private/*.h", "core/*.h", "drivers/builtin/src/*.h", "drivers/everest/include/everest/everest.h", @@ -748,6 +754,8 @@ def comprehensive_parse(self): "include/tf-psa-crypto/*.h", "include/mbedtls/*.h", "drivers/builtin/include/mbedtls/*.h", + "include/mbedtls/private/*.h", + "drivers/builtin/include/mbedtls/private/*.h", "core/*.h", "drivers/builtin/src/*.h", "drivers/everest/include/everest/everest.h", From 6710ca8a301d0599c5e5729d6dda9227566c6e27 Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Fri, 20 Jun 2025 13:44:05 +0200 Subject: [PATCH 4/5] Add preprocessor code, for compatibility with older mbedtls version, namely, now the inclusioin of header files in the private/ folder is conditional Signed-off-by: Anton Matkin --- tests/include/test/bignum_helpers.h | 4 ++++ tests/include/test/drivers/cipher.h | 4 ++++ tests/include/test/helpers.h | 6 ++++++ tests/include/test/psa_crypto_helpers.h | 5 +++++ tests/src/bignum_helpers.c | 5 +++++ tests/src/drivers/test_driver_asymmetric_encryption.c | 6 ++++++ tests/src/drivers/test_driver_cipher.c | 5 +++++ tests/src/drivers/test_driver_key_management.c | 6 ++++++ tests/src/drivers/test_driver_signature.c | 9 +++++++++ tests/src/fake_external_rng_for_test.c | 5 +++++ tests/src/psa_crypto_helpers.c | 9 +++++++++ tests/src/psa_exercise_key.c | 6 ++++++ tests/src/random.c | 4 ++++ 13 files changed, 74 insertions(+) diff --git a/tests/include/test/bignum_helpers.h b/tests/include/test/bignum_helpers.h index bc94a2a88d..0787c5180e 100644 --- a/tests/include/test/bignum_helpers.h +++ b/tests/include/test/bignum_helpers.h @@ -17,7 +17,11 @@ #if defined(MBEDTLS_BIGNUM_C) +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif #include /** Allocate and populate a core MPI from a test case argument. diff --git a/tests/include/test/drivers/cipher.h b/tests/include/test/drivers/cipher.h index 2df1dc777e..3749d81f32 100644 --- a/tests/include/test/drivers/cipher.h +++ b/tests/include/test/drivers/cipher.h @@ -16,7 +16,11 @@ #include #include +#if MBEDTLS_MAJOR_VERSION >= 4 #include "mbedtls/private/cipher.h" +#else +#include "mbedtls/cipher.h" +#endif typedef struct { /* If non-null, on success, copy this to the output. */ diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h index 6776d4f180..221579f647 100644 --- a/tests/include/test/helpers.h +++ b/tests/include/test/helpers.h @@ -51,7 +51,13 @@ #include #if defined(MBEDTLS_BIGNUM_C) + +#if MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/bignum.h" +#else +#include "mbedtls/bignum.h" +#endif + #endif /** The type of test case arguments that contain binary data. */ diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 70f3d356bc..a0d5647edc 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -17,7 +17,12 @@ #endif #include + +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif #if defined(MBEDTLS_PSA_CRYPTO_C) /** Initialize the PSA Crypto subsystem. */ diff --git a/tests/src/bignum_helpers.c b/tests/src/bignum_helpers.c index db725326a3..8f8ec9e6f5 100644 --- a/tests/src/bignum_helpers.c +++ b/tests/src/bignum_helpers.c @@ -18,7 +18,12 @@ #include #include +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif + #include #include #include diff --git a/tests/src/drivers/test_driver_asymmetric_encryption.c b/tests/src/drivers/test_driver_asymmetric_encryption.c index 6689036a7b..38621fca7c 100644 --- a/tests/src/drivers/test_driver_asymmetric_encryption.c +++ b/tests/src/drivers/test_driver_asymmetric_encryption.c @@ -9,7 +9,13 @@ #if defined(PSA_CRYPTO_DRIVER_TEST) #include "psa/crypto.h" + +#if MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/rsa.h" +#else +#include "mbedtls/rsa.h" +#endif + #include "psa_crypto_rsa.h" #include "string.h" #include "test/drivers/asymmetric_encryption.h" diff --git a/tests/src/drivers/test_driver_cipher.c b/tests/src/drivers/test_driver_cipher.c index 31fbe33bf0..89e1cc36d6 100644 --- a/tests/src/drivers/test_driver_cipher.c +++ b/tests/src/drivers/test_driver_cipher.c @@ -12,7 +12,12 @@ #include "psa/crypto.h" #include "psa_crypto_cipher.h" #include "psa_crypto_core.h" + +#if MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/cipher.h" +#else +#include "mbedtls/cipher.h" +#endif #include "test/drivers/cipher.h" diff --git a/tests/src/drivers/test_driver_key_management.c b/tests/src/drivers/test_driver_key_management.c index e0434f6902..2d34f957a7 100644 --- a/tests/src/drivers/test_driver_key_management.c +++ b/tests/src/drivers/test_driver_key_management.c @@ -14,7 +14,13 @@ #include "psa_crypto_ecp.h" #include "psa_crypto_rsa.h" #include "psa_crypto_ffdh.h" + +#if MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/ecp.h" +#else +#include "mbedtls/ecp.h" +#endif + #include "mbedtls/error.h" #include "test/drivers/key_management.h" diff --git a/tests/src/drivers/test_driver_signature.c b/tests/src/drivers/test_driver_signature.c index af20a21fe3..cc0db54c31 100644 --- a/tests/src/drivers/test_driver_signature.c +++ b/tests/src/drivers/test_driver_signature.c @@ -15,13 +15,22 @@ #include "psa_crypto_ecp.h" #include "psa_crypto_hash.h" #include "psa_crypto_rsa.h" + +#if MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/ecp.h" +#else +#include "mbedtls/ecp.h" +#endif #include "test/drivers/hash.h" #include "test/drivers/signature.h" #include "test/drivers/hash.h" +#if MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/ecdsa.h" +#else +#include "mbedtls/ecdsa.h" +#endif #include "test/random.h" diff --git a/tests/src/fake_external_rng_for_test.c b/tests/src/fake_external_rng_for_test.c index dc3625d630..9f76931420 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -54,7 +54,12 @@ psa_status_t mbedtls_psa_external_get_random( #if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) #include + +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif static int platform_get_entropy_force_failure; static size_t platform_get_entropy_forced_entropy_content = SIZE_MAX; diff --git a/tests/src/psa_crypto_helpers.c b/tests/src/psa_crypto_helpers.c index c253cef261..6622043981 100644 --- a/tests/src/psa_crypto_helpers.c +++ b/tests/src/psa_crypto_helpers.c @@ -14,7 +14,11 @@ #include #if defined(MBEDTLS_CTR_DRBG_C) +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif #endif #if defined(MBEDTLS_PSA_CRYPTO_C) @@ -249,7 +253,12 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string) #if defined(MBEDTLS_PSA_INJECT_ENTROPY) +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif + #include int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len) diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c index a57aeec58b..c0a1061c70 100644 --- a/tests/src/psa_exercise_key.c +++ b/tests/src/psa_exercise_key.c @@ -25,7 +25,13 @@ #include #endif #if defined(MBEDTLS_ECP_C) + +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif + #endif #if defined(MBEDTLS_RSA_C) #include diff --git a/tests/src/random.c b/tests/src/random.c index 1bcee2fd17..d02df7c5df 100644 --- a/tests/src/random.c +++ b/tests/src/random.c @@ -23,7 +23,11 @@ #include #include +#if MBEDTLS_VERSION_MAJOR >= 4 #include +#else +#include +#endif #include int mbedtls_test_rnd_std_rand(void *rng_state, From 52d09a9a9cdc3d636ed1382f50f6264ee2cd2f99 Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Fri, 4 Jul 2025 14:17:09 +0200 Subject: [PATCH 5/5] Changed the private header preprocessor condition, so that the old (non-private) path is only taken in case of mbedtls 3.6 Signed-off-by: Anton Matkin --- tests/include/test/bignum_helpers.h | 2 +- tests/include/test/drivers/cipher.h | 2 +- tests/include/test/helpers.h | 2 +- tests/include/test/psa_crypto_helpers.h | 2 +- tests/src/bignum_helpers.c | 2 +- tests/src/drivers/test_driver_asymmetric_encryption.c | 2 +- tests/src/drivers/test_driver_cipher.c | 2 +- tests/src/drivers/test_driver_key_management.c | 2 +- tests/src/drivers/test_driver_signature.c | 4 ++-- tests/src/fake_external_rng_for_test.c | 2 +- tests/src/psa_crypto_helpers.c | 4 ++-- tests/src/psa_exercise_key.c | 2 +- tests/src/random.c | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/include/test/bignum_helpers.h b/tests/include/test/bignum_helpers.h index 0787c5180e..49e290b92c 100644 --- a/tests/include/test/bignum_helpers.h +++ b/tests/include/test/bignum_helpers.h @@ -17,7 +17,7 @@ #if defined(MBEDTLS_BIGNUM_C) -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include diff --git a/tests/include/test/drivers/cipher.h b/tests/include/test/drivers/cipher.h index 3749d81f32..b6860f95ed 100644 --- a/tests/include/test/drivers/cipher.h +++ b/tests/include/test/drivers/cipher.h @@ -16,7 +16,7 @@ #include #include -#if MBEDTLS_MAJOR_VERSION >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/cipher.h" #else #include "mbedtls/cipher.h" diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h index 221579f647..f1700bbb87 100644 --- a/tests/include/test/helpers.h +++ b/tests/include/test/helpers.h @@ -52,7 +52,7 @@ #if defined(MBEDTLS_BIGNUM_C) -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/bignum.h" #else #include "mbedtls/bignum.h" diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index a0d5647edc..962ca1e2fb 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -18,7 +18,7 @@ #include -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include diff --git a/tests/src/bignum_helpers.c b/tests/src/bignum_helpers.c index 8f8ec9e6f5..8b35e38c80 100644 --- a/tests/src/bignum_helpers.c +++ b/tests/src/bignum_helpers.c @@ -18,7 +18,7 @@ #include #include -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include diff --git a/tests/src/drivers/test_driver_asymmetric_encryption.c b/tests/src/drivers/test_driver_asymmetric_encryption.c index 38621fca7c..57adb5ce90 100644 --- a/tests/src/drivers/test_driver_asymmetric_encryption.c +++ b/tests/src/drivers/test_driver_asymmetric_encryption.c @@ -10,7 +10,7 @@ #if defined(PSA_CRYPTO_DRIVER_TEST) #include "psa/crypto.h" -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/rsa.h" #else #include "mbedtls/rsa.h" diff --git a/tests/src/drivers/test_driver_cipher.c b/tests/src/drivers/test_driver_cipher.c index 89e1cc36d6..9b753cd89d 100644 --- a/tests/src/drivers/test_driver_cipher.c +++ b/tests/src/drivers/test_driver_cipher.c @@ -13,7 +13,7 @@ #include "psa_crypto_cipher.h" #include "psa_crypto_core.h" -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/cipher.h" #else #include "mbedtls/cipher.h" diff --git a/tests/src/drivers/test_driver_key_management.c b/tests/src/drivers/test_driver_key_management.c index 2d34f957a7..90cdb2153b 100644 --- a/tests/src/drivers/test_driver_key_management.c +++ b/tests/src/drivers/test_driver_key_management.c @@ -15,7 +15,7 @@ #include "psa_crypto_rsa.h" #include "psa_crypto_ffdh.h" -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/ecp.h" #else #include "mbedtls/ecp.h" diff --git a/tests/src/drivers/test_driver_signature.c b/tests/src/drivers/test_driver_signature.c index cc0db54c31..2915b5426b 100644 --- a/tests/src/drivers/test_driver_signature.c +++ b/tests/src/drivers/test_driver_signature.c @@ -16,7 +16,7 @@ #include "psa_crypto_hash.h" #include "psa_crypto_rsa.h" -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/ecp.h" #else #include "mbedtls/ecp.h" @@ -26,7 +26,7 @@ #include "test/drivers/signature.h" #include "test/drivers/hash.h" -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include "mbedtls/private/ecdsa.h" #else #include "mbedtls/ecdsa.h" diff --git a/tests/src/fake_external_rng_for_test.c b/tests/src/fake_external_rng_for_test.c index 9f76931420..6b8f682cd0 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -55,7 +55,7 @@ psa_status_t mbedtls_psa_external_get_random( #include -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include diff --git a/tests/src/psa_crypto_helpers.c b/tests/src/psa_crypto_helpers.c index 6622043981..3baf5474db 100644 --- a/tests/src/psa_crypto_helpers.c +++ b/tests/src/psa_crypto_helpers.c @@ -14,7 +14,7 @@ #include #if defined(MBEDTLS_CTR_DRBG_C) -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include @@ -253,7 +253,7 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string) #if defined(MBEDTLS_PSA_INJECT_ENTROPY) -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c index c0a1061c70..7380f7accf 100644 --- a/tests/src/psa_exercise_key.c +++ b/tests/src/psa_exercise_key.c @@ -26,7 +26,7 @@ #endif #if defined(MBEDTLS_ECP_C) -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include diff --git a/tests/src/random.c b/tests/src/random.c index d02df7c5df..e98c36709a 100644 --- a/tests/src/random.c +++ b/tests/src/random.c @@ -23,7 +23,7 @@ #include #include -#if MBEDTLS_VERSION_MAJOR >= 4 +#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4 #include #else #include