tests: build the SHA-512 crypto extensions with GCC and a fortified libc

Build sha512.c with -mcpu=cortex-a76 and _FORTIFY_SOURCE for both
MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY and _IF_PRESENT with GCC 13 or later.
Without Mbed-TLS/TF-PSA-Crypto#937 this fails to inline the fortified
memset().

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
This commit is contained in:
Julius Bairaktaris 2026-10-06 00:03:56 +02:00
parent 584c7091e1
commit 1e017acb15

View File

@ -334,6 +334,20 @@ component_build_sha_armce_gcc () {
grep -E 'sha256[a-z0-9]+\s+[qv]' ${BUILTIN_SRC_PATH}/sha256.s
scripts/config.py unset $opt
done
# The same for the SHA-512 extensions with -mcpu=cortex-a76, which has
# extensions beyond Armv8.2-A. Before GCC 13, the SHA-512 intrinsics
# require Armv8.2-A, so this only builds with GCC 13 or later.
if [ "$(gcc_version "${AARCH64_LINUX_GNU_GCC_PREFIX}gcc")" -ge 13 ]; then
for opt in MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT; do
scripts/config.py set $opt
msg "$opt ${AARCH64_LINUX_GNU_GCC_PREFIX}gcc, -mcpu=cortex-a76 -D_FORTIFY_SOURCE=2"
$MAKE_COMMAND -B library/../${BUILTIN_SRC_PATH}/sha512.o library/../${BUILTIN_SRC_PATH}/sha512.s CC="${AARCH64_LINUX_GNU_GCC_PREFIX}gcc" CFLAGS="-std=c99 -Werror -O2 -mcpu=cortex-a76 -D_FORTIFY_SOURCE=2"
msg "$opt ${AARCH64_LINUX_GNU_GCC_PREFIX}gcc, test aarch64 crypto instructions built"
grep -E 'sha512[a-z0-9]+\s+[qv]' ${BUILTIN_SRC_PATH}/sha512.s
scripts/config.py unset $opt
done
fi
}
component_test_arm_linux_gnueabi_gcc_arm5vte () {