Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions tests/include/test/psa_crypto_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#include "build_info.h"
#include "test/helpers.h"

#if (MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
(MBEDTLS_VERSION_MAJOR >= 4 && defined(MBEDTLS_PSA_CRYPTO_CLIENT))
#if ((defined(TF_PSA_CRYPTO_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR < 4) && \
defined(MBEDTLS_PSA_CRYPTO_C)) || \
(defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4 && \
defined(MBEDTLS_PSA_CRYPTO_CLIENT))
#include "test/psa_helpers.h"
#endif

Expand Down Expand Up @@ -55,8 +57,10 @@
#define PSA_DONE() ((void) 0)
#endif /* MBEDTLS_PSA_CRYPTO_C */

#if (MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
(MBEDTLS_VERSION_MAJOR >= 4 && defined(MBEDTLS_PSA_CRYPTO_CLIENT))
#if ((defined(TF_PSA_CRYPTO_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR < 4) && \
defined(MBEDTLS_PSA_CRYPTO_C)) || \
(defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4 && \
defined(MBEDTLS_PSA_CRYPTO_CLIENT))

#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)

Expand Down Expand Up @@ -358,7 +362,7 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string);

#endif /* MBEDTLS_PSA_CRYPTO_CLIENT || MBEDTLS_PSA_CRYPTO_C */

#if MBEDTLS_VERSION_MAJOR >= 4
#if defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4
/* Legacy PSA_INIT() / PSA_DONE() variants from 3.6 */
#define USE_PSA_INIT() PSA_INIT()
#define USE_PSA_DONE() PSA_DONE()
Expand Down
13 changes: 8 additions & 5 deletions tests/src/psa_exercise_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
#include <test/macros.h>
#include <test/psa_exercise_key.h>

#if (MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
(MBEDTLS_VERSION_MAJOR >= 4 && defined(MBEDTLS_PSA_CRYPTO_CLIENT))
#if ((defined(TF_PSA_CRYPTO_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR < 4) && \
defined(MBEDTLS_PSA_CRYPTO_C)) || \
((defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4) && \
defined(MBEDTLS_PSA_CRYPTO_CLIENT))


#include <mbedtls/asn1.h>
#include <psa/crypto.h>
Expand Down Expand Up @@ -712,7 +715,7 @@ psa_status_t mbedtls_test_psa_raw_key_agreement_with_self(
uint8_t output[1024];
size_t output_length;

#if MBEDTLS_VERSION_MAJOR >= 4
#if defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4
uint8_t *exported = NULL;
size_t exported_size = 0;
size_t exported_length = 0;
Expand Down Expand Up @@ -766,7 +769,7 @@ psa_status_t mbedtls_test_psa_raw_key_agreement_with_self(
PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE);
}

#if MBEDTLS_VERSION_MAJOR >= 4
#if defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4
psa_status_t raw_status = status;

psa_set_key_type(&shared_secret_attributes, PSA_KEY_TYPE_DERIVE);
Expand Down Expand Up @@ -880,7 +883,7 @@ psa_status_t mbedtls_test_psa_raw_key_agreement_with_self(
*/
psa_reset_key_attributes(&attributes);

#if MBEDTLS_VERSION_MAJOR >= 4
#if defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR >= 4
psa_reset_key_attributes(&export_attributes);

/* Make sure to reset and free derived key attributes and slot. */
Expand Down