Move "libtestdriver1_" aliases to test_driver_common.h

Signed-off-by: Ronald Cron <[email protected]>
This commit is contained in:
Ronald Cron
2025-12-05 14:45:32 +01:00
parent 50bd6aae50
commit ca68ad8377
9 changed files with 23 additions and 9 deletions
@@ -25,4 +25,27 @@
/* *INDENT-ON* */
/*
* In the libtestdriver1 library used in Mbed TLS 3.6 and 4.0 for driver
* dispatch testing, the PSA core code is cloned and all identifiers starting
* with MBEDTLS_, PSA_, mbedtls_, or psa_ are prefixed with `libtestdriver1_`.
* As a result, libtestdriver1 drivers use, for example,
* `libtestdriver1_psa_key_attributes_t` instead of `psa_key_attributes_t`.
*
* With the generated test drivers introduced in TF-PSA-Crypto between 1.0
* and 1.1, only the modules under `drivers/builtin` are cloned, not the PSA
* core. The generated test drivers therefore do not use prefixed PSA core
* identifiers. For example, they use the `psa_key_attributes_t` type, just
* like the built-in drivers.
*
* To make driver dispatch work in both cases, we define certain
* `libtestdriver1_xyz` identifiers as aliases of the corresponding `xyz`
* identifiers in the latter case.
*/
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
typedef psa_crypto_driver_pake_inputs_t libtestdriver1_psa_crypto_driver_pake_inputs_t;
typedef psa_crypto_driver_pake_step_t libtestdriver1_psa_crypto_driver_pake_step_t;
#endif
#endif /* test_driver_common.h */
-1
View File
@@ -16,7 +16,6 @@
#include "mbedtls/constant_time.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_aead.h"
#elif defined(MBEDTLS_TEST_LIBTESTDRIVER1)
#if MBEDTLS_VERSION_MAJOR < 4
@@ -22,7 +22,6 @@
#include "test/drivers/key_management.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_rsa.h"
#elif defined(MBEDTLS_TEST_LIBTESTDRIVER1)
#if MBEDTLS_VERSION_MAJOR < 4
-1
View File
@@ -24,7 +24,6 @@
#include "test/random.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_cipher.h"
#elif defined(MBEDTLS_TEST_LIBTESTDRIVER1)
#if MBEDTLS_VERSION_MAJOR < 4
@@ -20,7 +20,6 @@
#include <string.h>
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_ecp.h"
#include "../../libtestdriver1/src/psa_crypto_ffdh.h"
#elif defined(MBEDTLS_TEST_LIBTESTDRIVER1)
@@ -27,7 +27,6 @@
#include "test/random.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_ecp.h"
#include "../../libtestdriver1/src/psa_crypto_rsa.h"
#include "../../libtestdriver1/src/psa_crypto_ffdh.h"
-1
View File
@@ -13,7 +13,6 @@
#include "test/drivers/mac.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_mac.h"
#elif defined(MBEDTLS_TEST_LIBTESTDRIVER1)
#if MBEDTLS_VERSION_MAJOR < 4
-2
View File
@@ -14,8 +14,6 @@
#include "string.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_crypto_driver_pake_inputs_t libtestdriver1_psa_crypto_driver_pake_inputs_t;
typedef psa_crypto_driver_pake_step_t libtestdriver1_psa_crypto_driver_pake_step_t;
#include "../../libtestdriver1/src/psa_crypto_pake.h"
#elif defined(MBEDTLS_TEST_LIBTESTDRIVER1)
#if MBEDTLS_VERSION_MAJOR < 4
@@ -34,7 +34,6 @@
#include "test/random.h"
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
#include "../../libtestdriver1/src/psa_crypto_ecp.h"
#include "../../libtestdriver1/src/psa_crypto_hash.h"
#include "../../libtestdriver1/src/psa_crypto_rsa.h"