mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-31 01:20:35 +00:00
PSA_CRYPTO_DRIVER_TEST_ALL is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG
Explain how PSA_CRYPTO_DRIVER_TEST_ALL works and why we have it. Note that it is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG. As a consequence, disable that option in component_test_psa_crypto_drivers. MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS is in the full config, so there's no need to add it explicitly. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
6b9017045f
commit
1997f3022f
@ -23,11 +23,31 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(PSA_CRYPTO_DRIVER_TEST_ALL)
|
#if defined(PSA_CRYPTO_DRIVER_TEST_ALL)
|
||||||
|
/* PSA_CRYPTO_DRIVER_TEST_ALL activates test drivers while keeping the
|
||||||
|
* built-in implementations active. Normally setting MBEDTLS_PSA_ACCEL_xxx
|
||||||
|
* would disable MBEDTLS_PSA_BUILTIN_xxx unless fallback is activated, but
|
||||||
|
* here we arrange to have both active so that psa_crypto_*.c includes
|
||||||
|
* the built-in implementations and the driver code can call the built-in
|
||||||
|
* implementations.
|
||||||
|
*
|
||||||
|
* The point of this test mode is to verify that the
|
||||||
|
* driver entry points are called when they should be in a lightweight
|
||||||
|
* way, without requiring an actual driver. This is different from builds
|
||||||
|
* with libtestdriver1, where we make a copy of the library source code
|
||||||
|
* and use that as an external driver.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Enable the use of the test driver in the library, and build the generic
|
/* Enable the use of the test driver in the library, and build the generic
|
||||||
* part of the test driver. */
|
* part of the test driver. */
|
||||||
#define PSA_CRYPTO_DRIVER_TEST
|
#define PSA_CRYPTO_DRIVER_TEST
|
||||||
|
|
||||||
|
/* With MBEDTLS_PSA_CRYPTO_CONFIG, if we set up the acceleration, the
|
||||||
|
* built-in implementations won't be enabled. */
|
||||||
|
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
|
||||||
|
#error \
|
||||||
|
"PSA_CRYPTO_DRIVER_TEST_ALL sets up a nonstandard configuration that is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Use the accelerator driver for all cryptographic mechanisms for which
|
/* Use the accelerator driver for all cryptographic mechanisms for which
|
||||||
* the test driver implemented. */
|
* the test driver implemented. */
|
||||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
|
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
|
||||||
|
@ -3933,16 +3933,16 @@ component_test_se_default () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
component_test_psa_crypto_drivers () {
|
component_test_psa_crypto_drivers () {
|
||||||
msg "build: full + MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS + test drivers"
|
msg "build: full + test drivers dispatching to builtins"
|
||||||
scripts/config.py full
|
scripts/config.py full
|
||||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
|
scripts/config.py unset MBEDTLS_PSA_CRYPTO_CONFIG
|
||||||
loc_cflags="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST_ALL"
|
loc_cflags="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST_ALL"
|
||||||
loc_cflags="${loc_cflags} '-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
|
loc_cflags="${loc_cflags} '-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
|
||||||
loc_cflags="${loc_cflags} -I../tests/include -O2"
|
loc_cflags="${loc_cflags} -I../tests/include -O2"
|
||||||
|
|
||||||
make CC=gcc CFLAGS="${loc_cflags}" LDFLAGS="$ASAN_CFLAGS"
|
make CC=gcc CFLAGS="${loc_cflags}" LDFLAGS="$ASAN_CFLAGS"
|
||||||
|
|
||||||
msg "test: full + MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS + test drivers"
|
msg "test: full + test drivers dispatching to builtins"
|
||||||
make test
|
make test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user