From 2b5dbf46c0e98835b4022484bff2b7a7d252af0b Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Tue, 17 Jun 2025 01:18:22 +0200 Subject: [PATCH 1/4] 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 a5e49cbe5..bc94a2a88 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 38c75aba7..2df1dc777 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 74605d6b8..c2e30054d 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 aff84748f..6776d4f18 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 9b7dbd57a..70f3d356b 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 913f5e387..db725326a 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 6fdbe43ae..6689036a7 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 9a9a77c70..ac51fe989 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 d2ca157b8..e0434f690 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 a6eef573b..af20a21fe 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 741927cb3..83976137e 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -58,7 +58,7 @@ psa_status_t mbedtls_psa_external_get_random( #if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) || defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY) #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 9de2861e9..c253cef26 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 @@ exit: #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 b8cdd3ced..42e29f40b 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 d041f36a1..1bcee2fd1 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 cfd4b2cc53e04a7a9d4ad56e0c880da1b93aebfc Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Tue, 17 Jun 2025 18:21:28 +0200 Subject: [PATCH 2/4] 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 c2e30054d..74605d6b8 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 ac51fe989..31fbe33bf 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 39b328e60bdf4b6bb1ccec5b5d5a2a6bc5dbf7dc Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Fri, 20 Jun 2025 13:44:05 +0200 Subject: [PATCH 3/4] 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 bc94a2a88..0787c5180 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 2df1dc777..3749d81f3 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 6776d4f18..221579f64 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 70f3d356b..a0d5647ed 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 db725326a..8f8ec9e6f 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 6689036a7..38621fca7 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 31fbe33bf..89e1cc36d 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 e0434f690..2d34f957a 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 af20a21fe..cc0db54c3 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 83976137e..d1ab67543 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -58,7 +58,12 @@ psa_status_t mbedtls_psa_external_get_random( #if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) || defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY) #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 c253cef26..662204398 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 @@ exit: #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 42e29f40b..a5108b4ec 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 1bcee2fd1..d02df7c5d 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 af60653c4c29962617d50d7fb673ab48ff417c51 Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Fri, 4 Jul 2025 14:17:09 +0200 Subject: [PATCH 4/4] 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 0787c5180..49e290b92 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 3749d81f3..b6860f95e 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 221579f64..f1700bbb8 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 a0d5647ed..962ca1e2f 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 8f8ec9e6f..8b35e38c8 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 38621fca7..57adb5ce9 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 89e1cc36d..9b753cd89 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 2d34f957a..90cdb2153 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 cc0db54c3..2915b5426 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 d1ab67543..aedd6d3e6 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -59,7 +59,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 662204398..3baf5474d 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 @@ exit: #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 a5108b4ec..36e22cef9 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 d02df7c5d..e98c36709 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