|
|
|
@ -2103,94 +2103,6 @@ component_test_psa_crypto_config_accel_ecdsa () {
|
|
|
|
|
make test
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Auxiliary function to build config for ECDSA with and without drivers
|
|
|
|
|
config_psa_crypto_config_ecdsa_use_psa () {
|
|
|
|
|
DRIVER_ONLY="$1"
|
|
|
|
|
# start with config full for maximum coverage (also enables USE_PSA)
|
|
|
|
|
scripts/config.py full
|
|
|
|
|
# enable support for drivers and configuring PSA-only algorithms
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
|
|
|
|
if [ "$DRIVER_ONLY" -eq 1 ]; then
|
|
|
|
|
# Disable the module that's accelerated
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECDSA_C
|
|
|
|
|
fi
|
|
|
|
|
# Restartable feature is not yet supported by PSA. Once it will in
|
|
|
|
|
# the future, the following line could be removed (see issues
|
|
|
|
|
# 6061, 6332 and following ones)
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECP_RESTARTABLE
|
|
|
|
|
# Dynamic secure element support is a deprecated feature and needs to be disabled here.
|
|
|
|
|
# This is done to have the same form of psa_key_attributes_s for libdriver and library.
|
|
|
|
|
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_reference_ecdsa_use_psa
|
|
|
|
|
component_test_psa_crypto_config_accel_ecdsa_use_psa () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA + USE_PSA"
|
|
|
|
|
|
|
|
|
|
# Algorithms and key types to accelerate
|
|
|
|
|
loc_accel_list="ALG_ECDSA ALG_DETERMINISTIC_ECDSA KEY_TYPE_ECC_KEY_PAIR KEY_TYPE_ECC_PUBLIC_KEY"
|
|
|
|
|
|
|
|
|
|
# Configure and build the test driver library
|
|
|
|
|
# -------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
|
|
|
|
|
# partial support for cipher operations in the driver test library.
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
# SHA-1 and all variants of SHA-2 are needed for ECDSA and X.509 tests
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_1"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_224"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_256"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_384"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_512"
|
|
|
|
|
make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Configure and build the main libraries with drivers enabled
|
|
|
|
|
# -----------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Use the same config as reference, only without built-in ECDSA
|
|
|
|
|
config_psa_crypto_config_ecdsa_use_psa 1
|
|
|
|
|
|
|
|
|
|
# Build the library
|
|
|
|
|
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -O -Werror -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Make sure ECDSA was not re-enabled by accident (additive config)
|
|
|
|
|
not grep mbedtls_ecdsa_ library/ecdsa.o
|
|
|
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
|
# -------------
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA + USE_PSA"
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
|
|
msg "test: ssl-opt.sh"
|
|
|
|
|
tests/ssl-opt.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_accel_ecdsa_use_psa.
|
|
|
|
|
# Used by tests/scripts/analyze_outcomes.py for comparison purposes.
|
|
|
|
|
component_test_psa_crypto_config_reference_ecdsa_use_psa () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA + USE_PSA"
|
|
|
|
|
|
|
|
|
|
# To be aligned with the accel component that needs this
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
config_psa_crypto_config_ecdsa_use_psa 0
|
|
|
|
|
|
|
|
|
|
make
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA + USE_PSA"
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
|
|
msg "test: ssl-opt.sh"
|
|
|
|
|
tests/ssl-opt.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component_test_psa_crypto_config_accel_ecdh () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDH"
|
|
|
|
|
|
|
|
|
@ -2239,14 +2151,50 @@ component_test_psa_crypto_config_accel_ecdh () {
|
|
|
|
|
make test
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Auxiliary function to build config for ECDH with and without drivers.
|
|
|
|
|
component_test_psa_crypto_config_accel_pake() {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated PAKE"
|
|
|
|
|
|
|
|
|
|
# Start with full
|
|
|
|
|
scripts/config.py full
|
|
|
|
|
|
|
|
|
|
# Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
|
|
|
|
|
# partial support for cipher operations in the driver test library.
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
loc_accel_list="ALG_JPAKE"
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
|
|
|
|
|
# Make build-in fallback not available
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECJPAKE_C
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
|
|
|
|
|
|
|
|
|
# Dynamic secure element support is a deprecated feature and needs to be disabled here.
|
|
|
|
|
# This is done to have the same form of psa_key_attributes_s for libdriver and library.
|
|
|
|
|
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
|
|
|
|
|
|
|
|
|
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -Werror -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
not grep mbedtls_ecjpake_init library/ecjpake.o
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated PAKE"
|
|
|
|
|
make test
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Auxiliary function to build config for all EC based algorithms (EC-JPAKE,
|
|
|
|
|
# ECDH, ECDSA) with and without drivers.
|
|
|
|
|
#
|
|
|
|
|
# This is used by the two following components to ensure they always use the
|
|
|
|
|
# same config, except for the use of driver or built-in ECDH:
|
|
|
|
|
# - component_test_psa_crypto_config_accel_ecdh_use_psa;
|
|
|
|
|
# - component_test_psa_crypto_config_reference_ecdh_use_psa.
|
|
|
|
|
# This support comparing their test coverage with analyze_outcomes.py.
|
|
|
|
|
config_psa_crypto_config_ecdh_use_psa () {
|
|
|
|
|
# same config, except for the use of driver or built-in EC algorithms:
|
|
|
|
|
# - component_test_psa_crypto_config_accel_all_ec_algs_use_psa;
|
|
|
|
|
# - component_test_psa_crypto_config_reference_all_ec_algs_use_psa.
|
|
|
|
|
# This supports comparing their test coverage with analyze_outcomes.py.
|
|
|
|
|
config_psa_crypto_config_all_ec_algs_use_psa () {
|
|
|
|
|
DRIVER_ONLY="$1"
|
|
|
|
|
# start with config full for maximum coverage (also enables USE_PSA)
|
|
|
|
|
scripts/config.py full
|
|
|
|
@ -2254,107 +2202,30 @@ config_psa_crypto_config_ecdh_use_psa () {
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
|
|
|
|
if [ "$DRIVER_ONLY" -eq 1 ]; then
|
|
|
|
|
# Disable the module that's accelerated
|
|
|
|
|
# Disable modules that are accelerated
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECDSA_C
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECDH_C
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECJPAKE_C
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Restartable feature is not yet supported by PSA. Once it will in
|
|
|
|
|
# the future, the following line could be removed (see issues
|
|
|
|
|
# 6061, 6332 and following ones)
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECP_RESTARTABLE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_reference_ecdh_use_psa
|
|
|
|
|
component_test_psa_crypto_config_accel_ecdh_use_psa () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDH + USE_PSA"
|
|
|
|
|
|
|
|
|
|
# Algorithms and key types to accelerate
|
|
|
|
|
loc_accel_list="ALG_ECDH KEY_TYPE_ECC_KEY_PAIR KEY_TYPE_ECC_PUBLIC_KEY"
|
|
|
|
|
|
|
|
|
|
# Configure and build the test driver library
|
|
|
|
|
# -------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
|
|
|
|
|
# partial support for cipher operations in the driver test library.
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
make -C tests libtestdriver1.a CFLAGS=" $ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Configure and build the main libraries
|
|
|
|
|
# --------------------------------------
|
|
|
|
|
|
|
|
|
|
# Use the same config as reference, only without built-in ECDH
|
|
|
|
|
config_psa_crypto_config_ecdh_use_psa 1
|
|
|
|
|
|
|
|
|
|
# Build the main library
|
|
|
|
|
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -O -Werror -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Make sure this was not re-enabled by accident (additive config)
|
|
|
|
|
not grep mbedtls_ecdh_ library/ecdh.o
|
|
|
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
|
# -------------
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDH + USE_PSA"
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
|
|
msg "test: ssl-opt.sh"
|
|
|
|
|
tests/ssl-opt.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_accel_ecdh_use_psa.
|
|
|
|
|
# Used by tests/scripts/analyze_outcomes.py for comparison purposes.
|
|
|
|
|
component_test_psa_crypto_config_reference_ecdh_use_psa () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with reference ECDH + USE_PSA"
|
|
|
|
|
|
|
|
|
|
# To be aligned with the accel component that needs this
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
config_psa_crypto_config_ecdh_use_psa 0
|
|
|
|
|
|
|
|
|
|
make
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with reference ECDH + USE_PSA"
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
|
|
msg "test: ssl-opt.sh"
|
|
|
|
|
tests/ssl-opt.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Auxiliary function to build config for EC JPAKE with and without drivers.
|
|
|
|
|
#
|
|
|
|
|
# This is used by the two following components to ensure they always use the
|
|
|
|
|
# same config, except for the use of driver or built-in ECJPAKE:
|
|
|
|
|
# - component_test_psa_crypto_config_accel_ecjpake_use_psa;
|
|
|
|
|
# - component_test_psa_crypto_config_reference_ecjpake_use_psa.
|
|
|
|
|
# This support comparing their test coverage with analyze_outcomes.py.
|
|
|
|
|
config_psa_crypto_config_ecjpake_use_psa () {
|
|
|
|
|
DRIVER_ONLY="$1"
|
|
|
|
|
# start with config full for maximum coverage (also enables USE_PSA)
|
|
|
|
|
scripts/config.py full
|
|
|
|
|
# enable support for drivers and configuring PSA-only algorithms
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
|
|
|
|
if [ "$DRIVER_ONLY" -eq 1 ]; then
|
|
|
|
|
# Disable the module that's accelerated
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECJPAKE_C
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Dynamic secure element support is a deprecated feature and needs to be disabled here.
|
|
|
|
|
# This is done to have the same form of psa_key_attributes_s for libdriver and library.
|
|
|
|
|
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_reference_ecjpake_use_psa
|
|
|
|
|
component_test_psa_crypto_config_accel_ecjpake_use_psa () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECJPAKE + USE_PSA"
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_reference_all_ec_algs_use_psa
|
|
|
|
|
component_test_psa_crypto_config_accel_all_ec_algs_use_psa () {
|
|
|
|
|
msg "build: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated EC algs + USE_PSA"
|
|
|
|
|
|
|
|
|
|
# Algorithms and key types to accelerate
|
|
|
|
|
loc_accel_list="ALG_JPAKE KEY_TYPE_ECC_KEY_PAIR KEY_TYPE_ECC_PUBLIC_KEY"
|
|
|
|
|
loc_accel_list="ALG_ECDSA ALG_DETERMINISTIC_ECDSA \
|
|
|
|
|
ALG_ECDH \
|
|
|
|
|
ALG_JPAKE \
|
|
|
|
|
KEY_TYPE_ECC_KEY_PAIR KEY_TYPE_ECC_PUBLIC_KEY"
|
|
|
|
|
|
|
|
|
|
# Configure and build the test driver library
|
|
|
|
|
# -------------------------------------------
|
|
|
|
@ -2364,110 +2235,56 @@ component_test_psa_crypto_config_accel_ecjpake_use_psa () {
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
# Things we wanted supported in libtestdriver1, but not accelerated in the main library:
|
|
|
|
|
# SHA-1 and all SHA-2 variants, as they are used by ECDSA deterministic.
|
|
|
|
|
loc_extra_list="ALG_SHA_1 ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512"
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list $loc_extra_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Configure and build the main libraries
|
|
|
|
|
# --------------------------------------
|
|
|
|
|
# Configure and build the main libraries with drivers enabled
|
|
|
|
|
# -----------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Use the same config as reference, only without built-in JPAKE
|
|
|
|
|
config_psa_crypto_config_ecjpake_use_psa 1
|
|
|
|
|
# Use the same config as reference, only without built-in EC algs
|
|
|
|
|
config_psa_crypto_config_all_ec_algs_use_psa 1
|
|
|
|
|
|
|
|
|
|
# Build the main library
|
|
|
|
|
# Build the library
|
|
|
|
|
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -O -Werror -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -Werror -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Make sure this was not re-enabled by accident (additive config)
|
|
|
|
|
# Make sure any built-in EC alg was not re-enabled by accident (additive config)
|
|
|
|
|
not grep mbedtls_ecdsa_ library/ecdsa.o
|
|
|
|
|
not grep mbedtls_ecdh_ library/ecdh.o
|
|
|
|
|
not grep mbedtls_ecjpake_ library/ecjpake.o
|
|
|
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
|
# -------------
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated JPAKE + USE_PSA"
|
|
|
|
|
msg "test suites: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated EC algs + USE_PSA"
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
|
|
msg "test: ssl-opt.sh"
|
|
|
|
|
msg "ssl-opt: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated EC algs + USE_PSA"
|
|
|
|
|
tests/ssl-opt.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_accel_ecjpake_use_psa.
|
|
|
|
|
# Used by tests/scripts/analyze_outcomes.py for comparison purposes.
|
|
|
|
|
component_test_psa_crypto_config_reference_ecjpake_use_psa () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with reference ECJPAKE + USE_PSA"
|
|
|
|
|
# Keep in sync with component_test_psa_crypto_config_accel_all_ec_algs_use_psa
|
|
|
|
|
component_test_psa_crypto_config_reference_all_ec_algs_use_psa () {
|
|
|
|
|
msg "build: MBEDTLS_PSA_CRYPTO_CONFIG with non-accelerated EC algs + USE_PSA"
|
|
|
|
|
|
|
|
|
|
# To be aligned with the accel component that needs this
|
|
|
|
|
# To be aligned with component_test_psa_crypto_config_accel_all_ec_algs_use_psa()
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
config_psa_crypto_config_ecjpake_use_psa 0
|
|
|
|
|
config_psa_crypto_config_all_ec_algs_use_psa 0
|
|
|
|
|
|
|
|
|
|
make
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with reference ECJPAKE + USE_PSA"
|
|
|
|
|
msg "test suites: MBEDTLS_PSA_CRYPTO_CONFIG with non-accelerated EC algs + USE_PSA"
|
|
|
|
|
make test
|
|
|
|
|
|
|
|
|
|
msg "test: ssl-opt.sh"
|
|
|
|
|
msg "ssl-opt: MBEDTLS_PSA_CRYPTO_CONFIG with non-accelerated EC algs + USE_PSA"
|
|
|
|
|
tests/ssl-opt.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component_test_psa_crypto_config_accel_ecc () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECC"
|
|
|
|
|
|
|
|
|
|
# Algorithms and key types to accelerate
|
|
|
|
|
loc_accel_list="ALG_ECDH ALG_ECDSA ALG_DETERMINISTIC_ECDSA ALG_JPAKE KEY_TYPE_ECC_KEY_PAIR KEY_TYPE_ECC_PUBLIC_KEY"
|
|
|
|
|
|
|
|
|
|
# Configure and build the test driver library
|
|
|
|
|
# --------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
|
|
|
|
|
# partial support for cipher operations in the driver test library.
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
# These hashes are needed for some ECDSA signature tests.
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_224"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_256"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_384"
|
|
|
|
|
loc_accel_flags="$loc_accel_flags -DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_ALG_SHA_512"
|
|
|
|
|
make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# Configure and build the main libraries
|
|
|
|
|
# ---------------------------------------
|
|
|
|
|
|
|
|
|
|
# start with default + driver support
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
|
|
|
|
|
# disable modules for which we have drivers
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECDSA_C
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECDH_C
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECJPAKE_C
|
|
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
|
#scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 # not in default anyway
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
|
|
|
|
|
|
|
|
|
|
# build and link with test drivers
|
|
|
|
|
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
# make sure these were not auto-re-enabled by accident
|
|
|
|
|
not grep mbedtls_ecdh_ library/ecdh.o
|
|
|
|
|
not grep mbedtls_ecdsa_ library/ecdsa.o
|
|
|
|
|
not grep mbedtls_ecjpake_ library/ecjpake.o
|
|
|
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
|
# -------------
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECC"
|
|
|
|
|
make test
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component_test_psa_crypto_config_accel_rsa_signature () {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated RSA signature"
|
|
|
|
|
|
|
|
|
@ -2766,41 +2583,6 @@ component_test_psa_crypto_config_accel_aead () {
|
|
|
|
|
make test
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component_test_psa_crypto_config_accel_pake() {
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated PAKE"
|
|
|
|
|
|
|
|
|
|
# Start with full
|
|
|
|
|
scripts/config.py full
|
|
|
|
|
|
|
|
|
|
# Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
|
|
|
|
|
# partial support for cipher operations in the driver test library.
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
|
|
|
|
|
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
|
|
|
|
|
|
|
|
loc_accel_list="ALG_JPAKE"
|
|
|
|
|
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
|
|
|
|
|
make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
|
|
|
|
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
|
|
|
|
|
# Make build-in fallback not available
|
|
|
|
|
scripts/config.py unset MBEDTLS_ECJPAKE_C
|
|
|
|
|
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
|
|
|
|
|
|
|
|
|
# Dynamic secure element support is a deprecated feature and needs to be disabled here.
|
|
|
|
|
# This is done to have the same form of psa_key_attributes_s for libdriver and library.
|
|
|
|
|
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
|
|
|
|
|
|
|
|
|
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
|
|
|
|
|
make CFLAGS="$ASAN_CFLAGS -Werror -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS"
|
|
|
|
|
|
|
|
|
|
not grep mbedtls_ecjpake_init library/ecjpake.o
|
|
|
|
|
|
|
|
|
|
msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated PAKE"
|
|
|
|
|
make test
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component_test_psa_crypto_config_no_driver() {
|
|
|
|
|
# full plus MBEDTLS_PSA_CRYPTO_CONFIG
|
|
|
|
|
msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG minus MBEDTLS_PSA_CRYPTO_DRIVERS"
|
|
|
|
|