mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Merge pull request #9238 from tom-cosgrove-arm/psasim_update_for_operation_types
Update PSA simulator C code to do operations by handles
This commit is contained in:
@@ -964,18 +964,17 @@ helper_crypto_client_build() {
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
||||
scripts/config.py unset MBEDTLS_ECP_RESTARTABLE
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
|
||||
else
|
||||
scripts/config.py crypto_full
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
|
||||
# We need to match the client with MBEDTLS_PSA_CRYPTO_SE_C
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
||||
# Also ensure MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER not set (to match client)
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
|
||||
fi
|
||||
|
||||
make -C tests/psa-client-server/psasim/ CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" $TARGET_LIB "$@"
|
||||
|
||||
# cleanup() will restore some backed-up files which include $CONFIG_H and
|
||||
# $CRYPTO_CONFIG_H. Built libraries were already copied to psasim at this
|
||||
# point.
|
||||
cleanup
|
||||
}
|
||||
|
||||
################################################################
|
||||
@@ -6158,45 +6157,60 @@ component_check_test_helpers () {
|
||||
}
|
||||
|
||||
component_test_psasim() {
|
||||
msg "build library for client"
|
||||
|
||||
helper_crypto_client_build client
|
||||
|
||||
msg "build library for server"
|
||||
|
||||
scripts/config.py crypto
|
||||
|
||||
helper_crypto_client_build server
|
||||
|
||||
msg "build psasim"
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS"
|
||||
msg "build server"
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_partition
|
||||
|
||||
# cleanup() will restore some backed-up files which include $CONFIG_H and
|
||||
# $CRYPTO_CONFIG_H. Built libraries were already copied to psasim at this
|
||||
# point.
|
||||
cleanup
|
||||
|
||||
msg "build library for client"
|
||||
helper_crypto_client_build client
|
||||
|
||||
msg "build psasim to test psa_client"
|
||||
rm -f tests/psa-client-server/psasim/test/psa_client # In case left behind
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client
|
||||
|
||||
msg "test psasim"
|
||||
tests/psa-client-server/psasim/test/run_test.sh
|
||||
|
||||
|
||||
msg "build psasim to test psa_hash_compute"
|
||||
# Delete the executable to ensure we build using the right MAIN
|
||||
rm tests/psa-client-server/psasim/test/psa_client
|
||||
# API under test: psa_hash_compute()
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="src/aut_psa_hash_compute.c"
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="src/aut_psa_hash_compute.c" test/psa_client
|
||||
|
||||
msg "test psasim running psa_hash_compute"
|
||||
tests/psa-client-server/psasim/test/run_test.sh
|
||||
|
||||
# Next APIs under test: psa_hash_*(). Just use the PSA hash example.
|
||||
aut_psa_hash="../../../programs/psa/psa_hash.c"
|
||||
if [ -f "tests/psa-client-server/psasim/$aut_psa_hash" ]; then
|
||||
|
||||
msg "build psasim to test all psa_hash_* APIs"
|
||||
# Delete the executable to ensure we build using the right MAIN
|
||||
rm tests/psa-client-server/psasim/test/psa_client
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="$aut_psa_hash"
|
||||
# Next APIs under test: psa_hash_*(). Use our copy of the PSA hash example.
|
||||
msg "build psasim to test all psa_hash_* APIs"
|
||||
# Delete the executable to ensure we build using the right MAIN
|
||||
rm tests/psa-client-server/psasim/test/psa_client
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="src/aut_psa_hash.c" test/psa_client
|
||||
|
||||
msg "test psasim running psa_hash sample"
|
||||
tests/psa-client-server/psasim/test/run_test.sh
|
||||
else
|
||||
echo $aut_psa_hash NOT FOUND, so not running that test
|
||||
fi
|
||||
msg "test psasim running psa_hash sample"
|
||||
tests/psa-client-server/psasim/test/run_test.sh
|
||||
|
||||
|
||||
# Next APIs under test: psa_aead_*(). Use our copy of the PSA aead example.
|
||||
msg "build psasim to test all psa_aead_* APIs"
|
||||
# Delete the executable to ensure we build using the right MAIN
|
||||
rm tests/psa-client-server/psasim/test/psa_client
|
||||
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="src/aut_psa_aead_demo.c" test/psa_client
|
||||
|
||||
msg "test psasim running psa_aead_demo sample"
|
||||
tests/psa-client-server/psasim/test/run_test.sh aes128-gcm
|
||||
tests/psa-client-server/psasim/test/run_test.sh aes256-gcm
|
||||
tests/psa-client-server/psasim/test/run_test.sh aes128-gcm_8
|
||||
tests/psa-client-server/psasim/test/run_test.sh chachapoly
|
||||
|
||||
msg "clean psasim"
|
||||
make -C tests/psa-client-server/psasim clean
|
||||
|
Reference in New Issue
Block a user