mirror of
https://github.com/cuberite/polarssl.git
synced 2025-10-03 10:34:16 -04:00
all.sh: refine and simplify component for block_cipher_no_decrypt
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
parent
9938554577
commit
49cd4b5f7d
@ -4507,6 +4507,93 @@ component_test_aes_fewer_tables_and_rom_tables () {
|
|||||||
make test
|
make test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# helper for common_block_cipher_no_decrypt() which:
|
||||||
|
# - enable/disable the list of config options passed from -s/-u respectively.
|
||||||
|
# - build
|
||||||
|
# - test for tests_suite_xxx
|
||||||
|
# - selftest
|
||||||
|
#
|
||||||
|
# Usage: helper_block_cipher_no_decrypt_build_test
|
||||||
|
# [-s set_opts] [-u unset_opts] [-c cflags] [-l ldflags] [option [...]]
|
||||||
|
# Options: -s set_opts the list of config options to enable
|
||||||
|
# -u unset_opts the list of config options to disable
|
||||||
|
# -c cflags the list of options passed to CFLAGS
|
||||||
|
# -l ldflags the list of options passed to LDFLAGS
|
||||||
|
helper_block_cipher_no_decrypt_build_test () {
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-s)
|
||||||
|
shift; local set_opts="$1";;
|
||||||
|
-u)
|
||||||
|
shift; local unset_opts="$1";;
|
||||||
|
-c)
|
||||||
|
shift; local cflags="$1";;
|
||||||
|
-l)
|
||||||
|
shift; local ldflags="$1";;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
set_opts="${set_opts:-}"
|
||||||
|
unset_opts="${unset_opts:-}"
|
||||||
|
cflags="${cflags:-}"
|
||||||
|
ldflags="${ldflags:-}"
|
||||||
|
|
||||||
|
for opt in $set_opts; do
|
||||||
|
echo "Enabling $opt"
|
||||||
|
scripts/config.py set $opt
|
||||||
|
done
|
||||||
|
for opt in $unset_opts; do
|
||||||
|
echo "Disabling $opt"
|
||||||
|
scripts/config.py unset $opt
|
||||||
|
done
|
||||||
|
|
||||||
|
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT${set_opts:+ + $set_opts}${unset_opts:+ - $unset_opts} with $cflags${ldflags:+, $ldflags}"
|
||||||
|
make clean
|
||||||
|
make CC=gcc CFLAGS="$cflags" LDFLAGS="$ldflags"
|
||||||
|
|
||||||
|
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
||||||
|
not grep mbedtls_aes_setkey_dec library/aes.o
|
||||||
|
not grep mbedtls_aria_setkey_dec library/aria.o
|
||||||
|
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
||||||
|
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
||||||
|
not grep mbedtls_internal_aes_decrypt library/aes.o
|
||||||
|
|
||||||
|
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT${set_opts:+ + $set_opts}${unset_opts:+ - $unset_opts} with $cflags${ldflags:+, $ldflags}"
|
||||||
|
make test
|
||||||
|
|
||||||
|
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT${set_opts:+ + $set_opts}${unset_opts:+ - $unset_opts} with $cflags${ldflags:+, $ldflags}"
|
||||||
|
programs/test/selftest
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is a common configuration function used in:
|
||||||
|
# - component_test_block_cipher_no_decrypt_aesni_legacy()
|
||||||
|
# - component_test_block_cipher_no_decrypt_aesni_use_psa()
|
||||||
|
# in order to test BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics,
|
||||||
|
# AESNI assembly and AES C implementation on x86_64 and with AESNI intrinsics
|
||||||
|
# on x86.
|
||||||
|
common_block_cipher_no_decrypt () {
|
||||||
|
# test AESNI intrinsics
|
||||||
|
helper_block_cipher_no_decrypt_build_test \
|
||||||
|
-s "MBEDTLS_AESNI_C" \
|
||||||
|
-c "-Werror -Wall -Wextra -mpclmul -msse2 -maes"
|
||||||
|
|
||||||
|
# test AESNI assembly
|
||||||
|
helper_block_cipher_no_decrypt_build_test \
|
||||||
|
-s "MBEDTLS_AESNI_C" \
|
||||||
|
-c "-Werror -Wall -Wextra -mno-pclmul -mno-sse2 -mno-aes"
|
||||||
|
|
||||||
|
# test AES C implementation
|
||||||
|
helper_block_cipher_no_decrypt_build_test \
|
||||||
|
-u "MBEDTLS_AESNI_C" \
|
||||||
|
-c "-Werror -Wall -Wextra"
|
||||||
|
|
||||||
|
# test AESNI intrinsics for i386 target
|
||||||
|
helper_block_cipher_no_decrypt_build_test \
|
||||||
|
-s "MBEDTLS_AESNI_C" \
|
||||||
|
-c "-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes" \
|
||||||
|
-l "-m32"
|
||||||
|
}
|
||||||
|
|
||||||
component_test_block_cipher_no_decrypt_aesni_legacy () {
|
component_test_block_cipher_no_decrypt_aesni_legacy () {
|
||||||
# enable BLOCK_CIPHER_NO_DECRYPT and disable its incompatible configs
|
# enable BLOCK_CIPHER_NO_DECRYPT and disable its incompatible configs
|
||||||
scripts/config.py set MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
|
scripts/config.py set MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
|
||||||
@ -4515,62 +4602,7 @@ component_test_block_cipher_no_decrypt_aesni_legacy () {
|
|||||||
scripts/config.py unset MBEDTLS_DES_C
|
scripts/config.py unset MBEDTLS_DES_C
|
||||||
scripts/config.py unset MBEDTLS_NIST_KW_C
|
scripts/config.py unset MBEDTLS_NIST_KW_C
|
||||||
|
|
||||||
# test AESNI intrinsics
|
common_block_cipher_no_decrypt
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics"
|
|
||||||
make clean
|
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics"
|
|
||||||
programs/test/selftest
|
|
||||||
|
|
||||||
# test AESNI assembly
|
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI assembly"
|
|
||||||
make clean
|
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mno-pclmul -mno-sse2 -mno-aes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI assembly"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI assembly"
|
|
||||||
programs/test/selftest
|
|
||||||
|
|
||||||
# test AES C implementation
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT with AES C Implementation"
|
|
||||||
scripts/config.py unset MBEDTLS_AESNI_C
|
|
||||||
make clean
|
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT with AES C Implementation"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT with AES C Implementation"
|
|
||||||
programs/test/selftest
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component_test_block_cipher_no_decrypt_aesni_use_psa () {
|
component_test_block_cipher_no_decrypt_aesni_use_psa () {
|
||||||
@ -4589,168 +4621,7 @@ component_test_block_cipher_no_decrypt_aesni_use_psa () {
|
|||||||
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_ECB_NO_PADDING
|
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_ECB_NO_PADDING
|
||||||
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_DES
|
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_DES
|
||||||
|
|
||||||
# test AESNI intrinsics
|
common_block_cipher_no_decrypt
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics"
|
|
||||||
make clean
|
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI intrinsics"
|
|
||||||
programs/test/selftest
|
|
||||||
|
|
||||||
# test AESNI assembly
|
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI assembly"
|
|
||||||
make clean
|
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mno-pclmul -mno-sse2 -mno-aes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI assembly"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT with AESNI assembly"
|
|
||||||
programs/test/selftest
|
|
||||||
|
|
||||||
# test AES C implementation
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT with AES C Implementation"
|
|
||||||
scripts/config.py unset MBEDTLS_AESNI_C
|
|
||||||
make clean
|
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT with AES C Implementation"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT with AES C Implementation"
|
|
||||||
programs/test/selftest
|
|
||||||
}
|
|
||||||
|
|
||||||
component_test_block_cipher_no_decrypt_aesni_m32_legacy () {
|
|
||||||
# enable BLOCK_CIPHER_NO_DECRYPT and disable its incompatible configs
|
|
||||||
scripts/config.py set MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
|
|
||||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC
|
|
||||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_XTS
|
|
||||||
scripts/config.py unset MBEDTLS_DES_C
|
|
||||||
scripts/config.py unset MBEDTLS_NIST_KW_C
|
|
||||||
|
|
||||||
# test AESNI intrinsics for i386 with VIA PADLOCK
|
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
scripts/config.py set MBEDTLS_PADLOCK_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT for i386 with VIA PADLOCK"
|
|
||||||
make clean
|
|
||||||
make CC=gcc LDFLAGS='-m32' CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT for i386 with VIA PADLOCK"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT for i386 with VIA PADLOCK"
|
|
||||||
programs/test/selftest
|
|
||||||
|
|
||||||
# test AESNI intrinsics for i386 without VIA PADLOCK
|
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT for i386 without VIA PADLOCK"
|
|
||||||
make clean
|
|
||||||
make CC=gcc LDFLAGS='-m32' CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT for i386 without VIA PADLOCK"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT for i386 without VIA PADLOCK"
|
|
||||||
programs/test/selftest
|
|
||||||
}
|
|
||||||
|
|
||||||
component_test_block_cipher_no_decrypt_aesni_m32_use_psa () {
|
|
||||||
# enable BLOCK_CIPHER_NO_DECRYPT and disable its incompatible configs
|
|
||||||
scripts/config.py set MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
|
|
||||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC
|
|
||||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_XTS
|
|
||||||
scripts/config.py unset MBEDTLS_DES_C
|
|
||||||
scripts/config.py unset MBEDTLS_NIST_KW_C
|
|
||||||
|
|
||||||
# Enable support for cryptographic mechanisms through the PSA API.
|
|
||||||
# Note: XTS, KW are not yet supported via the PSA API in Mbed TLS.
|
|
||||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
|
||||||
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CBC_NO_PADDING
|
|
||||||
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CBC_PKCS7
|
|
||||||
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_ECB_NO_PADDING
|
|
||||||
scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_DES
|
|
||||||
|
|
||||||
# test AESNI intrinsics for i386 with VIA PADLOCK
|
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
scripts/config.py set MBEDTLS_PADLOCK_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT for i386 with VIA PADLOCK"
|
|
||||||
make clean
|
|
||||||
make CC=gcc LDFLAGS='-m32' CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT for i386 with VIA PADLOCK"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT for i386 with VIA PADLOCK"
|
|
||||||
programs/test/selftest
|
|
||||||
|
|
||||||
# test AESNI intrinsics for i386 without VIA PADLOCK
|
|
||||||
scripts/config.py set MBEDTLS_AESNI_C
|
|
||||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
|
||||||
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT for i386 without VIA PADLOCK"
|
|
||||||
make clean
|
|
||||||
make CC=gcc LDFLAGS='-m32' CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
|
||||||
|
|
||||||
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
|
|
||||||
not grep mbedtls_aes_setkey_dec library/aes.o
|
|
||||||
not grep mbedtls_aria_setkey_dec library/aria.o
|
|
||||||
not grep mbedtls_camellia_setkey_dec library/camellia.o
|
|
||||||
# Make sure we don't have mbedtls_internal_aes_decrypt in AES
|
|
||||||
not grep mbedtls_internal_aes_decrypt library/aes.o
|
|
||||||
|
|
||||||
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT for i386 without VIA PADLOCK"
|
|
||||||
make test
|
|
||||||
|
|
||||||
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT for i386 without VIA PADLOCK"
|
|
||||||
programs/test/selftest
|
|
||||||
}
|
}
|
||||||
|
|
||||||
support_test_block_cipher_no_decrypt_aesce_armcc () {
|
support_test_block_cipher_no_decrypt_aesce_armcc () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user