In the SPM test build, fail if a symbol wasn't renamed

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-06-17 11:37:52 +02:00
parent 984c19f553
commit 99a3462785

View file

@ -798,6 +798,14 @@ component_test_psa_crypto_key_id_encodes_owner () {
make test make test
} }
# check_renamed_symbols HEADER LIB
# Check that if HEADER contains '#define MACRO ...' then MACRO is not a symbol
# name is LIB.
check_renamed_symbols () {
! nm "$2" | sed 's/.* //' |
grep -x -F "$(sed -n 's/^ *# *define *\([A-Z_a-z][0-9A-Z_a-z]*\)..*/\1/p' "$1")"
}
component_build_psa_crypto_spm () { component_build_psa_crypto_spm () {
msg "build: full config - USE_PSA_CRYPTO + PSA_CRYPTO_KEY_ID_ENCODES_OWNER + PSA_CRYPTO_SPM, make, gcc" msg "build: full config - USE_PSA_CRYPTO + PSA_CRYPTO_KEY_ID_ENCODES_OWNER + PSA_CRYPTO_SPM, make, gcc"
scripts/config.py full scripts/config.py full
@ -809,6 +817,11 @@ component_build_psa_crypto_spm () {
# aren't equipped for the modified names used when MBEDTLS_PSA_CRYPTO_SPM # aren't equipped for the modified names used when MBEDTLS_PSA_CRYPTO_SPM
# is active. # is active.
make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/spe' lib make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/spe' lib
# Check that if a symbol is renamed by crypto_spe.h, the non-renamed
# version is not present.
echo "Checking for renamed symbols in the library"
if_build_succeeded check_renamed_symbols tests/include/spe/crypto_spe.h library/libmbedcrypto.a
} }
component_test_psa_crypto_client () { component_test_psa_crypto_client () {