• Home
  • Raw
  • Download

Lines Matching +full:build +full:- +full:and +full:- +full:test

6 # SPDX-License-Identifier: Apache-2.0
12 # http://www.apache.org/licenses/LICENSE-2.0
17 # See the License for the specific language governing permissions and
27 # -------
32 # ---------------
34 # Warning: the test is destructive. It includes various build modes and
35 # configurations, and can and will arbitrarily change the current CMake
40 # After running this script, the CMake cache will be lost and CMake
44 # * Basic Unix tools (Windows users note: a Unix-style find must be before
49 # * GCC and Clang (recent enough for using ASan with gcc and MemSan with clang, or valgrind)
51 # * arm-gcc and mingw-gcc
52 # * ArmCC 5 and ArmCC 6, unless invoked with --no-armcc
53 # * OpenSSL and GnuTLS command line tools, recent enough for the
55 # to test, then a legacy version of these tools must be present as well
62 # The behavior on an error depends on whether --keep-going (alias -k)
64 # * Without --keep-going: the script stops on the first error without
67 # * With --keep-going: the script runs all requested components and
72 # script -c tests/scripts/all.sh
77 # ---------------------
84 # * component_build_XXX: build things but don't run them.
85 # * component_test_XXX: build and test.
86 # * support_XXX: if support_XXX exists and returns false then
97 # fails if any command in it returns a non-zero status.
101 # cleaned-up state, and don't need to perform the cleanup themselves.
106 # `tests/Makefile` and `programs/fuzz/Makefile` from git.
107 # This cleans up after an in-tree use of CMake.
111 # the end and fast checks near the beginning.
116 #### Initialization and command line parsing
119 # Abort on errors (even on the left-hand side of a pipe).
121 set -e -o pipefail -u
124 if [ -d library -a -d include -a -d tests ]; then :; else
135 # suffix from auxiliary scripts so that all.sh and auxiliary scripts can
140 # Files clobbered by in-tree cmake
149 # Seed value used with the --release-test option.
151 # See also RELEASE_SEED in basic-build-test.sh. Debugging is easier if
154 # basic-build-test.sh as well.
158 … : ${MBEDTLS_TEST_PLATFORM="$(uname -s | tr -c \\n0-9A-Za-z _)-$(uname -m | tr -c \\n0-9A-Za-z _)"}
166 : ${GNUTLS_CLI:="gnutls-cli"}
167 : ${GNUTLS_SERV:="gnutls-serv"}
173 : ${ARM_NONE_EABI_GCC_PREFIX:=arm-none-eabi-}
174 : ${ARM_LINUX_GNUEABI_GCC_PREFIX:=arm-linux-gnueabi-}
176 # if MAKEFLAGS is not set add the -j option to speed up invocations of make
177 if [ -z "${MAKEFLAGS+set}" ]; then
178 export MAKEFLAGS="-j$(all_sh_nproc)"
184 # CFLAGS and LDFLAGS for Asan builds that don't use CMake
185 ASAN_CFLAGS='-Werror -Wall -Wextra -fsanitize=address,undefined -fno-sanitize-recover=all'
191 ALL_COMPONENTS=$(sed -n 's/^ *component_\([0-9A-Z_a-z]*\) *().*/\1/p' <"$0")
204 # Test whether the component $1 is included in the command line patterns.
209 set -f
229 $0 --no-armcc --except test_memsan
230 Run everything except builds that require armcc and MemSan.
233 -h|--help Print this help and exit.
234 --list-all-components List all available test components and exit.
235 --list-components List components supported on this platform and exit.
238 -q|--quiet Only output component names, and errors if any.
239 -f|--force Force the tests to overwrite any modified files.
240 -k|--keep-going Run all tests and report errors at the end.
241 -m|--memory Additional optional memory tests.
242 --append-outcome Append to the outcome file (if used).
243 --arm-none-eabi-gcc-prefix=<string>
244 Prefix for a cross-compiler for arm-none-eabi
246 --arm-linux-gnueabi-gcc-prefix=<string>
247 Prefix for a cross-compiler for arm-linux-gnueabi
249 --armcc Run ARM Compiler builds (on by default).
250 --restore First clean up the build tree, restoring backed up
253 --error-test Error test mode: run a failing function in addition
255 --except Exclude the COMPONENTs listed on the command line,
257 --no-append-outcome Write a new outcome file and analyze it (default).
258 --no-armcc Skip ARM Compiler builds.
259 --no-force Refuse to overwrite modified files (default).
260 --no-keep-going Stop at the first error (default).
261 --no-memory No additional memory tests (default).
262 --no-quiet Print full ouput from components.
263 --out-of-source-dir=<path> Directory used for CMake out-of-source build tests.
264 --outcome-file=<path> File where test outcomes are written (not done if
266 --random-seed Use a random seed value for randomized tests (default).
267-r|--release-test Run this script in release mode. This fixes the seed value to ${RELEASE_SEED…
268 -s|--seed Integer seed value to use for this test run.
271 --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory.
272 --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory.
273 --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests.
274 --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests.
275 --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests.
276 --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests.
277 --openssl=<OpenSSL_path> OpenSSL executable to use for most tests.
278 --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests..
279--openssl-next=<OpenSSL_path> OpenSSL executable to use for recent things like ARIA
291 find . -name .git -prune -o \
292 -iname CMakeFiles -exec rm -rf {} \+ -o \
293 \( -iname cmake_install.cmake -o \
294 -iname CTestTestfile.cmake -o \
295 -iname CMakeCache.txt -o \
296 -path './cmake/*.cmake' \) -exec rm -f {} \+
297 # Recover files overwritten by in-tree CMake builds
298 rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile
300 # Remove any artifacts from the component_test_cmake_as_subdirectory test.
301 rm -rf programs/test/cmake_subproject/build
302 rm -f programs/test/cmake_subproject/Makefile
303 rm -f programs/test/cmake_subproject/cmake_subproject
305 # Remove any artifacts from the component_test_cmake_as_package test.
306 rm -rf programs/test/cmake_package/build
307 rm -f programs/test/cmake_package/Makefile
308 rm -f programs/test/cmake_package/cmake_package
310 # Remove any artifacts from the component_test_cmake_as_installed_package test.
311 rm -rf programs/test/cmake_package_install/build
312 rm -f programs/test/cmake_package_install/Makefile
313 rm -f programs/test/cmake_package_install/cmake_package_install
317 cp -p "$x$backup_suffix" "$x"
322 # in non-keep-going mode).
327 rm -f "$x$backup_suffix"
339 trap - $1
340 kill -$1 $$
353 sysctl -n hw.ncpuonline || # NetBSD, OpenBSD
354 sysctl -n hw.ncpu || # FreeBSD
361 if [ -n "${current_component:-}" ]; then
367 if [ $QUIET -eq 1 ]; then
382 msg "build: ARM Compiler 6 ($FLAGS)"
384 WARNING_CFLAGS='-xc -std=c99' make lib
387 "$ARMC6_FROMELF" -z library/*.o
416 # all.sh will still run and work properly.
417 while [ $# -gt 0 ]; do
419 --append-outcome) append_outcome=1;;
420 --arm-none-eabi-gcc-prefix) shift; ARM_NONE_EABI_GCC_PREFIX="$1";;
421 --arm-linux-gnueabi-gcc-prefix) shift; ARM_LINUX_GNUEABI_GCC_PREFIX="$1";;
422 --armcc) no_armcc=;;
423 --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
424 --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
425 --error-test) error_test=$((error_test + 1));;
426 --except) all_except=1;;
427 --force|-f) FORCE=1;;
428 --gnutls-cli) shift; GNUTLS_CLI="$1";;
429 --gnutls-legacy-cli) shift; GNUTLS_LEGACY_CLI="$1";;
430 --gnutls-legacy-serv) shift; GNUTLS_LEGACY_SERV="$1";;
431 --gnutls-serv) shift; GNUTLS_SERV="$1";;
432 --help|-h) usage; exit;;
433 --keep-going|-k) KEEP_GOING=1;;
434 --list-all-components) printf '%s\n' $ALL_COMPONENTS; exit;;
435 --list-components) printf '%s\n' $SUPPORTED_COMPONENTS; exit;;
436 --memory|-m) MEMORY=1;;
437 --no-append-outcome) append_outcome=0;;
438 --no-armcc) no_armcc=1;;
439 --no-force) FORCE=0;;
440 --no-keep-going) KEEP_GOING=0;;
441 --no-memory) MEMORY=0;;
442 --no-quiet) QUIET=0;;
443 --openssl) shift; OPENSSL="$1";;
444 --openssl-legacy) shift; OPENSSL_LEGACY="$1";;
445 --openssl-next) shift; OPENSSL_NEXT="$1";;
446 --outcome-file) shift; MBEDTLS_TEST_OUTCOME_FILE="$1";;
447 --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";;
448 --quiet|-q) QUIET=1;;
449 --random-seed) unset SEED;;
450 --release-test|-r) SEED=$RELEASE_SEED;;
451 --restore) restore_first=1;;
452 --seed|-s) shift; SEED="$1";;
453 -*)
455 echo >&2 "Run $0 --help for usage."
464 if [ -z "$COMMAND_LINE_COMPONENTS" ] && [ $restore_first -eq 0 ]; then
468 # --no-armcc is a legacy option. The modern way is --except '*_armcc*'.
470 if [ -n "$no_armcc" ] && [ $all_except -eq 1 ]; then
475 if [ $all_except -eq 0 ]; then
479 set -f
495 if [ $unsupported -ne 0 ]; then
500 # Build the list of components to run.
503 if is_component_included "$component"; [ $? -eq $all_except ]; then
513 if [ $FORCE -eq 1 ]; then
514 rm -rf "$OUT_OF_SOURCE_DIR"
515 git checkout-index -f -q $CONFIG_H
519 if [ -d "$OUT_OF_SOURCE_DIR" ]; then
520 echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2
521 echo "You can either delete this directory manually, or force the test by rerunning"
522 echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR"
526 if ! git diff --quiet include/mbedtls/mbedtls_config.h; then
527 … err_msg "Warning - the configuration file 'include/mbedtls/mbedtls_config.h' has been edited. "
528 echo "You can either delete or preserve your work, or force the test by rerunning the"
529 echo "script as: $0 --force"
541 case "$(head -n1 Makefile)" in
543 …git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile pro…
544 … git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile
551 cp -p "$x" "$x$backup_suffix"
567 if [ -t 1 ]; then
568 case "${TERM:-}" in
577 failure_summary_file=$PWD/all-sh-failures-$$.log
581 # command fails (test command) or not (configure or build).
593 *make*[\ /]tests*) false;; # make tests, make CFLAGS=-I../tests, ...
594 *test*) true;; # make test, tests/stuff, env V=v tests/stuff, ...
610 failed_command=${report_failed_command-$BASH_COMMAND}
612 if [[ $last_failure_status -eq $previous_failure_status &&
614 ${#FUNCNAME[@]} == $((previous_failure_funcall_depth - 1)) ]]
618 # command of a function returns a nonzero status, and the function
627 text="$current_section: $failed_command -> $last_failure_status"
631 # If the command is fatal (configure or build command), stop this
632 # component. Otherwise (test command) keep the component running
633 # (run more tests from the same build).
640 if [ $failure_count -gt 0 ]; then
646 elif [ -z "${1-}" ]; then
649 if [ -n "${1-}" ]; then
652 rm -f "$failure_summary_file"
653 if [ $failure_count -gt 0 ]; then
659 # record_status() and if_build_succeeded() are kept temporarily for backward
682 if [ -n "$MBEDTLS_TEST_OUTCOME_FILE" ] && [ "$append_outcome" -eq 0 ]; then
683 rm -f "$MBEDTLS_TEST_OUTCOME_FILE"
688 if [ $QUIET -eq 1 ]; then
695 echo "MBEDTLS_TEST_OUTCOME_FILE: ${MBEDTLS_TEST_OUTCOME_FILE:-(none)}"
696 echo "SEED: ${SEED-"UNSET"}"
711 # Build the list of variables to pass to output_env.sh.
715 # Require OpenSSL and GnuTLS if running any tests (as opposed to
716 # only doing builds). Not all tests run OpenSSL and GnuTLS, but this
719 # To avoid setting OpenSSL and GnuTLS for each call to compat.sh
720 # and ssl-opt.sh, we just export the variables they require.
724 # Avoid passing --seed flag in every call to ssl-opt.sh
725 if [ -n "${SEED-}" ]; then
747 *_mingw[_\ ]*) check_tools "i686-w64-mingw32-gcc";;
767 if [ $QUIET -eq 1 ]; then
784 if [ $QUIET -eq 1 ]; then
798 # Test Suites to be executed
800 # The test ordering tries to optimize for the following criteria:
802 # and/or are more likely to fail than others (eg I use Clang most of the
803 # time, so start with a GCC build).
814 msg "Check: check-generated-files, files generated with make" # 2s
816 tests/scripts/check-generated-files.sh
818 msg "Check: check-generated-files -u, files present" # 2s
819 tests/scripts/check-generated-files.sh -u
821 tests/scripts/check-generated-files.sh
823 msg "Check: check-generated-files -u, files absent" # 2s
825 tests/scripts/check-generated-files.sh -u
827 tests/scripts/check-generated-files.sh
835 tests/scripts/check-doxy-blocks.pl
845 rm -f ChangeLog.new
846 scripts/assemble_changelog.py -o ChangeLog.new
847 if [ -e ChangeLog.new ]; then
849 # non-empty.
850 diff -u ChangeLog ChangeLog.new || true
856 msg "Check: declared and exported names (builds the library)" # < 3s
857 tests/scripts/check_names.py -v
861 msg "Check: test case descriptions" # < 1s
862 if [ $QUIET -eq 1 ]; then
863 opt='--quiet'
879 #### Build and test many configurations and targets
883 msg "build: make, default config (out-of-box)" # ~1min
889 msg "test: main suites make, default config (out-of-box)" # ~10s
890 make test
892 msg "selftest: make, default config (out-of-box)" # ~10s
893 programs/test/selftest
900 msg "build: cmake, gcc, ASan" # ~ 1 min 50s
901 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
904 msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s
905 make test
907 msg "test: selftest (ASan build)" # ~ 10s
908 programs/test/selftest
910 msg "test: ssl-opt.sh (ASan build)" # ~ 1 min
911 tests/ssl-opt.sh
913 msg "test: compat.sh (ASan build)" # ~ 6 min
916 msg "test: context-info.sh (ASan build)" # ~ 15 sec
917 tests/context-info.sh
921 msg "build: full config, cmake, gcc, ASan"
923 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
926 msg "test: main suites (inc. selftests) (full config, ASan build)"
927 make test
929 msg "test: selftest (ASan build)" # ~ 10s
930 programs/test/selftest
932 msg "test: ssl-opt.sh (full config, ASan build)"
933 tests/ssl-opt.sh
935 msg "test: compat.sh (full config, ASan build)"
938 msg "test: context-info.sh (full config, ASan build)" # ~ 15 sec
939 tests/context-info.sh
943 msg "build: full config - USE_PSA_CRYPTO + PSA_CRYPTO_KEY_ID_ENCODES_OWNER, cmake, gcc, ASan"
947 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
950 msg "test: full config - USE_PSA_CRYPTO + PSA_CRYPTO_KEY_ID_ENCODES_OWNER, cmake, gcc, ASan"
951 make test
959 grep -x -F "$(sed -n 's/^ *# *define *\([A-Z_a-z][0-9A-Z_a-z]*\)..*/\1/p' "$1")"
963 …msg "build: full config - USE_PSA_CRYPTO + PSA_CRYPTO_KEY_ID_ENCODES_OWNER + PSA_CRYPTO_SPM, make,…
969 # We can only compile, not link, since our test and sample programs
972 make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/spe' lib
974 # Check that if a symbol is renamed by crypto_spe.h, the non-renamed
981 msg "build: default config - PSA_CRYPTO_C + PSA_CRYPTO_CLIENT, make"
987 msg "test: default config - PSA_CRYPTO_C + PSA_CRYPTO_CLIENT, make"
988 make test
992 msg "build: default config minus MBEDTLS_GENPRIME"
996 msg "test: default config minus MBEDTLS_GENPRIME"
997 make test
1001 msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s
1002 # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
1003 # want to re-generate generated files that depend on it, quite correctly.
1006 # cmake can't know this, but re-generation is actually not necessary as
1008 # whether they're on or off. So, disable cmake's (over-sensitive here)
1009 # dependency resolution for generated files and just rely on them being
1011 CC=gcc cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
1012 tests/scripts/test-ref-configs.pl
1016 msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min
1018 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1021 msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s
1022 make test
1024 msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min
1025 tests/ssl-opt.sh
1029 msg "build: Default + !MBEDTLS_PEM_PARSE_C + !MBEDTLS_FS_IO (ASan build)"
1034 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1037 …msg "test: !MBEDTLS_PEM_PARSE_C !MBEDTLS_FS_IO - main suites (inc. selftests) (ASan build)" # ~ 50s
1038 make test
1040 msg "test: !MBEDTLS_PEM_PARSE_C !MBEDTLS_FS_IO - ssl-opt.sh (ASan build)" # ~ 6 min
1041 tests/ssl-opt.sh
1045 msg "build: Default + RSA_NO_CRT (ASan build)" # ~ 6 min
1047 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1050 msg "test: RSA_NO_CRT - main suites (inc. selftests) (ASan build)" # ~ 50s
1051 make test
1053 msg "test: RSA_NO_CRT - RSA-related part of ssl-opt.sh (ASan build)" # ~ 5s
1054 tests/ssl-opt.sh -f RSA
1056 msg "test: RSA_NO_CRT - RSA-related part of compat.sh (ASan build)" # ~ 3 min
1057 tests/compat.sh -t RSA
1059 msg "test: RSA_NO_CRT - RSA-related part of context-info.sh (ASan build)" # ~ 15 sec
1060 tests/context-info.sh
1064 msg "build: Full minus CTR_DRBG, classic crypto in TLS"
1069 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1072 msg "test: Full minus CTR_DRBG, classic crypto - main suites"
1073 make test
1075 # In this configuration, the TLS test programs use HMAC_DRBG.
1078 msg "test: Full minus CTR_DRBG, classic crypto - ssl-opt.sh (subset)"
1079 tests/ssl-opt.sh -f 'Default\|SSL async private.*delay=\|tickets enabled on server'
1081 msg "test: Full minus CTR_DRBG, classic crypto - compat.sh (subset)"
1082 tests/compat.sh -m tls12 -t 'ECDSA PSK' -V NO -p OpenSSL
1086 msg "build: Full minus CTR_DRBG, PSA crypto in TLS"
1091 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1094 msg "test: Full minus CTR_DRBG, USE_PSA_CRYPTO - main suites"
1095 make test
1097 # In this configuration, the TLS test programs use HMAC_DRBG.
1100 msg "test: Full minus CTR_DRBG, USE_PSA_CRYPTO - ssl-opt.sh (subset)"
1101 tests/ssl-opt.sh -f 'Default\|SSL async private.*delay=\|tickets enabled on server'
1103 msg "test: Full minus CTR_DRBG, USE_PSA_CRYPTO - compat.sh (subset)"
1104 tests/compat.sh -m tls12 -t 'ECDSA PSK' -V NO -p OpenSSL
1108 msg "build: Full minus HMAC_DRBG, classic crypto in TLS"
1114 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1117 msg "test: Full minus HMAC_DRBG, classic crypto - main suites"
1118 make test
1123 # Test SSL with non-deterministic ECDSA. Only test features that
1125 msg "test: Full minus HMAC_DRBG, classic crypto - ssl-opt.sh (subset)"
1126 tests/ssl-opt.sh -f 'Default\|SSL async private: sign'
1128 # To save time, only test one protocol version, since this part of
1130 msg "test: Full minus HMAC_DRBG, classic crypto - compat.sh (ECDSA)"
1131 tests/compat.sh -m tls12 -t 'ECDSA'
1135 msg "build: Full minus HMAC_DRBG, PSA crypto in TLS"
1141 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1144 msg "test: Full minus HMAC_DRBG, USE_PSA_CRYPTO - main suites"
1145 make test
1150 # Test SSL with non-deterministic ECDSA. Only test features that
1152 msg "test: Full minus HMAC_DRBG, USE_PSA_CRYPTO - ssl-opt.sh (subset)"
1153 tests/ssl-opt.sh -f 'Default\|SSL async private: sign'
1155 # To save time, only test one protocol version, since this part of
1157 msg "test: Full minus HMAC_DRBG, USE_PSA_CRYPTO - compat.sh (ECDSA)"
1158 tests/compat.sh -m tls12 -t 'ECDSA'
1162 msg "build: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto in TLS"
1172 # When MBEDTLS_USE_PSA_CRYPTO is disabled and there is no DRBG,
1173 # the SSL test programs don't have an RNG and can't work. Explicitly
1174 # make them use the PSA RNG with -DMBEDTLS_TEST_USE_PSA_CRYPTO_RNG.
1175 make CFLAGS="$ASAN_CFLAGS -O2 -DMBEDTLS_TEST_USE_PSA_CRYPTO_RNG" LDFLAGS="$ASAN_CFLAGS"
1177 msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto - main suites"
1178 make test
1180 msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto - ssl-opt.sh (subset)"
1181 tests/ssl-opt.sh -f 'Default'
1185 msg "build: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, PSA crypto in TLS"
1194 make CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS"
1196 msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, PSA crypto - main suites"
1197 make test
1199 msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, PSA crypto - ssl-opt.sh (subset)"
1200 tests/ssl-opt.sh -f 'Default\|opaque'
1204 msg "build: full + PSA_CRYPTO_EXTERNAL_RNG + USE_PSA_CRYPTO minus CTR_DRBG"
1209 make CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS"
1211 msg "test: full + PSA_CRYPTO_EXTERNAL_RNG + USE_PSA_CRYPTO minus CTR_DRBG"
1212 make test
1214 msg "test: full + PSA_CRYPTO_EXTERNAL_RNG + USE_PSA_CRYPTO minus CTR_DRBG"
1215 tests/ssl-opt.sh -f 'Default\|opaque'
1219 msg "build: Everest ECDH context (ASan build)" # ~ 6 min
1221 CC=clang cmake -D CMAKE_BUILD_TYPE:String=Asan .
1224 msg "test: Everest ECDH context - main suites (inc. selftests) (ASan build)" # ~ 50s
1225 make test
1227 msg "test: Everest ECDH context - ECDH-related part of ssl-opt.sh (ASan build)" # ~ 5s
1228 tests/ssl-opt.sh -f ECDH
1230 msg "test: Everest ECDH context - compat.sh with some ECDH ciphersuites (ASan build)" # ~ 3 min
1232 tests/compat.sh -f ECDH -V NO -e 'ARIA\|CAMELLIA\|CHACHA\|DES'
1236 msg "build: Everest ECDH context, only Curve25519" # ~ 6 min
1243 for c in $(sed -n 's/#define \(MBEDTLS_ECP_DP_[0-9A-Z_a-z]*_ENABLED\).*/\1/p' <"$CONFIG_H"); do
1248 make CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS"
1250 msg "test: Everest ECDH context, only Curve25519" # ~ 50s
1251 make test
1255 msg "build: small SSL_OUT_CONTENT_LEN (ASan build)"
1258 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1261 msg "test: small SSL_OUT_CONTENT_LEN - ssl-opt.sh MFL and large packet tests"
1262 tests/ssl-opt.sh -f "Max fragment\|Large packet"
1266 msg "build: small SSL_IN_CONTENT_LEN (ASan build)"
1269 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1272 msg "test: small SSL_IN_CONTENT_LEN - ssl-opt.sh MFL tests"
1273 tests/ssl-opt.sh -f "Max fragment"
1277 msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0"
1279 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1282 msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0 - ssl-opt.sh specific reordering test"
1283 …tests/ssl-opt.sh -f "DTLS reordering: Buffer out-of-order hs msg before reassembling next, free bu…
1287 msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1"
1289 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1292 msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1 - ssl-opt.sh specific reordering test"
1293 …tests/ssl-opt.sh -f "DTLS reordering: Buffer encrypted Finished message, drop for fragmented NewSe…
1297 msg "build+test: psa_collect_statuses" # ~30s
1301 grep -q '^0:psa_crypto_init:' tests/statuses.log
1302 rm -f tests/statuses.log
1306 msg "build: cmake, full config, clang" # ~ 50s
1308 CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release -D ENABLE_TESTING=On .
1311 msg "test: main suites (full config, clang)" # ~ 5s
1312 make test
1314 msg "test: psa_constant_names (full config, clang)" # ~ 1s
1317 msg "test: ssl-opt.sh default, ECJPAKE, SSL async (full config)" # ~ 1s
1318 tests/ssl-opt.sh -f 'Default\|ECJPAKE\|SSL async private'
1320 msg "test: compat.sh DES, 3DES & NULL (full config)" # ~ 2 min
1321 …S_CLI="$GNUTLS_LEGACY_CLI" GNUTLS_SERV="$GNUTLS_LEGACY_SERV" tests/compat.sh -e '^$' -f 'NULL\|DES'
1323 msg "test: compat.sh ARIA + ChachaPoly"
1324 env OPENSSL_CMD="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
1328 # This tests both (1) accesses to undefined memory, and (2) branches or
1330 # - unset MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN - does the failure persist?
1331 # - or alternatively, change the build type to MemSanDbg, which enables
1332 # origin tracking and nicer stack traces (which are useful for debugging
1333 # anyway), and check if the origin was TEST_CF_SECRET() or something else.
1334 msg "build: cmake MSan (clang), full config with constant flow testing"
1338 CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
1341 msg "test: main suites (Msan + constant flow)"
1342 make test
1347 # (heap buffer overflows, use of uninitialized memory, use-after-free,
1348 # etc.) and (2) branches or memory access depending on secret values,
1350 # secret and actually uninitialized:
1351 # - unset MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND - does the failure persist?
1352 # - or alternatively, build with debug info and manually run the offending
1353 # test suite with valgrind --track-origins=yes, then check if the origin
1355 msg "build: cmake release GCC, full config with constant flow testing"
1358 cmake -D CMAKE_BUILD_TYPE:String=Release .
1363 msg "test: main suites (valgrind + constant flow)"
1368 # Test that removing the deprecated features from the default
1370 msg "build: make, default + MBEDTLS_DEPRECATED_REMOVED" # ~ 30s
1372 make CC=gcc CFLAGS='-O -Werror -Wall -Wextra'
1374 msg "test: make, default + MBEDTLS_DEPRECATED_REMOVED" # ~ 5s
1375 make test
1379 msg "build: make, full_no_deprecated config" # ~ 30s
1381 make CC=gcc CFLAGS='-O -Werror -Wall -Wextra'
1383 msg "test: make, full_no_deprecated config" # ~ 5s
1384 make test
1388 # Test that there is nothing deprecated in "full_no_deprecated".
1391 msg "build: make, full_no_deprecated config, MBEDTLS_DEPRECATED_WARNING" # ~ 30s
1395 make CC=gcc CFLAGS='-O -Werror -Wall -Wextra'
1397 msg "test: make, full_no_deprecated config, MBEDTLS_DEPRECATED_WARNING" # ~ 5s
1398 make test
1402 # Test that when MBEDTLS_DEPRECATED_WARNING is enabled, the build passes
1404 msg "build: make, full config + MBEDTLS_DEPRECATED_WARNING, expect warnings" # ~ 30s
1408 make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-error=cpp' lib programs
1410 msg "build: make tests, full config + MBEDTLS_DEPRECATED_WARNING, expect warnings" # ~ 30s
1413 # Expect warnings from '#warning' directives in check_config.h and
1414 # from the use of deprecated functions in test suites.
1415 …make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-error=deprecated-declarations -Wno-error=cpp -DM…
1417 msg "test: full config + MBEDTLS_TEST_DEPRECATED" # ~ 30s
1418 make test
1421 # Check that the specified libraries exist and are empty.
1424 ! nm "$@" 2>/dev/null | grep -v ':$' | grep .
1428 msg "build: make, crypto only"
1430 make CFLAGS='-O1 -Werror'
1435 msg "build: make, crypto only, full config"
1437 make CFLAGS='-O1 -Werror'
1442 msg "build: make, crypto only, baremetal config"
1444 make CFLAGS='-O1 -Werror'
1449 msg "test/build: curves.pl (gcc)" # ~ 4 min
1454 msg "test/build: curves.pl with MBEDTLS_USE_PSA_CRYPTO defined (gcc)"
1460 msg "test/build: depends-hashes.pl (gcc)" # ~ 2 min
1461 tests/scripts/depends-hashes.pl
1465 msg "test/build: depends-hashes.pl with MBEDTLS_USE_PSA_CRYPTO defined (gcc)"
1467 tests/scripts/depends-hashes.pl
1471 msg "test/build: depends-pkalgs.pl (gcc)" # ~ 2 min
1472 tests/scripts/depends-pkalgs.pl
1476 msg "test/build: depends-pkalgs.pl with MBEDTLS_USE_PSA_CRYPTO defined (gcc)"
1478 tests/scripts/depends-pkalgs.pl
1482 msg "test/build: key-exchanges (gcc)" # ~ 1 min
1483 tests/scripts/key-exchanges.pl
1487 msg "build: Unix make, full, gcc + g++"
1491 msg "test: cpp_dummy_build"
1492 programs/test/cpp_dummy_build
1496 msg "build: MBEDTLS_XXX_ALT" # ~30s
1499 # aesni.c and padlock.c reference mbedtls_aes_context fields directly.
1505 # directly and assumes the implementation works with partial groups.
1509 scripts/config.py set-all 'MBEDTLS_([A-Z0-9]*|NIST_KW)_ALT'
1513 make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/alt-dummy' lib
1517 msg "build: MBEDTLS_DHM_ALT" # ~30s
1524 make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/alt-dummy' lib
1528 # full minus MBEDTLS_USE_PSA_CRYPTO: run the same set of tests as basic-build-test.sh
1529 msg "build: cmake, full config minus MBEDTLS_USE_PSA_CRYPTO, ASan"
1538 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
1541 msg "test: main suites (full minus MBEDTLS_USE_PSA_CRYPTO)"
1542 make test
1544 msg "test: ssl-opt.sh (full minus MBEDTLS_USE_PSA_CRYPTO)"
1545 tests/ssl-opt.sh
1547 msg "test: compat.sh default (full minus MBEDTLS_USE_PSA_CRYPTO)"
1550 msg "test: compat.sh DES & NULL (full minus MBEDTLS_USE_PSA_CRYPTO)"
1551 …TLS_LEGACY_CLI" GNUTLS_SERV="$GNUTLS_LEGACY_SERV" tests/compat.sh -e '3DES\|DES-CBC3' -f 'NULL\|DE…
1553 msg "test: compat.sh ARIA + ChachaPoly (full minus MBEDTLS_USE_PSA_CRYPTO)"
1554 env OPENSSL_CMD="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
1558 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA"
1560 # Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
1561 # partial support for cipher operations in the driver test library.
1562 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
1563 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
1566 scripts/config.py -f tests/include/test/drivers/config_test_driver.h set MBEDTLS_SHA384_C
1567 scripts/config.py -f tests/include/test/drivers/config_test_driver.h set MBEDTLS_SHA512_C
1570 …loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g'…
1571 make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
1573 # Restore test driver base configuration
1574 scripts/config.py -f tests/include/test/drivers/config_test_driver.h unset MBEDTLS_SHA384_C
1575 scripts/config.py -f tests/include/test/drivers/config_test_driver.h unset MBEDTLS_SHA512_C
1584 …loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&…
1585 …"$ASAN_CFLAGS -O -Werror -I../tests/include -I../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIB…
1592 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA"
1593 make test
1597 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated RSA signature"
1599 # Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
1600 # partial support for cipher operations in the driver test library.
1601 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
1602 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
1605 # in the library. Thus we have to remove all RSA support (signature and
1609 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_OAEP
1610 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
1612 # Make sure both the library and the test library support the SHA hash
1613 # algorithms and only those ones (SHA256 is included by default). That way:
1614 # - the test library can compute the RSA signatures even in the case of a
1617 # - the dependency of RSA signature tests on PSA_WANT_ALG_SHA_xyz is
1618 # fulfilled as the hash SHA algorithm is supported by the library, and
1620 # - when testing a signature key with an algorithm wildcard built from
1621 # PSA_ALG_ANY_HASH as algorithm to test with the key, the chosen hash
1623 # supported by the test library.
1624 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1625 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160_C
1627 scripts/config.py -f tests/include/test/drivers/config_test_driver.h set MBEDTLS_SHA1_C
1628 scripts/config.py -f tests/include/test/drivers/config_test_driver.h set MBEDTLS_SHA512_C
1629 # We need PEM parsing in the test library as well to support the import
1631 scripts/config.py -f tests/include/test/drivers/config_test_driver.h set MBEDTLS_PEM_PARSE_C
1632 scripts/config.py -f tests/include/test/drivers/config_test_driver.h set MBEDTLS_BASE64_C
1635 …loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g'…
1636 make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
1638 # Restore test driver base configuration
1639 scripts/config.py -f tests/include/test/drivers/config_test_driver.h unset MBEDTLS_SHA1_C
1640 scripts/config.py -f tests/include/test/drivers/config_test_driver.h unset MBEDTLS_SHA512_C
1641 scripts/config.py -f tests/include/test/drivers/config_test_driver.h unset MBEDTLS_PEM_PARSE_C
1642 scripts/config.py -f tests/include/test/drivers/config_test_driver.h unset MBEDTLS_BASE64_C
1645 # Mbed TLS library build
1649 # Remove RSA support and its dependencies
1666 …loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&…
1667 …S="$ASAN_CFLAGS -Werror -I../tests/include -I../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBT…
1675 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated RSA signature"
1676 make test
1680 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated hash"
1682 # Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having
1683 # partial support for cipher operations in the driver test library.
1684 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
1685 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
1688 …loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g'…
1689 make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
1699 …# Unset MBEDTLS_SSL_PROTO_SSL3, MBEDTLS_SSL_PROTO_TLS1 and MBEDTLS_SSL_PROTO_TLS1_1 as they depend…
1705 …loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&…
1706 …S="$ASAN_CFLAGS -Werror -I../tests/include -I../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBT…
1714 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated hash"
1715 make test
1719 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated cipher"
1722 …loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g'…
1723 make -C tests libtestdriver1.a CFLAGS="$ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS"
1728 # There is no intended accelerator support for ALG STREAM_CIPHER and
1729 # ALG_ECB_NO_PADDING. Therefore, asking for them in the build implies the
1730 # inclusion of the Mbed TLS cipher operations. As we want to test here with
1733 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_STREAM_CIPHER
1734 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_ECB_NO_PADDING
1735 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_CMAC
1745 …loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&…
1746 …S="$ASAN_CFLAGS -Werror -I../tests/include -I../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBT…
1753 msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated hash"
1754 make test
1759 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG minus MBEDTLS_PSA_CRYPTO_DRIVERS"
1764 make CC=gcc CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS"
1766 msg "test: full + MBEDTLS_PSA_CRYPTO_CONFIG minus MBEDTLS_PSA_CRYPTO_DRIVERS"
1767 make test
1771 # full minus MBEDTLS_CHACHAPOLY_C without PSA_WANT_ALG_GCM and PSA_WANT_ALG_CHACHA20_POLY1305
1772 …msg "build: full minus MBEDTLS_CHACHAPOLY_C without PSA_WANT_ALG_GCM and PSA_WANT_ALG_CHACHA20_POL…
1775 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_GCM
1776 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_CHACHA20_POLY1305
1777 make CC=gcc CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS"
1779 …msg "test: full minus MBEDTLS_CHACHAPOLY_C without PSA_WANT_ALG_GCM and PSA_WANT_ALG_CHACHA20_POLY…
1780 make test
1783 # This should be renamed to test and updated once the accelerator ECDSA code is in place and ready …
1787 # PSA_WANT_ALG_ECDSA and PSA_WANT_ALG_DETERMINISTIC_ECDSA are already
1789 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_ECDSA without MBEDTLS_ECDSA_C"
1797 …# Need to define the correct symbol and include the test driver header path in order to build with…
1798 …GS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_ECDSA -DMBEDTLS_PSA_ACCEL_ALG_DE…
1801 # This should be renamed to test and updated once the accelerator ECDH code is in place and ready t…
1805 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_ECDH without MBEDTLS_ECDH_C"
1816 …# Need to define the correct symbol and include the test driver header path in order to build with…
1817 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_ECDH -I../tests/…
1820 # This should be renamed to test and updated once the accelerator ECC key pair code is in place and
1823 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR"
1828 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1
1829 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
1830 …# Need to define the correct symbol and include the test driver header path in order to build with…
1831 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAI…
1834 # This should be renamed to test and updated once the accelerator ECC public key code is in place a…
1837 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY"
1842 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
1843 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR
1844 …# Need to define the correct symbol and include the test driver header path in order to build with…
1845 …ake CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_K…
1848 # This should be renamed to test and updated once the accelerator HMAC code is in place and ready t…
1851 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_HMAC"
1856 …# Need to define the correct symbol and include the test driver header path in order to build with…
1857 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HMAC -I../tests/…
1860 # This should be renamed to test and updated once the accelerator HKDF code is in place and ready t…
1864 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_HKDF without MBEDTLS_HKDF_C"
1870 # Make sure to unset TLS1_3 since it requires HKDF_C and will not build properly without it.
1872 …# Need to define the correct symbol and include the test driver header path in order to build with…
1873 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HKDF -I../tests/…
1876 # This should be renamed to test and updated once the accelerator MD5 code is in place and ready to…
1879 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_MD5 - other hashes"
1884 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
1885 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
1886 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
1887 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_256
1888 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_384
1889 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_512
1890 …# Need to define the correct symbol and include the test driver header path in order to build with…
1891 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_MD5 -I../tests/i…
1894 # This should be renamed to test and updated once the accelerator RIPEMD160 code is in place and re…
1897 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_RIPEMD160 - other hashes"
1902 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1903 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
1904 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
1905 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_256
1906 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_384
1907 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_512
1908 …# Need to define the correct symbol and include the test driver header path in order to build with…
1909 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RIPEMD160 -I../t…
1912 # This should be renamed to test and updated once the accelerator SHA1 code is in place and ready t…
1915 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_SHA_1 - other hashes"
1920 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1921 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
1922 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
1923 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_256
1924 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_384
1925 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_512
1926 …# Need to define the correct symbol and include the test driver header path in order to build with…
1927 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_1 -I../tests…
1930 # This should be renamed to test and updated once the accelerator SHA224 code is in place and ready…
1933 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_SHA_224 - other hashes"
1938 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1939 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
1940 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
1941 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_384
1942 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_512
1943 …# Need to define the correct symbol and include the test driver header path in order to build with…
1944 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_224 -I../tes…
1947 # This should be renamed to test and updated once the accelerator SHA256 code is in place and ready…
1950 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_SHA_256 - other hashes"
1955 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1956 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
1957 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
1958 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
1959 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_384
1960 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_512
1961 …# Need to define the correct symbol and include the test driver header path in order to build with…
1962 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_256 -I../tes…
1965 # This should be renamed to test and updated once the accelerator SHA384 code is in place and ready…
1968 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_SHA_384 - other hashes"
1973 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1974 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
1975 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
1976 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
1977 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_256
1978 …# Need to define the correct symbol and include the test driver header path in order to build with…
1979 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_384 -I../tes…
1982 # This should be renamed to test and updated once the accelerator SHA512 code is in place and ready…
1985 msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_SHA_512 - other hashes"
1990 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
1991 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
1992 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
1993 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
1994 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_256
1995 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_384
1996 …# Need to define the correct symbol and include the test driver header path in order to build with…
1997 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_512 -I../tes…
2000 # This should be renamed to test and updated once the accelerator RSA code is in place and ready to…
2003 …msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + PSA_WANT_KEY_TYPE…
2008 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1
2009 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN
2010 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_OAEP
2011 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PSS
2012 …# Need to define the correct symbol and include the test driver header path in order to build with…
2013 …ake CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYP…
2016 # This should be renamed to test and updated once the accelerator RSA code is in place and ready to…
2018 …# full plus MBEDTLS_PSA_CRYPTO_CONFIG with PSA_WANT_ALG_RSA_PKCS1V15_SIGN and PSA_WANT_KEY_TYPE_RS…
2019 …msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_RSA_PKCS1V15_SIGN + PSA_WANT_KEY_TYPE_…
2024 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1
2025 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
2026 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_OAEP
2027 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PSS
2028 …# Need to define the correct symbol and include the test driver header path in order to build with…
2029 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIG…
2032 # This should be renamed to test and updated once the accelerator RSA code is in place and ready to…
2034 …# full plus MBEDTLS_PSA_CRYPTO_CONFIG with PSA_WANT_ALG_RSA_OAEP and PSA_WANT_KEY_TYPE_RSA_PUBLIC_…
2035 …msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_RSA_OAEP + PSA_WANT_KEY_TYPE_RSA_PUBLI…
2040 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_OAEP 1
2041 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
2042 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN
2043 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PSS
2044 …# Need to define the correct symbol and include the test driver header path in order to build with…
2045 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_OAEP -I../te…
2048 # This should be renamed to test and updated once the accelerator RSA code is in place and ready to…
2050 …# full plus MBEDTLS_PSA_CRYPTO_CONFIG with PSA_WANT_ALG_RSA_PSS and PSA_WANT_KEY_TYPE_RSA_PUBLIC_K…
2051 …msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_ALG_RSA_PSS + PSA_WANT_KEY_TYPE_RSA_PUBLIC…
2056 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PSS 1
2057 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
2058 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN
2059 scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_OAEP
2060 …# Need to define the correct symbol and include the test driver header path in order to build with…
2061 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PSS -I../tes…
2064 # This should be renamed to test and updated once the accelerator RSA code is in place and ready to…
2066 … # full plus MBEDTLS_PSA_CRYPTO_CONFIG with PSA_WANT_KEY_TYPE_RSA_KEY_PAIR and PSA_WANT_ALG_RSA_PSS
2067 …msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR + PSA_WANT_ALG_RSA_P…
2072 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PSS 1
2073 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
2074 …# Need to define the correct symbol and include the test driver header path in order to build with…
2075 …make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAI…
2078 # This should be renamed to test and updated once the accelerator RSA code is in place and ready to…
2080 …# full plus MBEDTLS_PSA_CRYPTO_CONFIG with PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY and PSA_WANT_ALG_RSA_P…
2081 …msg "build: full + MBEDTLS_PSA_CRYPTO_CONFIG + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + PSA_WANT_ALG_RSA…
2086 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PSS 1
2087 scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
2088 …# Need to define the correct symbol and include the test driver header path in order to build with…
2089 …ake CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_K…
2093 # Full configuration build, without platform support, file IO and net sockets.
2094 # This should catch missing mbedtls_printf definitions, and by disabling file
2096 msg "build: full config except platform/fsio/net, make, gcc, C99" # ~ 30s
2113 # to re-enable platform integration features otherwise disabled in C99 builds
2114 make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -Os -D_DEFAULT_SOURCE' lib programs
2115 make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' test
2120 msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s
2125 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check .
2130 msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s
2133 make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1'
2137 msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s
2140 make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1'
2146 msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s
2150 make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib
2154 msg "build: default config with memory buffer allocator and backtrace enabled"
2159 CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release .
2162 msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C and MBEDTLS_MEMORY_BACKTRACE"
2163 make test
2167 msg "build: default config with memory buffer allocator"
2170 CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release .
2173 msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C"
2174 make test
2176 msg "test: ssl-opt.sh, MBEDTLS_MEMORY_BUFFER_ALLOC_C"
2178 tests/ssl-opt.sh -e '^DTLS proxy'
2183 msg "build: default config except MFL extension (ASan build)" # ~ 30s
2185 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2188 msg "test: ssl-opt.sh, MFL-related tests"
2189 tests/ssl-opt.sh -f "Max fragment length"
2193 msg "build: default config with MBEDTLS_SSL_KEEP_PEER_CERTIFICATE disabled (ASan build)"
2195 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2198 msg "test: !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
2199 make test
2201 msg "test: ssl-opt.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
2202 tests/ssl-opt.sh
2204 msg "test: compat.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
2207 msg "test: context-info.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
2208 tests/context-info.sh
2212 msg "build: no MFL extension, small SSL_OUT_CONTENT_LEN (ASan build)"
2216 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2219 msg "test: MFL tests (disabled MFL extension case) & large packet tests"
2220 tests/ssl-opt.sh -f "Max fragment length\|Large buffer"
2222 msg "test: context-info.sh (disabled MFL extension case)"
2223 tests/context-info.sh
2227 msg "build: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled (ASan build)"
2229 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2232 msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled"
2233 make test
2235 msg "test: ssl-opt.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled"
2236 tests/ssl-opt.sh
2238 msg "test: compat.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled"
2243 …msg "build: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH and MBEDTLS_SSL_DTLS_CONNECTION_ID enabled (ASan bu…
2247 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2250 msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH and MBEDTLS_SSL_DTLS_CONNECTION_ID"
2251 make test
2253 …msg "test: ssl-opt.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH and MBEDTLS_SSL_DTLS_CONNECTION_ID enabl…
2254 tests/ssl-opt.sh
2256 …msg "test: compat.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH and MBEDTLS_SSL_DTLS_CONNECTION_ID enable…
2261 msg "build: Connection ID enabled, debug disabled"
2268 msg "test: Connection ID enabled, debug disabled"
2269 make test
2273 msg "build: default config with memory buffer allocator and MFL extension"
2279 CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release .
2282 …msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG…
2283 make test
2285 …msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG…
2286 tests/ssl-opt.sh -f "Handshake memory usage"
2290 msg "build: when no ciphersuites have MAC"
2296 msg "test: !MBEDTLS_SSL_SOME_MODES_USE_MAC"
2297 make test
2299 msg "test ssl-opt.sh: !MBEDTLS_SSL_SOME_MODES_USE_MAC"
2300 tests/ssl-opt.sh -f 'Default\|EtM' -e 'without EtM'
2304 msg "build: default config without MBEDTLS_HAVE_TIME_DATE"
2306 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check .
2309 msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites"
2310 make test
2314 msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
2318 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2321 msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
2322 make test
2326 msg "build: malloc(0) returns NULL (ASan+UBSan build)"
2328 …make CC=gcc CFLAGS="'-DMBEDTLS_CONFIG_FILE=\"$PWD/tests/configs/config-wrapper-malloc-0-null.h\"' …
2330 msg "test: malloc(0) returns NULL (ASan+UBSan build)"
2331 make test
2333 msg "selftest: malloc(0) returns NULL (ASan+UBSan build)"
2334 # Just the calloc selftest. "make test" ran the others as part of the
2335 # test suites.
2336 programs/test/selftest calloc
2338 msg "test ssl-opt.sh: malloc(0) returns NULL (ASan+UBSan build)"
2340 # and time (including time indirectly wasted due to flaky tests).
2343 # UDP proxy, which tend to be slower and flakier.
2344 tests/ssl-opt.sh -e 'proxy'
2348 msg "build: default config with AES_FEWER_TABLES enabled"
2350 make CC=gcc CFLAGS='-Werror -Wall -Wextra'
2352 msg "test: AES_FEWER_TABLES"
2353 make test
2357 msg "build: default config with AES_ROM_TABLES enabled"
2359 make CC=gcc CFLAGS='-Werror -Wall -Wextra'
2361 msg "test: AES_ROM_TABLES"
2362 make test
2366 msg "build: default config with AES_ROM_TABLES and AES_FEWER_TABLES enabled"
2369 make CC=gcc CFLAGS='-Werror -Wall -Wextra'
2371 msg "test: AES_FEWER_TABLES + AES_ROM_TABLES"
2372 make test
2376 msg "build: full + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)"
2380 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2383 msg "test: full + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)"
2384 make test
2388 msg "build: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY (ASan build)"
2392 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2395 msg "test: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY (ASan build)"
2396 make test
2400 msg "build: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)"
2405 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2408 msg "test: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)"
2409 make test
2413 msg "build: default config + MBEDTLS_PSA_CRYPTO_SE_C"
2415 make CC=clang CFLAGS="$ASAN_CFLAGS -Os" LDFLAGS="$ASAN_CFLAGS"
2417 msg "test: default config + MBEDTLS_PSA_CRYPTO_SE_C"
2418 make test
2422 msg "build: MBEDTLS_PSA_CRYPTO_DRIVERS w/ driver hooks"
2426 loc_cflags="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST_ALL"
2427 …loc_cflags="${loc_cflags} '-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
2428 loc_cflags="${loc_cflags} -I../tests/include -O2"
2433 msg "test: full + MBEDTLS_PSA_CRYPTO_DRIVERS"
2434 make test
2438 msg "build/test: make shared" # ~ 40s
2441 programs/test/dlopen_demo.sh
2445 msg "build/test: cmake shared" # ~ 2min
2446 cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On .
2449 make test
2450 programs/test/dlopen_demo.sh
2456 msg "build/test: $cc $opt, $info" # ~ 30s
2457 make CC="$cc" CFLAGS="$opt -std=c99 -pedantic -Wall -Wextra -Werror"
2460 # optimizations use inline assembly whereas runs with -O0
2462 make test # ~30s
2469 test_build_opt 'full config' clang -O0 -Os -O2
2474 test_build_opt 'full config' gcc -O0 -Os -O2
2478 msg "build: make with MBEDTLS_CONFIG_FILE" # ~40s
2484 make CFLAGS="-I '$PWD' -DMBEDTLS_CONFIG_FILE='\"full_config.h\"'"
2485 rm -f full_config.h
2489 # Build without optimization, so as to use portable C code (in a 32-bit
2490 # build) and not the i386-specific inline assembly.
2491 msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s
2493 make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O0" LDFLAGS="-m32 $ASAN_CFLAGS"
2495 msg "test: i386, make, gcc -O0 (ASan build)"
2496 make test
2499 case $(uname -m) in
2506 # Build with optimization, to use the i386 specific inline assembly
2507 # and go faster for tests.
2508 msg "build: i386, make, gcc -O2 (ASan build)" # ~ 30s
2510 make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS"
2512 msg "test: i386, make, gcc -O2 (ASan build)"
2513 make test
2515 msg "test ssl-opt.sh, i386, make, gcc-O2"
2516 tests/ssl-opt.sh
2523 msg "build: i386, Everest ECDH context (ASan build)" # ~ 6 min
2525 make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS"
2527 msg "test: i386, Everest ECDH context - main suites (inc. selftests) (ASan build)" # ~ 50s
2528 make test
2530 msg "test: i386, Everest ECDH context - ECDH-related part of ssl-opt.sh (ASan build)" # ~ 5s
2531 tests/ssl-opt.sh -f ECDH
2533 …msg "test: i386, Everest ECDH context - compat.sh with some ECDH ciphersuites (ASan build)" # ~ 3 …
2535 tests/compat.sh -f ECDH -V NO -e 'ARIA\|CAMELLIA\|CHACHA\|DES'
2542 msg "build: 64-bit ILP32, make, gcc" # ~ 30s
2544 make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32' LDFLAGS='-mx32'
2546 msg "test: 64-bit ILP32, make, gcc"
2547 make test
2550 case $(uname -m) in
2557 msg "build: Default + MBEDTLS_MPI_WINDOW_SIZE=1 (ASan build)" # ~ 10s
2559 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2562 msg "test: MBEDTLS_MPI_WINDOW_SIZE=1 - main suites (inc. selftests) (ASan build)" # ~ 10s
2563 make test
2567 msg "build: gcc, force 32-bit bignum limbs"
2571 make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32'
2573 msg "test: gcc, force 32-bit bignum limbs"
2574 make test
2578 msg "build: gcc, force 64-bit bignum limbs"
2582 make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64'
2584 msg "test: gcc, force 64-bit bignum limbs"
2585 make test
2589 msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
2592 make CFLAGS='-Werror -O1'
2594 msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
2595 make test
2599 msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
2602 make CFLAGS='-Werror -O1'
2604 msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
2605 make test
2609 msg "build: no strings" # ~10s
2616 make CFLAGS='-Werror -Os'
2618 msg "test: no strings" # ~ 10s
2619 make test
2623 msg "build: full + MBEDTLS_X509_REMOVE_INFO" # ~ 10s
2627 make CFLAGS='-Werror -O2'
2629 msg "test: full + MBEDTLS_X509_REMOVE_INFO" # ~ 10s
2630 make test
2632 msg "test: ssl-opt.sh, full + MBEDTLS_X509_REMOVE_INFO" # ~ 1 min
2633 tests/ssl-opt.sh
2637 msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1" # ~ 10s
2639 …I_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra -O1' lib
2641 msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1"
2646 msg "build: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=arm5vte" # ~ 10s
2648 # Build for a target platform that's close to what Debian uses
2650 # See https://github.com/ARMmbed/mbedtls/pull/2169 and comments.
2651 # Build everything including programs, see for example
2652 # https://github.com/ARMmbed/mbedtls/pull/3449#issuecomment-675313720
2653 …c" AR="${ARM_LINUX_GNUEABI_GCC_PREFIX}ar" CFLAGS='-Werror -Wall -Wextra -march=armv5te -O1' LDFLAG…
2655 msg "size: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=armv5te -O1"
2663 msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -march=arm5vte" # ~ 10s
2667 # in case the gcc-arm-linux-gnueabi toolchain is not available
2668 …NONE_EABI_GCC_PREFIX}ar" CFLAGS='-std=c99 -Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-marc…
2670 msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -march=armv5te -O1"
2675 msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -mthumb -mcpu=cortex-m0plus" # ~ 10s
2677 …r" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra -mthumb -mcpu=cortex-
2679 msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -mthumb -mcpu=cortex-m0plus -Os"
2684 msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s
2687 …_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra' lib
2688 echo "Checking that software 64-bit division is not required"
2693 msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s
2696 …GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -O1 -march=armv6-m -mth…
2697 echo "Checking that software 64-bit multiplication is not required"
2702 msg "build: ARM Compiler 5"
2704 make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib
2707 "$ARMC5_FROMELF" -z library/*.o
2711 # ARM Compiler 6 - Target ARMv7-A
2712 armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a"
2714 # ARM Compiler 6 - Target ARMv7-M
2715 armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m"
2717 # ARM Compiler 6 - Target ARMv8-A - AArch32
2718 armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a"
2720 # ARM Compiler 6 - Target ARMv8-M
2721 armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main"
2723 # ARM Compiler 6 - Target ARMv8-A - AArch64
2724 armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a"
2728 msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding"
2732 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2734 msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding"
2735 make test
2736 msg "ssl-opt.sh (TLS 1.3)"
2737 if_build_succeeded tests/ssl-opt.sh
2741 msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding"
2745 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2747 msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding"
2748 make test
2749 msg "ssl-opt.sh (TLS 1.3 no compatibility mode)"
2750 if_build_succeeded tests/ssl-opt.sh
2754 msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, with padding"
2758 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2760 msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, with padding"
2761 make test
2762 msg "ssl-opt.sh (TLS 1.3 with padding)"
2763 if_build_succeeded tests/ssl-opt.sh
2767 msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, with ecp_restartable"
2771 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2773 msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, with ecp_restartable"
2774 make test
2775 msg "ssl-opt.sh (TLS 1.3 with ecp_restartable)"
2776 if_build_succeeded tests/ssl-opt.sh
2780 msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, with Everest"
2785 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
2787 msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, with Everest"
2788 make test
2789 msg "ssl-opt.sh (TLS 1.3 with everest)"
2790 if_build_succeeded tests/ssl-opt.sh
2794 msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s
2795 …make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall
2798 …make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDO…
2801 msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s
2802 …make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall
2803 …make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall
2807 case $(i686-w64-mingw32-gcc -dumpversion) in
2808 [0-5]*) false;;
2814 msg "build: MSan (clang)" # ~ 1 min 20s
2816 CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
2819 msg "test: main suites (MSan)" # ~ 10s
2820 make test
2822 msg "test: ssl-opt.sh (MSan)" # ~ 1 min
2823 tests/ssl-opt.sh
2827 if [ "$MEMORY" -gt 0 ]; then
2828 msg "test: compat.sh (MSan)" # ~ 6 min 20s
2834 msg "build: Release (clang)"
2835 CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release .
2838 msg "test: main suites valgrind (Release)"
2843 if [ "$MEMORY" -gt 0 ]; then
2844 msg "test: ssl-opt.sh --memcheck (Release)"
2845 tests/ssl-opt.sh --memcheck
2848 if [ "$MEMORY" -gt 1 ]; then
2849 msg "test: compat.sh --memcheck (Release)"
2850 tests/compat.sh --memcheck
2853 if [ "$MEMORY" -gt 0 ]; then
2854 msg "test: context-info.sh --memcheck (Release)"
2855 tests/context-info.sh --memcheck
2865 # Attempt to parse lsb-release to find out distribution and version. If not
2866 # found this should fail safe (test is supported).
2867 if [[ -f /etc/lsb-release ]]; then
2869 while read -r lsb_line; do
2874 done < /etc/lsb-release
2881 # Running the out of source CMake test on Ubuntu 16.04 using more than one
2882 # processor (as the CI does) can create a race condition whereby the build
2886 [ "$distrib_id" != "Ubuntu" ] || [ "$distrib_ver_major" -gt 16 ]
2890 msg "build: cmake 'out-of-source' build"
2894 cmake -D CMAKE_BUILD_TYPE:String=Check "$MBEDTLS_ROOT_DIR"
2897 msg "test: cmake 'out-of-source' build"
2898 make test
2899 # Test an SSL option that requires an auxiliary script in test/scripts/.
2902 # file is missing (ssl-opt.sh tolerates the absence of some files so
2904 ./tests/ssl-opt.sh -f 'Fallback SCSV: beginning of list' 2>ssl-opt.err
2905 cat ssl-opt.err >&2
2906 # If ssl-opt.err is non-empty, record an error and keep going.
2907 [ ! -s ssl-opt.err ]
2908 rm ssl-opt.err
2910 rm -rf "$OUT_OF_SOURCE_DIR"
2914 msg "build: cmake 'as-subdirectory' build"
2917 cd programs/test/cmake_subproject
2927 msg "build: cmake 'as-package' build"
2930 cd programs/test/cmake_package
2940 msg "build: cmake 'as-installed-package' build"
2943 cd programs/test/cmake_package_install
2953 # Test that the function mbedtls_platform_zeroize() is not optimized away by
2954 # different combinations of compilers and optimization flags by using an
2957 # output to check whether the pass string is present and no failure strings
2961 # about a spurious message if Gdb tries and fails, so suppress that.
2963 if [ -z "$(gdb -batch -nw -ex 'set disable-randomization off' 2>&1)" ]; then
2964 gdb_disable_aslr='set disable-randomization off'
2967 for optimization_flag in -O2 -O3 -Ofast -Os; do
2969 msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()"
2971 …gdb -ex "$gdb_disable_aslr" -x tests/scripts/test_zeroize.gdb -nw -batch -nx 2>&1 | tee test_zeroi…
2973 not grep -i "error" test_zeroize.log
2974 rm -f test_zeroize.log
2983 msg "build: make, default config (out-of-box), libmbedcrypto.a only"
2984 make -C library libmbedcrypto.a
2986 msg "unit test: test_psa_compliance.py"
2991 # psa-compliance-tests only supports CMake >= 3.10.0
2992 ver="$(cmake --version)"
2999 [ "$ver_major" -eq 3 ] && [ "$ver_minor" -ge 10 ]
3004 tests/scripts/check-python-files.sh
3008 msg "unit test: generate_test_code.py"
3010 # Our convention is to reserve stderr for actual errors, and write
3011 # harmless info on stdout so it can be suppress with --quiet.
3014 msg "unit test: translate_ciphers.py"
3015 python3 -m unittest tests/scripts/translate_ciphers.py 2>&1
3035 # Function invoked by --error-test to test error reporting.
3038 if [ $KEEP_GOING -ne 0 ]; then
3044 # Expected error: 'grep non_existent /dev/null -> 1'
3046 # Expected error: '! grep -q . tests/scripts/all.sh -> 1'
3047 not grep -q . "$0"
3048 # Expected error: 'make unknown_target -> 2'
3053 # Run one component and clean up afterwards.
3068 # Run the component in a subshell, with error trapping and output
3070 if [ $KEEP_GOING -eq 1 ]; then
3071 # We want to keep running if the subshell fails, so 'set -e' must
3076 if [ $QUIET -eq 1 ]; then
3081 if [ $KEEP_GOING -eq 1 ]; then
3082 # Keep "set -e" off, and run an ERR trap instead to record failures.
3083 set -E
3088 if [ $KEEP_GOING -eq 1 ]; then
3089 trap - ERR
3094 if [ $KEEP_GOING -eq 1 ]; then
3095 set -e
3096 if [ $component_status -ne 0 ]; then
3101 # Restore the build tree to a clean state.
3116 if [ $KEEP_GOING -eq 1 ]; then