Gilles Peskine | 62cf2e8 | 2020-03-27 16:35:23 +0100 | [diff] [blame] | 1 | #! /usr/bin/env bash |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 2 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 3 | # all.sh |
| 4 | # |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 5 | # Copyright The Mbed TLS Contributors |
Bence Szépkúti | c7da1fe | 2020-05-26 01:54:15 +0200 | [diff] [blame] | 6 | # SPDX-License-Identifier: Apache-2.0 |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. |
| 10 | # You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | # See the License for the specific language governing permissions and |
| 18 | # limitations under the License. |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 19 | |
| 20 | |
| 21 | |
| 22 | ################################################################ |
| 23 | #### Documentation |
| 24 | ################################################################ |
| 25 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 26 | # Purpose |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 27 | # ------- |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 28 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 29 | # To run all tests possible or available on the platform. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 30 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 31 | # Notes for users |
| 32 | # --------------- |
| 33 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 34 | # Warning: the test is destructive. It includes various build modes and |
| 35 | # configurations, and can and will arbitrarily change the current CMake |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 36 | # configuration. The following files must be committed into git: |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 37 | # * include/mbedtls/mbedtls_config.h |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 38 | # * Makefile, library/Makefile, programs/Makefile, tests/Makefile, |
| 39 | # programs/fuzz/Makefile |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 40 | # After running this script, the CMake cache will be lost and CMake |
| 41 | # will no longer be initialised. |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 42 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 43 | # The script assumes the presence of a number of tools: |
| 44 | # * Basic Unix tools (Windows users note: a Unix-style find must be before |
| 45 | # the Windows find in the PATH) |
| 46 | # * Perl |
| 47 | # * GNU Make |
| 48 | # * CMake |
| 49 | # * GCC and Clang (recent enough for using ASan with gcc and MemSan with clang, or valgrind) |
Andrzej Kurek | 05be06c | 2018-06-28 04:41:50 -0400 | [diff] [blame] | 50 | # * G++ |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 51 | # * arm-gcc and mingw-gcc |
| 52 | # * ArmCC 5 and ArmCC 6, unless invoked with --no-armcc |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 53 | # * OpenSSL and GnuTLS command line tools, recent enough for the |
Mateusz Starzyk | f5c5351 | 2021-04-15 13:28:52 +0200 | [diff] [blame] | 54 | # interoperability tests. If they don't support old features which we want |
| 55 | # to test, then a legacy version of these tools must be present as well |
| 56 | # (search for LEGACY below). |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 57 | # See the invocation of check_tools below for details. |
| 58 | # |
| 59 | # This script must be invoked from the toplevel directory of a git |
| 60 | # working copy of Mbed TLS. |
| 61 | # |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 62 | # The behavior on an error depends on whether --keep-going (alias -k) |
| 63 | # is in effect. |
| 64 | # * Without --keep-going: the script stops on the first error without |
| 65 | # cleaning up. This lets you work in the configuration of the failing |
| 66 | # component. |
| 67 | # * With --keep-going: the script runs all requested components and |
| 68 | # reports failures at the end. In particular the script always cleans |
| 69 | # up on exit. |
| 70 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 71 | # Note that the output is not saved. You may want to run |
| 72 | # script -c tests/scripts/all.sh |
| 73 | # or |
| 74 | # tests/scripts/all.sh >all.log 2>&1 |
| 75 | # |
| 76 | # Notes for maintainers |
| 77 | # --------------------- |
| 78 | # |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 79 | # The bulk of the code is organized into functions that follow one of the |
| 80 | # following naming conventions: |
| 81 | # * pre_XXX: things to do before running the tests, in order. |
| 82 | # * component_XXX: independent components. They can be run in any order. |
Gilles Peskine | c70637a | 2019-01-09 22:29:17 +0100 | [diff] [blame] | 83 | # * component_check_XXX: quick tests that aren't worth parallelizing. |
| 84 | # * component_build_XXX: build things but don't run them. |
| 85 | # * component_test_XXX: build and test. |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 86 | # * support_XXX: if support_XXX exists and returns false then |
| 87 | # component_XXX is not run by default. |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 88 | # * post_XXX: things to do after running the tests. |
| 89 | # * other: miscellaneous support functions. |
| 90 | # |
Gilles Peskine | c70637a | 2019-01-09 22:29:17 +0100 | [diff] [blame] | 91 | # Each component must start by invoking `msg` with a short informative message. |
| 92 | # |
Gilles Peskine | a681c59 | 2020-03-28 21:27:40 +0100 | [diff] [blame] | 93 | # Warning: due to the way bash detects errors, the failure of a command |
| 94 | # inside 'if' or '!' is not detected. Use the 'not' function instead of '!'. |
| 95 | # |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 96 | # Each component is executed in a separate shell process. The component |
| 97 | # fails if any command in it returns a non-zero status. |
| 98 | # |
Gilles Peskine | c70637a | 2019-01-09 22:29:17 +0100 | [diff] [blame] | 99 | # The framework performs some cleanup tasks after each component. This |
| 100 | # means that components can assume that the working directory is in a |
| 101 | # cleaned-up state, and don't need to perform the cleanup themselves. |
| 102 | # * Run `make clean`. |
Bence Szépkúti | 414d6bd | 2021-06-28 14:11:11 +0100 | [diff] [blame] | 103 | # * Restore `include/mbedtls/mbedtls_config.h` from a backup made before running |
Gilles Peskine | c70637a | 2019-01-09 22:29:17 +0100 | [diff] [blame] | 104 | # the component. |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 105 | # * Check out `Makefile`, `library/Makefile`, `programs/Makefile`, |
| 106 | # `tests/Makefile` and `programs/fuzz/Makefile` from git. |
| 107 | # This cleans up after an in-tree use of CMake. |
Gilles Peskine | c70637a | 2019-01-09 22:29:17 +0100 | [diff] [blame] | 108 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 109 | # The tests are roughly in order from fastest to slowest. This doesn't |
| 110 | # have to be exact, but in general you should add slower tests towards |
| 111 | # the end and fast checks near the beginning. |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 112 | |
| 113 | |
| 114 | |
| 115 | ################################################################ |
| 116 | #### Initialization and command line parsing |
| 117 | ################################################################ |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 118 | |
Gilles Peskine | 3664780 | 2020-03-28 18:50:49 +0100 | [diff] [blame] | 119 | # Abort on errors (even on the left-hand side of a pipe). |
| 120 | # Treat uninitialised variables as errors. |
| 121 | set -e -o pipefail -u |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 122 | |
Gilles Peskine | 076f725 | 2022-08-30 21:02:44 +0200 | [diff] [blame] | 123 | # Enable ksh/bash extended file matching patterns |
| 124 | shopt -s extglob |
| 125 | |
David Horstmann | 76a7738 | 2023-08-17 17:32:26 +0100 | [diff] [blame] | 126 | in_mbedtls_repo () { |
David Horstmann | d02b5f8 | 2023-08-29 09:53:52 +0100 | [diff] [blame] | 127 | test -d include -a -d library -a -d programs -a -d tests |
| 128 | } |
| 129 | |
| 130 | in_psa_crypto_repo () { |
| 131 | test -d include -a -d core -a -d drivers -a -d programs -a -d tests |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 132 | } |
| 133 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 134 | pre_check_environment () { |
David Horstmann | 58cf7c6 | 2023-08-29 10:15:05 +0100 | [diff] [blame] | 135 | if in_mbedtls_repo || in_psa_crypto_repo; then :; else |
David Horstmann | c69074d | 2023-08-29 13:46:11 +0100 | [diff] [blame] | 136 | echo "Must be run from Mbed TLS / psa-crypto root" >&2 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 137 | exit 1 |
| 138 | fi |
| 139 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 140 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 141 | pre_initialize_variables () { |
David Horstmann | 76a7738 | 2023-08-17 17:32:26 +0100 | [diff] [blame] | 142 | if in_mbedtls_repo; then |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 143 | CONFIG_H='include/mbedtls/mbedtls_config.h' |
David Horstmann | 76a7738 | 2023-08-17 17:32:26 +0100 | [diff] [blame] | 144 | else |
| 145 | CONFIG_H='drivers/builtin/include/mbedtls/mbedtls_config.h' |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 146 | fi |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 147 | CRYPTO_CONFIG_H='include/psa/crypto_config.h' |
Manuel Pégourié-Gonnard | 462e3a9 | 2022-12-27 12:35:11 +0100 | [diff] [blame] | 148 | CONFIG_TEST_DRIVER_H='tests/include/test/drivers/config_test_driver.h' |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 149 | |
| 150 | # Files that are clobbered by some jobs will be backed up. Use a different |
| 151 | # suffix from auxiliary scripts so that all.sh and auxiliary scripts can |
| 152 | # independently decide when to remove the backup file. |
| 153 | backup_suffix='.all.bak' |
| 154 | # Files clobbered by config.py |
Janos Follath | 2f04582 | 2023-07-31 10:57:16 +0100 | [diff] [blame] | 155 | files_to_back_up="$CONFIG_H $CRYPTO_CONFIG_H $CONFIG_TEST_DRIVER_H" |
David Horstmann | 76a7738 | 2023-08-17 17:32:26 +0100 | [diff] [blame] | 156 | if in_mbedtls_repo; then |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 157 | # Files clobbered by in-tree cmake |
| 158 | files_to_back_up="$files_to_back_up Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile" |
| 159 | fi |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 160 | |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 161 | append_outcome=0 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 162 | MEMORY=0 |
| 163 | FORCE=0 |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 164 | QUIET=0 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 165 | KEEP_GOING=0 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 166 | |
Manuel Pégourié-Gonnard | e050191 | 2020-06-08 12:59:27 +0200 | [diff] [blame] | 167 | # Seed value used with the --release-test option. |
Manuel Pégourié-Gonnard | 5430447 | 2020-06-22 10:11:47 +0200 | [diff] [blame] | 168 | # |
| 169 | # See also RELEASE_SEED in basic-build-test.sh. Debugging is easier if |
| 170 | # both values are kept in sync. If you change the value here because it |
| 171 | # breaks some tests, you'll definitely want to change it in |
| 172 | # basic-build-test.sh as well. |
Manuel Pégourié-Gonnard | e050191 | 2020-06-08 12:59:27 +0200 | [diff] [blame] | 173 | RELEASE_SEED=1 |
| 174 | |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 175 | : ${MBEDTLS_TEST_OUTCOME_FILE=} |
Gilles Peskine | 9004a17 | 2019-09-16 15:20:36 +0200 | [diff] [blame] | 176 | : ${MBEDTLS_TEST_PLATFORM="$(uname -s | tr -c \\n0-9A-Za-z _)-$(uname -m | tr -c \\n0-9A-Za-z _)"} |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 177 | export MBEDTLS_TEST_OUTCOME_FILE |
Gilles Peskine | 9004a17 | 2019-09-16 15:20:36 +0200 | [diff] [blame] | 178 | export MBEDTLS_TEST_PLATFORM |
| 179 | |
Jaeden Amero | c4cc251 | 2019-01-30 15:35:44 +0000 | [diff] [blame] | 180 | # Default commands, can be overridden by the environment |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 181 | : ${OPENSSL:="openssl"} |
| 182 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 183 | : ${OPENSSL_NEXT:="$OPENSSL"} |
| 184 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 185 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 186 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 187 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
| 188 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
| 189 | : ${ARMC5_BIN_DIR:=/usr/bin} |
| 190 | : ${ARMC6_BIN_DIR:=/usr/bin} |
Gilles Peskine | 6d06134 | 2020-04-30 18:19:32 +0200 | [diff] [blame] | 191 | : ${ARM_NONE_EABI_GCC_PREFIX:=arm-none-eabi-} |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 192 | : ${ARM_LINUX_GNUEABI_GCC_PREFIX:=arm-linux-gnueabi-} |
Gowtham Suresh Kumar | 9da40b8 | 2023-07-31 16:38:10 +0100 | [diff] [blame] | 193 | : ${CLANG_LATEST:="clang-latest"} |
| 194 | : ${CLANG_EARLIEST:="clang-earliest"} |
| 195 | : ${GCC_LATEST:="gcc-latest"} |
| 196 | : ${GCC_EARLIEST:="gcc-earliest"} |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 197 | # if MAKEFLAGS is not set add the -j option to speed up invocations of make |
Gilles Peskine | a1fc4b5 | 2019-01-06 20:15:26 +0000 | [diff] [blame] | 198 | if [ -z "${MAKEFLAGS+set}" ]; then |
Gilles Peskine | 050d2fc | 2021-09-30 18:24:21 +0200 | [diff] [blame] | 199 | export MAKEFLAGS="-j$(all_sh_nproc)" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 200 | fi |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 201 | |
Gilles Peskine | 396853a | 2021-09-20 18:57:55 +0200 | [diff] [blame] | 202 | # Include more verbose output for failing tests run by CMake or make |
Jaeden Amero | d48e9c7 | 2019-02-07 17:43:39 +0000 | [diff] [blame] | 203 | export CTEST_OUTPUT_ON_FAILURE=1 |
| 204 | |
Gilles Peskine | 8fd5942 | 2019-10-21 17:11:33 +0200 | [diff] [blame] | 205 | # CFLAGS and LDFLAGS for Asan builds that don't use CMake |
Manuel Pégourié-Gonnard | fe549a7 | 2022-11-30 10:42:03 +0100 | [diff] [blame] | 206 | # default to -O2, use -Ox _after_ this if you want another level |
Przemek Stekiel | 6efa608 | 2023-05-31 09:38:21 +0200 | [diff] [blame] | 207 | ASAN_CFLAGS='-O2 -Werror -fsanitize=address,undefined -fno-sanitize-recover=all' |
Gilles Peskine | 8fd5942 | 2019-10-21 17:11:33 +0200 | [diff] [blame] | 208 | |
Andrzej Kurek | 04bfe57 | 2023-06-27 10:02:09 -0400 | [diff] [blame] | 209 | # Platform tests have an allocation that returns null |
| 210 | export ASAN_OPTIONS="allocator_may_return_null=1" |
Andrzej Kurek | 026235c | 2023-07-05 08:32:43 -0400 | [diff] [blame] | 211 | export MSAN_OPTIONS="allocator_may_return_null=1" |
Andrzej Kurek | 04bfe57 | 2023-06-27 10:02:09 -0400 | [diff] [blame] | 212 | |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 213 | # Gather the list of available components. These are the functions |
| 214 | # defined in this script whose name starts with "component_". |
Gowtham Suresh Kumar | 1e829a4 | 2023-07-28 16:41:21 +0100 | [diff] [blame] | 215 | ALL_COMPONENTS=$(compgen -A function component_ | sed 's/component_//') |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 216 | |
| 217 | # Exclude components that are not supported on this platform. |
| 218 | SUPPORTED_COMPONENTS= |
| 219 | for component in $ALL_COMPONENTS; do |
| 220 | case $(type "support_$component" 2>&1) in |
| 221 | *' function'*) |
| 222 | if ! support_$component; then continue; fi;; |
| 223 | esac |
| 224 | SUPPORTED_COMPONENTS="$SUPPORTED_COMPONENTS $component" |
| 225 | done |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 226 | } |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 227 | |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 228 | # Test whether the component $1 is included in the command line patterns. |
| 229 | is_component_included() |
Gilles Peskine | 81b96ed | 2018-11-27 21:37:53 +0100 | [diff] [blame] | 230 | { |
Gilles Peskine | 03af678 | 2021-08-06 11:35:17 +0200 | [diff] [blame] | 231 | # Temporarily disable wildcard expansion so that $COMMAND_LINE_COMPONENTS |
| 232 | # only does word splitting. |
Gilles Peskine | 81b96ed | 2018-11-27 21:37:53 +0100 | [diff] [blame] | 233 | set -f |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 234 | for pattern in $COMMAND_LINE_COMPONENTS; do |
Gilles Peskine | 81b96ed | 2018-11-27 21:37:53 +0100 | [diff] [blame] | 235 | set +f |
| 236 | case ${1#component_} in $pattern) return 0;; esac |
| 237 | done |
| 238 | set +f |
| 239 | return 1 |
| 240 | } |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 241 | |
Simon Butcher | 41eeccf | 2016-09-07 00:07:09 +0100 | [diff] [blame] | 242 | usage() |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 243 | { |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 244 | cat <<EOF |
Gilles Peskine | 9252511 | 2018-11-27 18:15:35 +0100 | [diff] [blame] | 245 | Usage: $0 [OPTION]... [COMPONENT]... |
Gilles Peskine | 348fb9a | 2018-11-27 17:04:29 +0100 | [diff] [blame] | 246 | Run mbedtls release validation tests. |
Gilles Peskine | 9252511 | 2018-11-27 18:15:35 +0100 | [diff] [blame] | 247 | By default, run all tests. With one or more COMPONENT, run only those. |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 248 | COMPONENT can be the name of a component or a shell wildcard pattern. |
| 249 | |
| 250 | Examples: |
| 251 | $0 "check_*" |
| 252 | Run all sanity checks. |
| 253 | $0 --no-armcc --except test_memsan |
| 254 | Run everything except builds that require armcc and MemSan. |
Gilles Peskine | 348fb9a | 2018-11-27 17:04:29 +0100 | [diff] [blame] | 255 | |
| 256 | Special options: |
| 257 | -h|--help Print this help and exit. |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 258 | --list-all-components List all available test components and exit. |
| 259 | --list-components List components supported on this platform and exit. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 260 | |
| 261 | General options: |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 262 | -q|--quiet Only output component names, and errors if any. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 263 | -f|--force Force the tests to overwrite any modified files. |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 264 | -k|--keep-going Run all tests and report errors at the end. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 265 | -m|--memory Additional optional memory tests. |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 266 | --append-outcome Append to the outcome file (if used). |
Gilles Peskine | 6d06134 | 2020-04-30 18:19:32 +0200 | [diff] [blame] | 267 | --arm-none-eabi-gcc-prefix=<string> |
| 268 | Prefix for a cross-compiler for arm-none-eabi |
| 269 | (default: "${ARM_NONE_EABI_GCC_PREFIX}") |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 270 | --arm-linux-gnueabi-gcc-prefix=<string> |
| 271 | Prefix for a cross-compiler for arm-linux-gnueabi |
| 272 | (default: "${ARM_LINUX_GNUEABI_GCC_PREFIX}") |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 273 | --armcc Run ARM Compiler builds (on by default). |
Gilles Peskine | 80ddb99 | 2021-08-06 11:51:59 +0200 | [diff] [blame] | 274 | --restore First clean up the build tree, restoring backed up |
| 275 | files. Do not run any components unless they are |
| 276 | explicitly specified. |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 277 | --error-test Error test mode: run a failing function in addition |
Gilles Peskine | 86f6129 | 2021-08-05 15:11:33 +0200 | [diff] [blame] | 278 | to any specified component. May be repeated. |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 279 | --except Exclude the COMPONENTs listed on the command line, |
| 280 | instead of running only those. |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 281 | --no-append-outcome Write a new outcome file and analyze it (default). |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 282 | --no-armcc Skip ARM Compiler builds. |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 283 | --no-force Refuse to overwrite modified files (default). |
| 284 | --no-keep-going Stop at the first error (default). |
| 285 | --no-memory No additional memory tests (default). |
Shaun Case | 8b0ecbc | 2021-12-20 21:14:10 -0800 | [diff] [blame] | 286 | --no-quiet Print full output from components. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 287 | --out-of-source-dir=<path> Directory used for CMake out-of-source build tests. |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 288 | --outcome-file=<path> File where test outcomes are written (not done if |
| 289 | empty; default: \$MBEDTLS_TEST_OUTCOME_FILE). |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 290 | --random-seed Use a random seed value for randomized tests (default). |
Manuel Pégourié-Gonnard | e050191 | 2020-06-08 12:59:27 +0200 | [diff] [blame] | 291 | -r|--release-test Run this script in release mode. This fixes the seed value to ${RELEASE_SEED}. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 292 | -s|--seed Integer seed value to use for this test run. |
| 293 | |
| 294 | Tool path options: |
| 295 | --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory. |
| 296 | --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory. |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 297 | --clang-earliest=<Clang_earliest_path> Earliest version of clang available |
| 298 | --clang-latest=<Clang_latest_path> Latest version of clang available |
| 299 | --gcc-earliest=<GCC_earliest_path> Earliest version of GCC available |
| 300 | --gcc-latest=<GCC_latest_path> Latest version of GCC available |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 301 | --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests. |
| 302 | --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests. |
| 303 | --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests. |
| 304 | --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests. |
| 305 | --openssl=<OpenSSL_path> OpenSSL executable to use for most tests. |
Mateusz Starzyk | 06b07fb | 2021-02-18 13:55:21 +0100 | [diff] [blame] | 306 | --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests.. |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 307 | --openssl-next=<OpenSSL_path> OpenSSL executable to use for recent things like ARIA |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 308 | EOF |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 309 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 310 | |
Gilles Peskine | bf66e2c | 2021-08-03 13:44:28 +0200 | [diff] [blame] | 311 | # Cleanup before/after running a component. |
| 312 | # Remove built files as well as the cmake cache/config. |
| 313 | # Does not remove generated source files. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 314 | cleanup() |
| 315 | { |
David Horstmann | 76a7738 | 2023-08-17 17:32:26 +0100 | [diff] [blame] | 316 | if in_mbedtls_repo; then |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 317 | command make clean |
| 318 | fi |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 319 | |
Gilles Peskine | 31b07e2 | 2018-03-21 12:15:06 +0100 | [diff] [blame] | 320 | # Remove CMake artefacts |
Jaeden Amero | 2d0e00f | 2018-11-07 18:46:41 +0000 | [diff] [blame] | 321 | find . -name .git -prune -o \ |
Gilles Peskine | 31b07e2 | 2018-03-21 12:15:06 +0100 | [diff] [blame] | 322 | -iname CMakeFiles -exec rm -rf {} \+ -o \ |
| 323 | \( -iname cmake_install.cmake -o \ |
| 324 | -iname CTestTestfile.cmake -o \ |
Manuel Pégourié-Gonnard | bfe54d7 | 2021-09-09 11:11:44 +0200 | [diff] [blame] | 325 | -iname CMakeCache.txt -o \ |
| 326 | -path './cmake/*.cmake' \) -exec rm -f {} \+ |
Gilles Peskine | 31b07e2 | 2018-03-21 12:15:06 +0100 | [diff] [blame] | 327 | # Recover files overwritten by in-tree CMake builds |
Gilles Peskine | 076f725 | 2022-08-30 21:02:44 +0200 | [diff] [blame] | 328 | rm -f include/Makefile include/mbedtls/Makefile programs/!(fuzz)/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 329 | |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 330 | # Remove any artifacts from the component_test_cmake_as_subdirectory test. |
| 331 | rm -rf programs/test/cmake_subproject/build |
| 332 | rm -f programs/test/cmake_subproject/Makefile |
| 333 | rm -f programs/test/cmake_subproject/cmake_subproject |
| 334 | |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 335 | # Remove any artifacts from the component_test_cmake_as_package test. |
| 336 | rm -rf programs/test/cmake_package/build |
| 337 | rm -f programs/test/cmake_package/Makefile |
| 338 | rm -f programs/test/cmake_package/cmake_package |
| 339 | |
| 340 | # Remove any artifacts from the component_test_cmake_as_installed_package test. |
| 341 | rm -rf programs/test/cmake_package_install/build |
| 342 | rm -f programs/test/cmake_package_install/Makefile |
| 343 | rm -f programs/test/cmake_package_install/cmake_package_install |
| 344 | |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 345 | # Restore files that may have been clobbered by the job |
| 346 | for x in $files_to_back_up; do |
Gilles Peskine | dd06efb | 2022-08-30 21:02:00 +0200 | [diff] [blame] | 347 | if [[ -e "$x$backup_suffix" ]]; then |
| 348 | cp -p "$x$backup_suffix" "$x" |
| 349 | fi |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 350 | done |
| 351 | } |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 352 | |
Gilles Peskine | bf66e2c | 2021-08-03 13:44:28 +0200 | [diff] [blame] | 353 | # Final cleanup when this script exits (except when exiting on a failure |
| 354 | # in non-keep-going mode). |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 355 | final_cleanup () { |
| 356 | cleanup |
| 357 | |
| 358 | for x in $files_to_back_up; do |
| 359 | rm -f "$x$backup_suffix" |
| 360 | done |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 361 | } |
| 362 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 363 | # Executed on exit. May be redefined depending on command line options. |
| 364 | final_report () { |
| 365 | : |
| 366 | } |
| 367 | |
| 368 | fatal_signal () { |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 369 | final_cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 370 | final_report $1 |
| 371 | trap - $1 |
| 372 | kill -$1 $$ |
| 373 | } |
| 374 | |
| 375 | trap 'fatal_signal HUP' HUP |
| 376 | trap 'fatal_signal INT' INT |
| 377 | trap 'fatal_signal TERM' TERM |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 378 | |
Gilles Peskine | 050d2fc | 2021-09-30 18:24:21 +0200 | [diff] [blame] | 379 | # Number of processors on this machine. Used as the default setting |
| 380 | # for parallel make. |
| 381 | all_sh_nproc () |
| 382 | { |
| 383 | { |
| 384 | nproc || # Linux |
| 385 | sysctl -n hw.ncpuonline || # NetBSD, OpenBSD |
| 386 | sysctl -n hw.ncpu || # FreeBSD |
| 387 | echo 1 |
| 388 | } 2>/dev/null |
| 389 | } |
| 390 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 391 | msg() |
| 392 | { |
Gilles Peskine | ffcdeff | 2018-12-04 12:49:28 +0100 | [diff] [blame] | 393 | if [ -n "${current_component:-}" ]; then |
| 394 | current_section="${current_component#component_}: $1" |
| 395 | else |
| 396 | current_section="$1" |
| 397 | fi |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 398 | |
| 399 | if [ $QUIET -eq 1 ]; then |
| 400 | return |
| 401 | fi |
| 402 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 403 | echo "" |
| 404 | echo "******************************************************************" |
Gilles Peskine | ffcdeff | 2018-12-04 12:49:28 +0100 | [diff] [blame] | 405 | echo "* $current_section " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 406 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 407 | echo "******************************************************************" |
| 408 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 409 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 410 | armc6_build_test() |
| 411 | { |
| 412 | FLAGS="$1" |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 413 | |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 414 | msg "build: ARM Compiler 6 ($FLAGS)" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 415 | ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \ |
Dave Rodgman | 1c232a8 | 2023-03-02 13:39:04 +0000 | [diff] [blame] | 416 | WARNING_CFLAGS='-Werror -xc -std=c99' make lib |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 417 | |
| 418 | msg "size: ARM Compiler 6 ($FLAGS)" |
| 419 | "$ARMC6_FROMELF" -z library/*.o |
| 420 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 421 | make clean |
| 422 | } |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 423 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 424 | err_msg() |
| 425 | { |
| 426 | echo "$1" >&2 |
| 427 | } |
| 428 | |
| 429 | check_tools() |
| 430 | { |
| 431 | for TOOL in "$@"; do |
Andres AG | 9839360 | 2017-01-31 17:04:45 +0000 | [diff] [blame] | 432 | if ! `type "$TOOL" >/dev/null 2>&1`; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 433 | err_msg "$TOOL not found!" |
| 434 | exit 1 |
| 435 | fi |
| 436 | done |
| 437 | } |
| 438 | |
Tom Cosgrove | 730addc | 2023-06-09 14:20:18 +0100 | [diff] [blame] | 439 | pre_parse_command_line_for_dirs () { |
| 440 | # Make an early pass through the options given, so we can set directories |
| 441 | # for Arm compilers, before SUPPORTED_COMPONENTS is determined. |
| 442 | while [ $# -gt 0 ]; do |
| 443 | case "$1" in |
| 444 | --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";; |
| 445 | --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";; |
| 446 | esac |
| 447 | shift |
| 448 | done |
| 449 | } |
| 450 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 451 | pre_parse_command_line () { |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 452 | COMMAND_LINE_COMPONENTS= |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 453 | all_except=0 |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 454 | error_test=0 |
Gilles Peskine | 80ddb99 | 2021-08-06 11:51:59 +0200 | [diff] [blame] | 455 | restore_first=0 |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 456 | no_armcc= |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 457 | |
Jaeden Amero | 9b90f2e | 2018-11-02 18:34:17 +0000 | [diff] [blame] | 458 | # Note that legacy options are ignored instead of being omitted from this |
| 459 | # list of options, so invocations that worked with previous version of |
| 460 | # all.sh will still run and work properly. |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 461 | while [ $# -gt 0 ]; do |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 462 | case "$1" in |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 463 | --append-outcome) append_outcome=1;; |
Gilles Peskine | 6d06134 | 2020-04-30 18:19:32 +0200 | [diff] [blame] | 464 | --arm-none-eabi-gcc-prefix) shift; ARM_NONE_EABI_GCC_PREFIX="$1";; |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 465 | --arm-linux-gnueabi-gcc-prefix) shift; ARM_LINUX_GNUEABI_GCC_PREFIX="$1";; |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 466 | --armcc) no_armcc=;; |
Tom Cosgrove | 730addc | 2023-06-09 14:20:18 +0100 | [diff] [blame] | 467 | --armc5-bin-dir) shift; ;; # assignment to ARMC5_BIN_DIR done in pre_parse_command_line_for_dirs |
| 468 | --armc6-bin-dir) shift; ;; # assignment to ARMC6_BIN_DIR done in pre_parse_command_line_for_dirs |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 469 | --clang-earliest) shift; CLANG_EARLIEST="$1";; |
| 470 | --clang-latest) shift; CLANG_LATEST="$1";; |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 471 | --error-test) error_test=$((error_test + 1));; |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 472 | --except) all_except=1;; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 473 | --force|-f) FORCE=1;; |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 474 | --gcc-earliest) shift; GCC_EARLIEST="$1";; |
| 475 | --gcc-latest) shift; GCC_LATEST="$1";; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 476 | --gnutls-cli) shift; GNUTLS_CLI="$1";; |
| 477 | --gnutls-legacy-cli) shift; GNUTLS_LEGACY_CLI="$1";; |
| 478 | --gnutls-legacy-serv) shift; GNUTLS_LEGACY_SERV="$1";; |
| 479 | --gnutls-serv) shift; GNUTLS_SERV="$1";; |
| 480 | --help|-h) usage; exit;; |
| 481 | --keep-going|-k) KEEP_GOING=1;; |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 482 | --list-all-components) printf '%s\n' $ALL_COMPONENTS; exit;; |
| 483 | --list-components) printf '%s\n' $SUPPORTED_COMPONENTS; exit;; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 484 | --memory|-m) MEMORY=1;; |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 485 | --no-append-outcome) append_outcome=0;; |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 486 | --no-armcc) no_armcc=1;; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 487 | --no-force) FORCE=0;; |
| 488 | --no-keep-going) KEEP_GOING=0;; |
| 489 | --no-memory) MEMORY=0;; |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 490 | --no-quiet) QUIET=0;; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 491 | --openssl) shift; OPENSSL="$1";; |
| 492 | --openssl-legacy) shift; OPENSSL_LEGACY="$1";; |
| 493 | --openssl-next) shift; OPENSSL_NEXT="$1";; |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 494 | --outcome-file) shift; MBEDTLS_TEST_OUTCOME_FILE="$1";; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 495 | --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";; |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 496 | --quiet|-q) QUIET=1;; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 497 | --random-seed) unset SEED;; |
Manuel Pégourié-Gonnard | e050191 | 2020-06-08 12:59:27 +0200 | [diff] [blame] | 498 | --release-test|-r) SEED=$RELEASE_SEED;; |
Gilles Peskine | 80ddb99 | 2021-08-06 11:51:59 +0200 | [diff] [blame] | 499 | --restore) restore_first=1;; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 500 | --seed|-s) shift; SEED="$1";; |
| 501 | -*) |
| 502 | echo >&2 "Unknown option: $1" |
| 503 | echo >&2 "Run $0 --help for usage." |
| 504 | exit 120 |
| 505 | ;; |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 506 | *) COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS $1";; |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 507 | esac |
| 508 | shift |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 509 | done |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 510 | |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 511 | # With no list of components, run everything. |
Gilles Peskine | 80ddb99 | 2021-08-06 11:51:59 +0200 | [diff] [blame] | 512 | if [ -z "$COMMAND_LINE_COMPONENTS" ] && [ $restore_first -eq 0 ]; then |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 513 | all_except=1 |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 514 | fi |
| 515 | |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 516 | # --no-armcc is a legacy option. The modern way is --except '*_armcc*'. |
| 517 | # Ignore it if components are listed explicitly on the command line. |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 518 | if [ -n "$no_armcc" ] && [ $all_except -eq 1 ]; then |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 519 | COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS *_armcc*" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 520 | fi |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 521 | |
Gilles Peskine | bf66e2c | 2021-08-03 13:44:28 +0200 | [diff] [blame] | 522 | # Error out if an explicitly requested component doesn't exist. |
Gilles Peskine | b80f0d2 | 2020-03-28 21:37:59 +0100 | [diff] [blame] | 523 | if [ $all_except -eq 0 ]; then |
| 524 | unsupported=0 |
Gilles Peskine | 03af678 | 2021-08-06 11:35:17 +0200 | [diff] [blame] | 525 | # Temporarily disable wildcard expansion so that $COMMAND_LINE_COMPONENTS |
| 526 | # only does word splitting. |
Gilles Peskine | 1d475b6 | 2021-08-03 13:43:36 +0200 | [diff] [blame] | 527 | set -f |
Gilles Peskine | b80f0d2 | 2020-03-28 21:37:59 +0100 | [diff] [blame] | 528 | for component in $COMMAND_LINE_COMPONENTS; do |
Gilles Peskine | 1d475b6 | 2021-08-03 13:43:36 +0200 | [diff] [blame] | 529 | set +f |
Gilles Peskine | bf66e2c | 2021-08-03 13:44:28 +0200 | [diff] [blame] | 530 | # If the requested name includes a wildcard character, don't |
| 531 | # check it. Accept wildcard patterns that don't match anything. |
Gilles Peskine | b80f0d2 | 2020-03-28 21:37:59 +0100 | [diff] [blame] | 532 | case $component in |
| 533 | *[*?\[]*) continue;; |
| 534 | esac |
| 535 | case " $SUPPORTED_COMPONENTS " in |
| 536 | *" $component "*) :;; |
| 537 | *) |
| 538 | echo >&2 "Component $component was explicitly requested, but is not known or not supported." |
| 539 | unsupported=$((unsupported + 1));; |
| 540 | esac |
| 541 | done |
Gilles Peskine | 1d475b6 | 2021-08-03 13:43:36 +0200 | [diff] [blame] | 542 | set +f |
Gilles Peskine | b80f0d2 | 2020-03-28 21:37:59 +0100 | [diff] [blame] | 543 | if [ $unsupported -ne 0 ]; then |
| 544 | exit 2 |
| 545 | fi |
| 546 | fi |
| 547 | |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 548 | # Build the list of components to run. |
Gilles Peskine | a28db92 | 2019-01-10 00:05:18 +0100 | [diff] [blame] | 549 | RUN_COMPONENTS= |
| 550 | for component in $SUPPORTED_COMPONENTS; do |
| 551 | if is_component_included "$component"; [ $? -eq $all_except ]; then |
| 552 | RUN_COMPONENTS="$RUN_COMPONENTS $component" |
| 553 | fi |
| 554 | done |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 555 | |
| 556 | unset all_except |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 557 | unset no_armcc |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 558 | } |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 559 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 560 | pre_check_git () { |
| 561 | if [ $FORCE -eq 1 ]; then |
Gilles Peskine | 53190e6 | 2019-01-09 23:17:35 +0100 | [diff] [blame] | 562 | rm -rf "$OUT_OF_SOURCE_DIR" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 563 | git checkout-index -f -q $CONFIG_H |
| 564 | cleanup |
| 565 | else |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 566 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 567 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 568 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 569 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 570 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 571 | exit 1 |
| 572 | fi |
| 573 | |
Ronald Cron | 7a93ac5 | 2023-07-20 09:49:12 +0200 | [diff] [blame] | 574 | if ! git diff --quiet "$CONFIG_H"; then |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 575 | err_msg "Warning - the configuration file '$CONFIG_H' has been edited. " |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 576 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 577 | echo "script as: $0 --force" |
| 578 | exit 1 |
| 579 | fi |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 580 | fi |
Andrzej Kurek | eb50871 | 2019-02-14 07:18:59 -0500 | [diff] [blame] | 581 | } |
| 582 | |
Gilles Peskine | 568f53a | 2021-07-12 18:16:01 +0200 | [diff] [blame] | 583 | pre_restore_files () { |
| 584 | # If the makefiles have been generated by a framework such as cmake, |
| 585 | # restore them from git. If the makefiles look like modifications from |
| 586 | # the ones checked into git, take care not to modify them. Whatever |
| 587 | # this function leaves behind is what the script will restore before |
| 588 | # each component. |
| 589 | case "$(head -n1 Makefile)" in |
| 590 | *[Gg]enerated*) |
| 591 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile |
| 592 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile |
| 593 | ;; |
| 594 | esac |
| 595 | } |
| 596 | |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 597 | pre_back_up () { |
| 598 | for x in $files_to_back_up; do |
| 599 | cp -p "$x" "$x$backup_suffix" |
| 600 | done |
| 601 | } |
| 602 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 603 | pre_setup_keep_going () { |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 604 | failure_count=0 # Number of failed components |
| 605 | last_failure_status=0 # Last failure status in this component |
| 606 | |
Gilles Peskine | fec30cb | 2020-03-28 19:34:23 +0100 | [diff] [blame] | 607 | # See err_trap |
| 608 | previous_failure_status=0 |
| 609 | previous_failed_command= |
| 610 | previous_failure_funcall_depth=0 |
Gilles Peskine | a681c59 | 2020-03-28 21:27:40 +0100 | [diff] [blame] | 611 | unset report_failed_command |
Gilles Peskine | fec30cb | 2020-03-28 19:34:23 +0100 | [diff] [blame] | 612 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 613 | start_red= |
| 614 | end_color= |
| 615 | if [ -t 1 ]; then |
Gilles Peskine | 9736b9d | 2018-01-02 21:54:17 +0100 | [diff] [blame] | 616 | case "${TERM:-}" in |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 617 | *color*|cygwin|linux|rxvt*|screen|[Eex]term*) |
| 618 | start_red=$(printf '\033[31m') |
| 619 | end_color=$(printf '\033[0m') |
| 620 | ;; |
| 621 | esac |
| 622 | fi |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 623 | |
| 624 | # Keep a summary of failures in a file. We'll print it out at the end. |
| 625 | failure_summary_file=$PWD/all-sh-failures-$$.log |
| 626 | : >"$failure_summary_file" |
| 627 | |
| 628 | # Whether it makes sense to keep a component going after the specified |
| 629 | # command fails (test command) or not (configure or build). |
Gilles Peskine | 03af678 | 2021-08-06 11:35:17 +0200 | [diff] [blame] | 630 | # This function normally receives the failing simple command |
| 631 | # ($BASH_COMMAND) as an argument, but if $report_failed_command is set, |
| 632 | # this is passed instead. |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 633 | # This doesn't have to be 100% accurate: all failures are recorded anyway. |
Gilles Peskine | c111e24 | 2021-08-02 23:29:53 +0200 | [diff] [blame] | 634 | # False positives result in running things that can't be expected to |
| 635 | # work. False negatives result in things not running after something else |
| 636 | # failed even though they might have given useful feedback. |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 637 | can_keep_going_after_failure () { |
| 638 | case "$1" in |
| 639 | "msg "*) false;; |
Gilles Peskine | c111e24 | 2021-08-02 23:29:53 +0200 | [diff] [blame] | 640 | "cd "*) false;; |
| 641 | *make*[\ /]tests*) false;; # make tests, make CFLAGS=-I../tests, ... |
| 642 | *test*) true;; # make test, tests/stuff, env V=v tests/stuff, ... |
| 643 | *make*check*) true;; |
| 644 | "grep "*) true;; |
| 645 | "[ "*) true;; |
| 646 | "! "*) true;; |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 647 | *) false;; |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 648 | esac |
| 649 | } |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 650 | |
| 651 | # This function runs if there is any error in a component. |
| 652 | # It must either exit with a nonzero status, or set |
| 653 | # last_failure_status to a nonzero value. |
| 654 | err_trap () { |
| 655 | # Save $? (status of the failing command). This must be the very |
| 656 | # first thing, before $? is overridden. |
| 657 | last_failure_status=$? |
Gilles Peskine | a681c59 | 2020-03-28 21:27:40 +0100 | [diff] [blame] | 658 | failed_command=${report_failed_command-$BASH_COMMAND} |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 659 | |
Gilles Peskine | fec30cb | 2020-03-28 19:34:23 +0100 | [diff] [blame] | 660 | if [[ $last_failure_status -eq $previous_failure_status && |
| 661 | "$failed_command" == "$previous_failed_command" && |
| 662 | ${#FUNCNAME[@]} == $((previous_failure_funcall_depth - 1)) ]] |
| 663 | then |
| 664 | # The same command failed twice in a row, but this time one level |
| 665 | # less deep in the function call stack. This happens when the last |
| 666 | # command of a function returns a nonzero status, and the function |
| 667 | # returns that same status. Ignore the second failure. |
| 668 | previous_failure_funcall_depth=${#FUNCNAME[@]} |
| 669 | return |
| 670 | fi |
| 671 | previous_failure_status=$last_failure_status |
| 672 | previous_failed_command=$failed_command |
| 673 | previous_failure_funcall_depth=${#FUNCNAME[@]} |
| 674 | |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 675 | text="$current_section: $failed_command -> $last_failure_status" |
| 676 | echo "${start_red}^^^^$text^^^^${end_color}" >&2 |
| 677 | echo "$text" >>"$failure_summary_file" |
| 678 | |
| 679 | # If the command is fatal (configure or build command), stop this |
| 680 | # component. Otherwise (test command) keep the component running |
| 681 | # (run more tests from the same build). |
| 682 | if ! can_keep_going_after_failure "$failed_command"; then |
| 683 | exit $last_failure_status |
| 684 | fi |
| 685 | } |
| 686 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 687 | final_report () { |
| 688 | if [ $failure_count -gt 0 ]; then |
| 689 | echo |
| 690 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 691 | echo "${start_red}FAILED: $failure_count components${end_color}" |
| 692 | cat "$failure_summary_file" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 693 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 694 | elif [ -z "${1-}" ]; then |
| 695 | echo "SUCCESS :)" |
| 696 | fi |
| 697 | if [ -n "${1-}" ]; then |
| 698 | echo "Killed by SIG$1." |
| 699 | fi |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 700 | rm -f "$failure_summary_file" |
| 701 | if [ $failure_count -gt 0 ]; then |
| 702 | exit 1 |
| 703 | fi |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 704 | } |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 705 | } |
| 706 | |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 707 | # record_status() and if_build_succeeded() are kept temporarily for backward |
| 708 | # compatibility. Don't use them in new components. |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 709 | record_status () { |
| 710 | "$@" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 711 | } |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 712 | if_build_succeeded () { |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 713 | "$@" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 714 | } |
| 715 | |
Gilles Peskine | a681c59 | 2020-03-28 21:27:40 +0100 | [diff] [blame] | 716 | # '! true' does not trigger the ERR trap. Arrange to trigger it, with |
| 717 | # a reasonably informative error message (not just "$@"). |
| 718 | not () { |
| 719 | if "$@"; then |
| 720 | report_failed_command="! $*" |
| 721 | false |
| 722 | unset report_failed_command |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 723 | fi |
| 724 | } |
| 725 | |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 726 | pre_prepare_outcome_file () { |
| 727 | case "$MBEDTLS_TEST_OUTCOME_FILE" in |
| 728 | [!/]*) MBEDTLS_TEST_OUTCOME_FILE="$PWD/$MBEDTLS_TEST_OUTCOME_FILE";; |
| 729 | esac |
| 730 | if [ -n "$MBEDTLS_TEST_OUTCOME_FILE" ] && [ "$append_outcome" -eq 0 ]; then |
| 731 | rm -f "$MBEDTLS_TEST_OUTCOME_FILE" |
| 732 | fi |
| 733 | } |
| 734 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 735 | pre_print_configuration () { |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 736 | if [ $QUIET -eq 1 ]; then |
| 737 | return |
| 738 | fi |
| 739 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 740 | msg "info: $0 configuration" |
| 741 | echo "MEMORY: $MEMORY" |
| 742 | echo "FORCE: $FORCE" |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 743 | echo "MBEDTLS_TEST_OUTCOME_FILE: ${MBEDTLS_TEST_OUTCOME_FILE:-(none)}" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 744 | echo "SEED: ${SEED-"UNSET"}" |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 745 | echo |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 746 | echo "OPENSSL: $OPENSSL" |
| 747 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 748 | echo "OPENSSL_NEXT: $OPENSSL_NEXT" |
| 749 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 750 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 751 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 752 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
| 753 | echo "ARMC5_BIN_DIR: $ARMC5_BIN_DIR" |
| 754 | echo "ARMC6_BIN_DIR: $ARMC6_BIN_DIR" |
| 755 | } |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 756 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 757 | # Make sure the tools we need are available. |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 758 | pre_check_tools () { |
Gilles Peskine | cc9f0b9 | 2019-01-06 22:46:21 +0000 | [diff] [blame] | 759 | # Build the list of variables to pass to output_env.sh. |
| 760 | set env |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 761 | |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 762 | case " $RUN_COMPONENTS " in |
| 763 | # Require OpenSSL and GnuTLS if running any tests (as opposed to |
| 764 | # only doing builds). Not all tests run OpenSSL and GnuTLS, but this |
| 765 | # is a good enough approximation in practice. |
| 766 | *" test_"*) |
| 767 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh |
| 768 | # and ssl-opt.sh, we just export the variables they require. |
Manuel Pégourié-Gonnard | c572246 | 2022-12-19 11:42:12 +0100 | [diff] [blame] | 769 | export OPENSSL="$OPENSSL" |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 770 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 771 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 772 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 773 | if [ -n "${SEED-}" ]; then |
| 774 | export SEED |
| 775 | fi |
Gilles Peskine | cc9f0b9 | 2019-01-06 22:46:21 +0000 | [diff] [blame] | 776 | set "$@" OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" |
| 777 | set "$@" GNUTLS_CLI="$GNUTLS_CLI" GNUTLS_SERV="$GNUTLS_SERV" |
| 778 | set "$@" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" |
| 779 | set "$@" GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 780 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$OPENSSL_NEXT" \ |
| 781 | "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
| 782 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" |
| 783 | ;; |
| 784 | esac |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 785 | |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 786 | case " $RUN_COMPONENTS " in |
| 787 | *_doxygen[_\ ]*) check_tools "doxygen" "dot";; |
| 788 | esac |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 789 | |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 790 | case " $RUN_COMPONENTS " in |
Gilles Peskine | 6d06134 | 2020-04-30 18:19:32 +0200 | [diff] [blame] | 791 | *_arm_none_eabi_gcc[_\ ]*) check_tools "${ARM_NONE_EABI_GCC_PREFIX}gcc";; |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 792 | esac |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 793 | |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 794 | case " $RUN_COMPONENTS " in |
| 795 | *_mingw[_\ ]*) check_tools "i686-w64-mingw32-gcc";; |
| 796 | esac |
| 797 | |
| 798 | case " $RUN_COMPONENTS " in |
| 799 | *" test_zeroize "*) check_tools "gdb";; |
| 800 | esac |
| 801 | |
| 802 | case " $RUN_COMPONENTS " in |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 803 | *_armcc*) |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 804 | ARMC5_CC="$ARMC5_BIN_DIR/armcc" |
| 805 | ARMC5_AR="$ARMC5_BIN_DIR/armar" |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 806 | ARMC5_FROMELF="$ARMC5_BIN_DIR/fromelf" |
Gilles Peskine | 8796426 | 2019-01-06 22:40:00 +0000 | [diff] [blame] | 807 | ARMC6_CC="$ARMC6_BIN_DIR/armclang" |
| 808 | ARMC6_AR="$ARMC6_BIN_DIR/armar" |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 809 | ARMC6_FROMELF="$ARMC6_BIN_DIR/fromelf" |
| 810 | check_tools "$ARMC5_CC" "$ARMC5_AR" "$ARMC5_FROMELF" \ |
| 811 | "$ARMC6_CC" "$ARMC6_AR" "$ARMC6_FROMELF";; |
Gilles Peskine | 5331c6e | 2019-01-06 22:23:42 +0000 | [diff] [blame] | 812 | esac |
Gilles Peskine | cc9f0b9 | 2019-01-06 22:46:21 +0000 | [diff] [blame] | 813 | |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 814 | # past this point, no call to check_tool, only printing output |
| 815 | if [ $QUIET -eq 1 ]; then |
| 816 | return |
| 817 | fi |
| 818 | |
Gilles Peskine | cc9f0b9 | 2019-01-06 22:46:21 +0000 | [diff] [blame] | 819 | msg "info: output_env.sh" |
| 820 | case $RUN_COMPONENTS in |
| 821 | *_armcc*) |
| 822 | set "$@" ARMC5_CC="$ARMC5_CC" ARMC6_CC="$ARMC6_CC" RUN_ARMCC=1;; |
| 823 | *) set "$@" RUN_ARMCC=0;; |
| 824 | esac |
| 825 | "$@" scripts/output_env.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 826 | } |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 827 | |
Gilles Peskine | 1570b59 | 2021-04-22 01:10:12 +0200 | [diff] [blame] | 828 | pre_generate_files() { |
Manuel Pégourié-Gonnard | 87db8a2 | 2021-06-18 13:30:14 +0200 | [diff] [blame] | 829 | # since make doesn't have proper dependencies, remove any possibly outdate |
| 830 | # file that might be around before generating fresh ones |
| 831 | make neat |
Gilles Peskine | 7238503 | 2021-07-08 19:07:07 +0200 | [diff] [blame] | 832 | if [ $QUIET -eq 1 ]; then |
Gilles Peskine | 7530163 | 2021-08-05 15:10:47 +0200 | [diff] [blame] | 833 | make generated_files >/dev/null |
Gilles Peskine | 7238503 | 2021-07-08 19:07:07 +0200 | [diff] [blame] | 834 | else |
| 835 | make generated_files |
| 836 | fi |
Gilles Peskine | 1570b59 | 2021-04-22 01:10:12 +0200 | [diff] [blame] | 837 | } |
| 838 | |
Manuel Pégourié-Gonnard | 27e1767 | 2023-05-25 09:39:08 +0200 | [diff] [blame] | 839 | ################################################################ |
| 840 | #### Helpers for components using libtestdriver1 |
| 841 | ################################################################ |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 842 | |
Manuel Pégourié-Gonnard | f5c5d97 | 2023-06-06 11:14:57 +0200 | [diff] [blame] | 843 | # How to use libtestdriver1 |
| 844 | # ------------------------- |
| 845 | # |
| 846 | # 1. Define the list algorithms and key types to accelerate, |
| 847 | # designated the same way as PSA_WANT_ macros but without PSA_WANT_. |
| 848 | # Examples: |
| 849 | # - loc_accel_list="ALG_JPAKE" |
| 850 | # - loc_accel_list="ALG_FFDH KEY_TYPE_DH_KEY_PAIR KEY_TYPE_DH_PUBLIC_KEY" |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 851 | # 2. Make configurations changes for the driver and/or main libraries. |
| 852 | # 2a. Call helper_libtestdriver1_adjust_config <base>, where the argument |
| 853 | # can be either "default" to start with the default config, or a name |
| 854 | # supported by scripts/config.py (for example, "full"). This selects |
Manuel Pégourié-Gonnard | 2336c8e | 2023-06-12 17:17:54 +0200 | [diff] [blame] | 855 | # the base to use, and makes common adjustments. |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 856 | # 2b. If desired, adjust the PSA_WANT symbols in psa/crypto_config.h. |
| 857 | # These changes affect both the driver and the main libraries. |
| 858 | # (Note: they need to have the same set of PSA_WANT symbols, as that |
| 859 | # determines the ABI between them.) |
| 860 | # 2c. Adjust MBEDTLS_ symbols in mbedtls_config.h. This only affects the |
| 861 | # main libraries. Typically, you want to disable the module(s) that are |
| 862 | # being accelerated. You may need to also disable modules that depend |
| 863 | # on them or options that are not supported with drivers. |
| 864 | # 2d. On top of psa/crypto_config.h, the driver library uses its own config |
| 865 | # file: tests/include/test/drivers/config_test_driver.h. You usually |
| 866 | # don't need to edit it: using loc_extra_list (see below) is preferred. |
| 867 | # However, when there's no PSA symbol for what you want to enable, |
| 868 | # calling scripts/config.py on this file remains the only option. |
| 869 | # 3. Build the driver library, then the main libraries, test, and programs. |
| 870 | # 3a. Call helper_libtestdriver1_make_drivers "$loc_accel_list". You may |
| 871 | # need to enable more algorithms here, typically hash algorithms when |
| 872 | # accelerating some signature algorithms (ECDSA, RSAv2). This is done |
| 873 | # by passing a 2nd argument listing the extra algorithms. |
| 874 | # Example: |
| 875 | # loc_extra_list="ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512" |
| 876 | # helper_libtestdriver1_make_drivers "$loc_accel_list" "$loc_extra_list" |
| 877 | # 4b. Call helper_libtestdriver1_make_main "$loc_accel_list". Any |
| 878 | # additional arguments will be passed to make: this can be useful if |
| 879 | # you don't want to build everything when iterating during development. |
| 880 | # Example: |
| 881 | # helper_libtestdriver1_make_main "$loc_accel_list" -C tests test_suite_foo |
| 882 | # 4. Run the tests you want. |
Manuel Pégourié-Gonnard | f5c5d97 | 2023-06-06 11:14:57 +0200 | [diff] [blame] | 883 | |
Manuel Pégourié-Gonnard | 27e1767 | 2023-05-25 09:39:08 +0200 | [diff] [blame] | 884 | # Adjust the configuration - for both libtestdriver1 and main library, |
| 885 | # as they should have the same PSA_WANT macros. |
| 886 | helper_libtestdriver1_adjust_config() { |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 887 | BASE_CONFIG=$1 |
| 888 | # Select the base configuration |
| 889 | if [ "$BASE_CONFIG" != "default" ]; then |
| 890 | scripts/config.py "$BASE_CONFIG" |
| 891 | fi |
| 892 | |
| 893 | # Enable PSA-based config (necessary to use drivers) |
| 894 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 895 | |
Manuel Pégourié-Gonnard | 27e1767 | 2023-05-25 09:39:08 +0200 | [diff] [blame] | 896 | # Disable ALG_STREAM_CIPHER and ALG_ECB_NO_PADDING to avoid having |
| 897 | # partial support for cipher operations in the driver test library. |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 898 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_STREAM_CIPHER |
| 899 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_ECB_NO_PADDING |
Manuel Pégourié-Gonnard | 2336c8e | 2023-06-12 17:17:54 +0200 | [diff] [blame] | 900 | |
| 901 | # Dynamic secure element support is a deprecated feature and needs to be disabled here. |
| 902 | # This is done to have the same form of psa_key_attributes_s for libdriver and library. |
| 903 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C |
Manuel Pégourié-Gonnard | 27e1767 | 2023-05-25 09:39:08 +0200 | [diff] [blame] | 904 | } |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 905 | |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 906 | # When called with no parameter this function disables all builtin curves. |
Valerio Setti | 4ca250b | 2023-09-04 14:01:41 +0200 | [diff] [blame] | 907 | # The function optionally accepts 1 parameter: a space-separated list of the |
| 908 | # curves that should be kept enabled. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 909 | helper_disable_builtin_curves() { |
| 910 | allowed_list="${1:-}" |
| 911 | scripts/config.py unset-all "MBEDTLS_ECP_DP_[0-9A-Z_a-z]*_ENABLED" |
| 912 | |
| 913 | for CURVE in $allowed_list; do |
| 914 | scripts/config.py set $CURVE |
| 915 | done |
| 916 | } |
| 917 | |
| 918 | # Helper returning the list of supported elliptic curves from CRYPTO_CONFIG_H, |
| 919 | # without the "PSA_WANT_" prefix. This becomes handy for accelerating curves |
| 920 | # in the following helpers. |
| 921 | helper_get_psa_curve_list () { |
| 922 | loc_list="" |
| 923 | for ITEM in $(sed -n 's/^#define PSA_WANT_\(ECC_[0-9A-Z_a-z]*\).*/\1/p' <"$CRYPTO_CONFIG_H"); do |
| 924 | loc_list="$loc_list $ITEM" |
| 925 | done |
| 926 | |
| 927 | echo "$loc_list" |
| 928 | } |
| 929 | |
| 930 | # Get the list of uncommented PSA_WANT_KEY_TYPE_xxx_ from CRYPTO_CONFIG_H. This |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 931 | # is useful to easily get a list of key type symbols to accelerate. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 932 | # The function accepts a single argument which is the key type: ECC, DH, RSA. |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 933 | helper_get_psa_key_type_list() { |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 934 | KEY_TYPE="$1" |
| 935 | loc_list="" |
| 936 | for ITEM in $(sed -n "s/^#define PSA_WANT_\(KEY_TYPE_${KEY_TYPE}_[0-9A-Z_a-z]*\).*/\1/p" <"$CRYPTO_CONFIG_H"); do |
| 937 | # Skip DERIVE for elliptic keys since there is no driver dispatch for |
| 938 | # it so it cannot be accelerated. |
| 939 | if [ "$ITEM" != "KEY_TYPE_ECC_KEY_PAIR_DERIVE" ]; then |
| 940 | loc_list="$loc_list $ITEM" |
| 941 | fi |
| 942 | done |
| 943 | |
| 944 | echo "$loc_list" |
| 945 | } |
| 946 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 947 | # Build the drivers library libtestdriver1.a (with ASan). |
Manuel Pégourié-Gonnard | 31639e4 | 2023-05-25 10:07:31 +0200 | [diff] [blame] | 948 | # |
| 949 | # Parameters: |
| 950 | # 1. a space-separated list of things to accelerate; |
| 951 | # 2. optional: a space-separate list of things to also support. |
| 952 | # Here "things" are PSA_WANT_ symbols but with PSA_WANT_ removed. |
| 953 | helper_libtestdriver1_make_drivers() { |
| 954 | loc_accel_flags=$( echo "$1 ${2-}" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' ) |
| 955 | make -C tests libtestdriver1.a CFLAGS=" $ASAN_CFLAGS $loc_accel_flags" LDFLAGS="$ASAN_CFLAGS" |
| 956 | } |
| 957 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 958 | # Build the main libraries, programs and tests, |
| 959 | # linking to the drivers library (with ASan). |
| 960 | # |
| 961 | # Parameters: |
| 962 | # 1. a space-separated list of things to accelerate; |
| 963 | # *. remaining arguments if any are passed directly to make |
| 964 | # (examples: lib, -C tests test_suite_xxx, etc.) |
| 965 | # Here "things" are PSA_WANT_ symbols but with PSA_WANT_ removed. |
| 966 | helper_libtestdriver1_make_main() { |
| 967 | loc_accel_list=$1 |
| 968 | shift |
| 969 | |
| 970 | # we need flags both with and without the LIBTESTDRIVER1_ prefix |
| 971 | loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' ) |
| 972 | loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )" |
| 973 | make CFLAGS="$ASAN_CFLAGS -I../tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS" "$@" |
| 974 | } |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 975 | |
| 976 | ################################################################ |
| 977 | #### Basic checks |
| 978 | ################################################################ |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 979 | |
| 980 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 981 | # Test Suites to be executed |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 982 | # |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 983 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 984 | # 1. Catch possible problems early, by running first tests that run quickly |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 985 | # and/or are more likely to fail than others (eg I use Clang most of the |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 986 | # time, so start with a GCC build). |
| 987 | # 2. Minimize total running time, by avoiding useless rebuilds |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 988 | # |
Manuel Pégourié-Gonnard | 259b08a | 2016-01-08 16:27:41 +0100 | [diff] [blame] | 989 | # Indicative running times are given for reference. |
| 990 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 991 | component_check_recursion () { |
Gilles Peskine | 600bb69 | 2019-09-19 21:29:11 +0200 | [diff] [blame] | 992 | msg "Check: recursion.pl" # < 1s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 993 | tests/scripts/recursion.pl library/*.c |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 994 | } |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 995 | |
Gilles Peskine | 67debb6 | 2021-05-18 16:09:50 +0200 | [diff] [blame] | 996 | component_check_generated_files () { |
| 997 | msg "Check: check-generated-files, files generated with make" # 2s |
| 998 | make generated_files |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 999 | tests/scripts/check-generated-files.sh |
Gilles Peskine | 67debb6 | 2021-05-18 16:09:50 +0200 | [diff] [blame] | 1000 | |
| 1001 | msg "Check: check-generated-files -u, files present" # 2s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1002 | tests/scripts/check-generated-files.sh -u |
Gilles Peskine | 67debb6 | 2021-05-18 16:09:50 +0200 | [diff] [blame] | 1003 | # Check that the generated files are considered up to date. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1004 | tests/scripts/check-generated-files.sh |
Gilles Peskine | 67debb6 | 2021-05-18 16:09:50 +0200 | [diff] [blame] | 1005 | |
| 1006 | msg "Check: check-generated-files -u, files absent" # 2s |
| 1007 | command make neat |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1008 | tests/scripts/check-generated-files.sh -u |
Gilles Peskine | 67debb6 | 2021-05-18 16:09:50 +0200 | [diff] [blame] | 1009 | # Check that the generated files are considered up to date. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1010 | tests/scripts/check-generated-files.sh |
Gilles Peskine | 67debb6 | 2021-05-18 16:09:50 +0200 | [diff] [blame] | 1011 | |
| 1012 | # This component ends with the generated files present in the source tree. |
| 1013 | # This is necessary for subsequent components! |
| 1014 | } |
| 1015 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1016 | component_check_doxy_blocks () { |
Gilles Peskine | 600bb69 | 2019-09-19 21:29:11 +0200 | [diff] [blame] | 1017 | msg "Check: doxygen markup outside doxygen blocks" # < 1s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1018 | tests/scripts/check-doxy-blocks.pl |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1019 | } |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1020 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1021 | component_check_files () { |
Gilles Peskine | 600bb69 | 2019-09-19 21:29:11 +0200 | [diff] [blame] | 1022 | msg "Check: file sanity checks (permissions, encodings)" # < 1s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1023 | tests/scripts/check_files.py |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1024 | } |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1025 | |
Gilles Peskine | 30e0bb4 | 2020-05-10 17:40:49 +0200 | [diff] [blame] | 1026 | component_check_changelog () { |
| 1027 | msg "Check: changelog entries" # < 1s |
| 1028 | rm -f ChangeLog.new |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1029 | scripts/assemble_changelog.py -o ChangeLog.new |
Gilles Peskine | 30e0bb4 | 2020-05-10 17:40:49 +0200 | [diff] [blame] | 1030 | if [ -e ChangeLog.new ]; then |
| 1031 | # Show the diff for information. It isn't an error if the diff is |
| 1032 | # non-empty. |
| 1033 | diff -u ChangeLog ChangeLog.new || true |
| 1034 | rm ChangeLog.new |
| 1035 | fi |
| 1036 | } |
| 1037 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1038 | component_check_names () { |
Gilles Peskine | 600bb69 | 2019-09-19 21:29:11 +0200 | [diff] [blame] | 1039 | msg "Check: declared and exported names (builds the library)" # < 3s |
Yuto Takano | c3a6f63 | 2021-09-24 18:02:56 +0100 | [diff] [blame] | 1040 | tests/scripts/check_names.py -v |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1041 | } |
Darryl Green | a07039c | 2018-03-13 16:48:16 +0000 | [diff] [blame] | 1042 | |
Gilles Peskine | 895868b | 2019-09-19 21:30:05 +0200 | [diff] [blame] | 1043 | component_check_test_cases () { |
| 1044 | msg "Check: test case descriptions" # < 1s |
Manuel Pégourié-Gonnard | a911916 | 2020-06-02 11:51:40 +0200 | [diff] [blame] | 1045 | if [ $QUIET -eq 1 ]; then |
Manuel Pégourié-Gonnard | 304b099 | 2020-06-08 10:59:41 +0200 | [diff] [blame] | 1046 | opt='--quiet' |
Manuel Pégourié-Gonnard | a911916 | 2020-06-02 11:51:40 +0200 | [diff] [blame] | 1047 | else |
Manuel Pégourié-Gonnard | 304b099 | 2020-06-08 10:59:41 +0200 | [diff] [blame] | 1048 | opt='' |
Manuel Pégourié-Gonnard | a911916 | 2020-06-02 11:51:40 +0200 | [diff] [blame] | 1049 | fi |
Gilles Peskine | 031114d | 2022-12-15 14:46:31 +0100 | [diff] [blame] | 1050 | tests/scripts/check_test_cases.py -q $opt |
Manuel Pégourié-Gonnard | 304b099 | 2020-06-08 10:59:41 +0200 | [diff] [blame] | 1051 | unset opt |
Gilles Peskine | 895868b | 2019-09-19 21:30:05 +0200 | [diff] [blame] | 1052 | } |
| 1053 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1054 | component_check_doxygen_warnings () { |
Gilles Peskine | 600bb69 | 2019-09-19 21:29:11 +0200 | [diff] [blame] | 1055 | msg "Check: doxygen warnings (builds the documentation)" # ~ 3s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1056 | tests/scripts/doxygen.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1057 | } |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1058 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 1059 | |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1060 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 1061 | ################################################################ |
| 1062 | #### Build and test many configurations and targets |
| 1063 | ################################################################ |
| 1064 | |
Gilles Peskine | 7832c9f | 2019-04-08 17:00:15 +0200 | [diff] [blame] | 1065 | component_test_default_out_of_box () { |
| 1066 | msg "build: make, default config (out-of-box)" # ~1min |
| 1067 | make |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 1068 | # Disable fancy stuff |
| 1069 | unset MBEDTLS_TEST_OUTCOME_FILE |
Gilles Peskine | 7832c9f | 2019-04-08 17:00:15 +0200 | [diff] [blame] | 1070 | |
| 1071 | msg "test: main suites make, default config (out-of-box)" # ~10s |
| 1072 | make test |
| 1073 | |
| 1074 | msg "selftest: make, default config (out-of-box)" # ~10s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1075 | programs/test/selftest |
Gilles Peskine | 7832c9f | 2019-04-08 17:00:15 +0200 | [diff] [blame] | 1076 | } |
| 1077 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1078 | component_test_default_cmake_gcc_asan () { |
| 1079 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1080 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1081 | make |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1082 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1083 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
| 1084 | make test |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1085 | |
Gilles Peskine | 97bea01 | 2020-04-23 23:37:45 +0200 | [diff] [blame] | 1086 | msg "test: selftest (ASan build)" # ~ 10s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1087 | programs/test/selftest |
Gilles Peskine | 97bea01 | 2020-04-23 23:37:45 +0200 | [diff] [blame] | 1088 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1089 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1090 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1091 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1092 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1093 | tests/compat.sh |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 1094 | |
| 1095 | msg "test: context-info.sh (ASan build)" # ~ 15 sec |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1096 | tests/context-info.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1097 | } |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1098 | |
Gabor Mezei | 9b6b5a0 | 2023-06-06 17:22:25 +0200 | [diff] [blame] | 1099 | component_test_default_cmake_gcc_asan_new_bignum () { |
| 1100 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Janos Follath | 2f04582 | 2023-07-31 10:57:16 +0100 | [diff] [blame] | 1101 | scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT |
Gabor Mezei | 9b6b5a0 | 2023-06-06 17:22:25 +0200 | [diff] [blame] | 1102 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Janos Follath | 82823b2 | 2023-07-27 12:25:05 +0100 | [diff] [blame] | 1103 | make |
Gabor Mezei | 9b6b5a0 | 2023-06-06 17:22:25 +0200 | [diff] [blame] | 1104 | |
| 1105 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
| 1106 | make test |
| 1107 | |
| 1108 | msg "test: selftest (ASan build)" # ~ 10s |
| 1109 | programs/test/selftest |
| 1110 | |
| 1111 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
| 1112 | tests/ssl-opt.sh |
| 1113 | |
| 1114 | msg "test: compat.sh (ASan build)" # ~ 6 min |
| 1115 | tests/compat.sh |
| 1116 | |
| 1117 | msg "test: context-info.sh (ASan build)" # ~ 15 sec |
| 1118 | tests/context-info.sh |
| 1119 | } |
| 1120 | |
Hanno Becker | 0163551 | 2019-02-26 14:27:09 +0000 | [diff] [blame] | 1121 | component_test_full_cmake_gcc_asan () { |
| 1122 | msg "build: full config, cmake, gcc, ASan" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1123 | scripts/config.py full |
Hanno Becker | 0163551 | 2019-02-26 14:27:09 +0000 | [diff] [blame] | 1124 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1125 | make |
| 1126 | |
| 1127 | msg "test: main suites (inc. selftests) (full config, ASan build)" |
| 1128 | make test |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1129 | |
Gilles Peskine | 97bea01 | 2020-04-23 23:37:45 +0200 | [diff] [blame] | 1130 | msg "test: selftest (ASan build)" # ~ 10s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1131 | programs/test/selftest |
Gilles Peskine | 97bea01 | 2020-04-23 23:37:45 +0200 | [diff] [blame] | 1132 | |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1133 | msg "test: ssl-opt.sh (full config, ASan build)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1134 | tests/ssl-opt.sh |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1135 | |
| 1136 | msg "test: compat.sh (full config, ASan build)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1137 | tests/compat.sh |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 1138 | |
| 1139 | msg "test: context-info.sh (full config, ASan build)" # ~ 15 sec |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1140 | tests/context-info.sh |
Valerio Setti | 3322f61 | 2022-12-30 17:45:05 +0100 | [diff] [blame] | 1141 | |
Valerio Setti | 67419f0 | 2023-01-04 16:12:42 +0100 | [diff] [blame] | 1142 | msg "test: check direct ECP dependencies in TLS and X.509" |
Valerio Setti | 3322f61 | 2022-12-30 17:45:05 +0100 | [diff] [blame] | 1143 | docs/architecture/psa-migration/syms.sh full |
| 1144 | |
Valerio Setti | 67419f0 | 2023-01-04 16:12:42 +0100 | [diff] [blame] | 1145 | # TODO: replace "mbedtls_ecp_curve" with "mbedtls_ecp" also for |
| 1146 | # "full-tls-external" once Issue6839 is completed |
valerio | 0b04864 | 2023-04-20 13:28:39 +0200 | [diff] [blame] | 1147 | not grep mbedtls_ecp_curve full-libmbedtls-external |
| 1148 | not grep mbedtls_ecp full-libmbedx509-external |
Valerio Setti | 3322f61 | 2022-12-30 17:45:05 +0100 | [diff] [blame] | 1149 | |
valerio | 0b04864 | 2023-04-20 13:28:39 +0200 | [diff] [blame] | 1150 | rm full-libmbedtls-external \ |
| 1151 | full-libmbedtls-modules \ |
| 1152 | full-libmbedx509-external \ |
| 1153 | full-libmbedx509-modules |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1154 | } |
| 1155 | |
Gabor Mezei | 9b6b5a0 | 2023-06-06 17:22:25 +0200 | [diff] [blame] | 1156 | |
| 1157 | component_test_full_cmake_gcc_asan_new_bignum () { |
| 1158 | msg "build: full config, cmake, gcc, ASan" |
| 1159 | scripts/config.py full |
Janos Follath | 2f04582 | 2023-07-31 10:57:16 +0100 | [diff] [blame] | 1160 | scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT |
Gabor Mezei | 9b6b5a0 | 2023-06-06 17:22:25 +0200 | [diff] [blame] | 1161 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Janos Follath | 82823b2 | 2023-07-27 12:25:05 +0100 | [diff] [blame] | 1162 | make |
Gabor Mezei | 9b6b5a0 | 2023-06-06 17:22:25 +0200 | [diff] [blame] | 1163 | |
| 1164 | msg "test: main suites (inc. selftests) (full config, ASan build)" |
| 1165 | make test |
| 1166 | |
| 1167 | msg "test: selftest (ASan build)" # ~ 10s |
| 1168 | programs/test/selftest |
| 1169 | |
| 1170 | msg "test: ssl-opt.sh (full config, ASan build)" |
| 1171 | tests/ssl-opt.sh |
| 1172 | |
| 1173 | msg "test: compat.sh (full config, ASan build)" |
| 1174 | tests/compat.sh |
| 1175 | |
| 1176 | msg "test: context-info.sh (full config, ASan build)" # ~ 15 sec |
| 1177 | tests/context-info.sh |
| 1178 | |
| 1179 | msg "test: check direct ECP dependencies in TLS and X.509" |
| 1180 | docs/architecture/psa-migration/syms.sh full |
| 1181 | |
| 1182 | # TODO: replace "mbedtls_ecp_curve" with "mbedtls_ecp" also for |
| 1183 | # "full-tls-external" once Issue6839 is completed |
| 1184 | not grep mbedtls_ecp_curve full-libmbedtls-external |
| 1185 | not grep mbedtls_ecp full-libmbedx509-external |
| 1186 | |
| 1187 | rm full-libmbedtls-external \ |
| 1188 | full-libmbedtls-modules \ |
| 1189 | full-libmbedx509-external \ |
| 1190 | full-libmbedx509-modules |
| 1191 | } |
| 1192 | |
Gabor Mezei | 6db6047 | 2023-07-05 16:38:42 +0200 | [diff] [blame] | 1193 | component_test_full_cmake_gcc_asan_new_bignum_test_hooks () { |
| 1194 | msg "build: full config, cmake, gcc, ASan" |
| 1195 | scripts/config.py full |
| 1196 | scripts/config.py set MBEDTLS_TEST_HOOKS |
Janos Follath | 2f04582 | 2023-07-31 10:57:16 +0100 | [diff] [blame] | 1197 | scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT |
Gabor Mezei | 6db6047 | 2023-07-05 16:38:42 +0200 | [diff] [blame] | 1198 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Janos Follath | 82823b2 | 2023-07-27 12:25:05 +0100 | [diff] [blame] | 1199 | make |
Gabor Mezei | 6db6047 | 2023-07-05 16:38:42 +0200 | [diff] [blame] | 1200 | |
| 1201 | msg "test: main suites (inc. selftests) (full config, ASan build)" |
| 1202 | make test |
| 1203 | |
| 1204 | msg "test: selftest (ASan build)" # ~ 10s |
| 1205 | programs/test/selftest |
| 1206 | } |
| 1207 | |
Ronald Cron | c3623db | 2020-10-29 10:51:32 +0100 | [diff] [blame] | 1208 | component_test_psa_crypto_key_id_encodes_owner () { |
Andrzej Kurek | 03e0146 | 2022-01-03 12:53:24 +0100 | [diff] [blame] | 1209 | msg "build: full config + PSA_CRYPTO_KEY_ID_ENCODES_OWNER, cmake, gcc, ASan" |
Ronald Cron | c3623db | 2020-10-29 10:51:32 +0100 | [diff] [blame] | 1210 | scripts/config.py full |
Ronald Cron | c3623db | 2020-10-29 10:51:32 +0100 | [diff] [blame] | 1211 | scripts/config.py set MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER |
| 1212 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1213 | make |
| 1214 | |
| 1215 | msg "test: full config - USE_PSA_CRYPTO + PSA_CRYPTO_KEY_ID_ENCODES_OWNER, cmake, gcc, ASan" |
| 1216 | make test |
| 1217 | } |
| 1218 | |
Gilles Peskine | a354867 | 2021-06-17 11:37:52 +0200 | [diff] [blame] | 1219 | # check_renamed_symbols HEADER LIB |
| 1220 | # Check that if HEADER contains '#define MACRO ...' then MACRO is not a symbol |
| 1221 | # name is LIB. |
| 1222 | check_renamed_symbols () { |
| 1223 | ! nm "$2" | sed 's/.* //' | |
| 1224 | grep -x -F "$(sed -n 's/^ *# *define *\([A-Z_a-z][0-9A-Z_a-z]*\)..*/\1/p' "$1")" |
| 1225 | } |
| 1226 | |
Gilles Peskine | d1dcfd5 | 2021-06-15 18:37:38 +0200 | [diff] [blame] | 1227 | component_build_psa_crypto_spm () { |
Andrzej Kurek | 03e0146 | 2022-01-03 12:53:24 +0100 | [diff] [blame] | 1228 | msg "build: full config + PSA_CRYPTO_KEY_ID_ENCODES_OWNER + PSA_CRYPTO_SPM, make, gcc" |
Gilles Peskine | d1dcfd5 | 2021-06-15 18:37:38 +0200 | [diff] [blame] | 1229 | scripts/config.py full |
Gilles Peskine | d1dcfd5 | 2021-06-15 18:37:38 +0200 | [diff] [blame] | 1230 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS |
| 1231 | scripts/config.py set MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER |
| 1232 | scripts/config.py set MBEDTLS_PSA_CRYPTO_SPM |
| 1233 | # We can only compile, not link, since our test and sample programs |
| 1234 | # aren't equipped for the modified names used when MBEDTLS_PSA_CRYPTO_SPM |
| 1235 | # is active. |
| 1236 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/spe' lib |
Gilles Peskine | a354867 | 2021-06-17 11:37:52 +0200 | [diff] [blame] | 1237 | |
| 1238 | # Check that if a symbol is renamed by crypto_spe.h, the non-renamed |
| 1239 | # version is not present. |
| 1240 | echo "Checking for renamed symbols in the library" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1241 | check_renamed_symbols tests/include/spe/crypto_spe.h library/libmbedcrypto.a |
Gilles Peskine | d1dcfd5 | 2021-06-15 18:37:38 +0200 | [diff] [blame] | 1242 | } |
| 1243 | |
Ronald Cron | 336678b | 2021-01-28 17:54:24 +0100 | [diff] [blame] | 1244 | component_test_psa_crypto_client () { |
| 1245 | msg "build: default config - PSA_CRYPTO_C + PSA_CRYPTO_CLIENT, make" |
| 1246 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_C |
| 1247 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C |
| 1248 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CLIENT |
Raef Coles | b4568c5 | 2022-09-28 17:11:42 +0100 | [diff] [blame] | 1249 | scripts/config.py unset MBEDTLS_LMS_C |
| 1250 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
Ronald Cron | 336678b | 2021-01-28 17:54:24 +0100 | [diff] [blame] | 1251 | make |
| 1252 | |
| 1253 | msg "test: default config - PSA_CRYPTO_C + PSA_CRYPTO_CLIENT, make" |
| 1254 | make test |
| 1255 | } |
| 1256 | |
Jaeden Amero | 424fa93 | 2021-05-14 08:34:32 +0100 | [diff] [blame] | 1257 | component_test_psa_crypto_rsa_no_genprime() { |
| 1258 | msg "build: default config minus MBEDTLS_GENPRIME" |
| 1259 | scripts/config.py unset MBEDTLS_GENPRIME |
| 1260 | make |
| 1261 | |
| 1262 | msg "test: default config minus MBEDTLS_GENPRIME" |
| 1263 | make test |
| 1264 | } |
| 1265 | |
Gilles Peskine | 782f411 | 2018-11-27 16:11:09 +0100 | [diff] [blame] | 1266 | component_test_ref_configs () { |
| 1267 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 9327fb3 | 2021-09-09 11:46:25 +0200 | [diff] [blame] | 1268 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 1269 | # want to re-generate generated files that depend on it, quite correctly. |
| 1270 | # However this doesn't work as the generation script expects a specific |
| 1271 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 1272 | # cmake can't know this, but re-generation is actually not necessary as |
David Horstmann | d64f4b2 | 2021-10-20 12:29:47 +0100 | [diff] [blame] | 1273 | # the generated files only depend on the list of available options, not |
Manuel Pégourié-Gonnard | 9327fb3 | 2021-09-09 11:46:25 +0200 | [diff] [blame] | 1274 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 1275 | # dependency resolution for generated files and just rely on them being |
David Horstmann | a8d1406 | 2021-10-20 17:14:23 +0100 | [diff] [blame] | 1276 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 1277 | CC=gcc cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1278 | tests/scripts/test-ref-configs.pl |
Gilles Peskine | 782f411 | 2018-11-27 16:11:09 +0100 | [diff] [blame] | 1279 | } |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 1280 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1281 | component_test_no_renegotiation () { |
| 1282 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1283 | scripts/config.py unset MBEDTLS_SSL_RENEGOTIATION |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1284 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1285 | make |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 1286 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1287 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 1288 | make test |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 1289 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1290 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1291 | tests/ssl-opt.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1292 | } |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 1293 | |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1294 | component_test_no_pem_no_fs () { |
| 1295 | msg "build: Default + !MBEDTLS_PEM_PARSE_C + !MBEDTLS_FS_IO (ASan build)" |
| 1296 | scripts/config.py unset MBEDTLS_PEM_PARSE_C |
| 1297 | scripts/config.py unset MBEDTLS_FS_IO |
| 1298 | scripts/config.py unset MBEDTLS_PSA_ITS_FILE_C # requires a filesystem |
| 1299 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C # requires PSA ITS |
| 1300 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1301 | make |
| 1302 | |
| 1303 | msg "test: !MBEDTLS_PEM_PARSE_C !MBEDTLS_FS_IO - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 1304 | make test |
| 1305 | |
| 1306 | msg "test: !MBEDTLS_PEM_PARSE_C !MBEDTLS_FS_IO - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1307 | tests/ssl-opt.sh |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1308 | } |
| 1309 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1310 | component_test_rsa_no_crt () { |
| 1311 | msg "build: Default + RSA_NO_CRT (ASan build)" # ~ 6 min |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1312 | scripts/config.py set MBEDTLS_RSA_NO_CRT |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1313 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1314 | make |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 1315 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1316 | msg "test: RSA_NO_CRT - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 1317 | make test |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 1318 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1319 | msg "test: RSA_NO_CRT - RSA-related part of ssl-opt.sh (ASan build)" # ~ 5s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1320 | tests/ssl-opt.sh -f RSA |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 1321 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1322 | msg "test: RSA_NO_CRT - RSA-related part of compat.sh (ASan build)" # ~ 3 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1323 | tests/compat.sh -t RSA |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 1324 | |
| 1325 | msg "test: RSA_NO_CRT - RSA-related part of context-info.sh (ASan build)" # ~ 15 sec |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1326 | tests/context-info.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1327 | } |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 1328 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1329 | component_test_no_ctr_drbg_classic () { |
| 1330 | msg "build: Full minus CTR_DRBG, classic crypto in TLS" |
Manuel Pégourié-Gonnard | 817e368 | 2020-05-28 12:55:10 +0200 | [diff] [blame] | 1331 | scripts/config.py full |
| 1332 | scripts/config.py unset MBEDTLS_CTR_DRBG_C |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1333 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 1334 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Manuel Pégourié-Gonnard | 817e368 | 2020-05-28 12:55:10 +0200 | [diff] [blame] | 1335 | |
| 1336 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1337 | make |
| 1338 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1339 | msg "test: Full minus CTR_DRBG, classic crypto - main suites" |
Manuel Pégourié-Gonnard | 817e368 | 2020-05-28 12:55:10 +0200 | [diff] [blame] | 1340 | make test |
| 1341 | |
Gilles Peskine | ba74904 | 2021-01-13 20:02:03 +0100 | [diff] [blame] | 1342 | # In this configuration, the TLS test programs use HMAC_DRBG. |
| 1343 | # The SSL tests are slow, so run a small subset, just enough to get |
| 1344 | # confidence that the SSL code copes with HMAC_DRBG. |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1345 | msg "test: Full minus CTR_DRBG, classic crypto - ssl-opt.sh (subset)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1346 | tests/ssl-opt.sh -f 'Default\|SSL async private.*delay=\|tickets enabled on server' |
Gilles Peskine | ba74904 | 2021-01-13 20:02:03 +0100 | [diff] [blame] | 1347 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1348 | msg "test: Full minus CTR_DRBG, classic crypto - compat.sh (subset)" |
Xiaofei Bai | 8b5c382 | 2021-12-02 08:43:35 +0000 | [diff] [blame] | 1349 | tests/compat.sh -m tls12 -t 'ECDSA PSK' -V NO -p OpenSSL |
Manuel Pégourié-Gonnard | 5b942dc | 2020-06-05 09:29:51 +0200 | [diff] [blame] | 1350 | } |
| 1351 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1352 | component_test_no_ctr_drbg_use_psa () { |
| 1353 | msg "build: Full minus CTR_DRBG, PSA crypto in TLS" |
Manuel Pégourié-Gonnard | 5b942dc | 2020-06-05 09:29:51 +0200 | [diff] [blame] | 1354 | scripts/config.py full |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1355 | scripts/config.py unset MBEDTLS_CTR_DRBG_C |
| 1356 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
Manuel Pégourié-Gonnard | 5b942dc | 2020-06-05 09:29:51 +0200 | [diff] [blame] | 1357 | |
| 1358 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1359 | make |
| 1360 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1361 | msg "test: Full minus CTR_DRBG, USE_PSA_CRYPTO - main suites" |
| 1362 | make test |
| 1363 | |
| 1364 | # In this configuration, the TLS test programs use HMAC_DRBG. |
| 1365 | # The SSL tests are slow, so run a small subset, just enough to get |
| 1366 | # confidence that the SSL code copes with HMAC_DRBG. |
| 1367 | msg "test: Full minus CTR_DRBG, USE_PSA_CRYPTO - ssl-opt.sh (subset)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1368 | tests/ssl-opt.sh -f 'Default\|SSL async private.*delay=\|tickets enabled on server' |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1369 | |
| 1370 | msg "test: Full minus CTR_DRBG, USE_PSA_CRYPTO - compat.sh (subset)" |
Xiaofei Bai | 8b5c382 | 2021-12-02 08:43:35 +0000 | [diff] [blame] | 1371 | tests/compat.sh -m tls12 -t 'ECDSA PSK' -V NO -p OpenSSL |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1372 | } |
| 1373 | |
| 1374 | component_test_no_hmac_drbg_classic () { |
| 1375 | msg "build: Full minus HMAC_DRBG, classic crypto in TLS" |
| 1376 | scripts/config.py full |
| 1377 | scripts/config.py unset MBEDTLS_HMAC_DRBG_C |
| 1378 | scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC # requires HMAC_DRBG |
| 1379 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 1380 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1381 | |
| 1382 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1383 | make |
| 1384 | |
| 1385 | msg "test: Full minus HMAC_DRBG, classic crypto - main suites" |
Manuel Pégourié-Gonnard | 5b942dc | 2020-06-05 09:29:51 +0200 | [diff] [blame] | 1386 | make test |
| 1387 | |
Gilles Peskine | a222434 | 2020-11-19 22:14:34 +0100 | [diff] [blame] | 1388 | # Normally our ECDSA implementation uses deterministic ECDSA. But since |
| 1389 | # HMAC_DRBG is disabled in this configuration, randomized ECDSA is used |
| 1390 | # instead. |
| 1391 | # Test SSL with non-deterministic ECDSA. Only test features that |
| 1392 | # might be affected by how ECDSA signature is performed. |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1393 | msg "test: Full minus HMAC_DRBG, classic crypto - ssl-opt.sh (subset)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1394 | tests/ssl-opt.sh -f 'Default\|SSL async private: sign' |
Gilles Peskine | a222434 | 2020-11-19 22:14:34 +0100 | [diff] [blame] | 1395 | |
| 1396 | # To save time, only test one protocol version, since this part of |
| 1397 | # the protocol is identical in (D)TLS up to 1.2. |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1398 | msg "test: Full minus HMAC_DRBG, classic crypto - compat.sh (ECDSA)" |
Xiaofei Bai | 8b5c382 | 2021-12-02 08:43:35 +0000 | [diff] [blame] | 1399 | tests/compat.sh -m tls12 -t 'ECDSA' |
Manuel Pégourié-Gonnard | 817e368 | 2020-05-28 12:55:10 +0200 | [diff] [blame] | 1400 | } |
| 1401 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1402 | component_test_no_hmac_drbg_use_psa () { |
| 1403 | msg "build: Full minus HMAC_DRBG, PSA crypto in TLS" |
| 1404 | scripts/config.py full |
| 1405 | scripts/config.py unset MBEDTLS_HMAC_DRBG_C |
| 1406 | scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC # requires HMAC_DRBG |
| 1407 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 1408 | |
| 1409 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1410 | make |
| 1411 | |
| 1412 | msg "test: Full minus HMAC_DRBG, USE_PSA_CRYPTO - main suites" |
| 1413 | make test |
| 1414 | |
| 1415 | # Normally our ECDSA implementation uses deterministic ECDSA. But since |
| 1416 | # HMAC_DRBG is disabled in this configuration, randomized ECDSA is used |
| 1417 | # instead. |
| 1418 | # Test SSL with non-deterministic ECDSA. Only test features that |
| 1419 | # might be affected by how ECDSA signature is performed. |
| 1420 | msg "test: Full minus HMAC_DRBG, USE_PSA_CRYPTO - ssl-opt.sh (subset)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1421 | tests/ssl-opt.sh -f 'Default\|SSL async private: sign' |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1422 | |
| 1423 | # To save time, only test one protocol version, since this part of |
| 1424 | # the protocol is identical in (D)TLS up to 1.2. |
| 1425 | msg "test: Full minus HMAC_DRBG, USE_PSA_CRYPTO - compat.sh (ECDSA)" |
Xiaofei Bai | 8b5c382 | 2021-12-02 08:43:35 +0000 | [diff] [blame] | 1426 | tests/compat.sh -m tls12 -t 'ECDSA' |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1427 | } |
| 1428 | |
| 1429 | component_test_psa_external_rng_no_drbg_classic () { |
| 1430 | msg "build: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto in TLS" |
| 1431 | scripts/config.py full |
| 1432 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 1433 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1434 | scripts/config.py set MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG |
Gilles Peskine | 38c12fd | 2021-02-08 21:02:53 +0100 | [diff] [blame] | 1435 | scripts/config.py unset MBEDTLS_ENTROPY_C |
| 1436 | scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED |
| 1437 | scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1438 | scripts/config.py unset MBEDTLS_CTR_DRBG_C |
| 1439 | scripts/config.py unset MBEDTLS_HMAC_DRBG_C |
| 1440 | scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC # requires HMAC_DRBG |
Gilles Peskine | 8eb2943 | 2021-02-03 20:07:11 +0100 | [diff] [blame] | 1441 | # When MBEDTLS_USE_PSA_CRYPTO is disabled and there is no DRBG, |
| 1442 | # the SSL test programs don't have an RNG and can't work. Explicitly |
| 1443 | # make them use the PSA RNG with -DMBEDTLS_TEST_USE_PSA_CRYPTO_RNG. |
| 1444 | make CFLAGS="$ASAN_CFLAGS -O2 -DMBEDTLS_TEST_USE_PSA_CRYPTO_RNG" LDFLAGS="$ASAN_CFLAGS" |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1445 | |
| 1446 | msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto - main suites" |
| 1447 | make test |
| 1448 | |
Gilles Peskine | 8eb2943 | 2021-02-03 20:07:11 +0100 | [diff] [blame] | 1449 | msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto - ssl-opt.sh (subset)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1450 | tests/ssl-opt.sh -f 'Default' |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | component_test_psa_external_rng_no_drbg_use_psa () { |
| 1454 | msg "build: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, PSA crypto in TLS" |
Gilles Peskine | c109b37 | 2020-11-23 17:39:04 +0100 | [diff] [blame] | 1455 | scripts/config.py full |
| 1456 | scripts/config.py set MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG |
Gilles Peskine | 38c12fd | 2021-02-08 21:02:53 +0100 | [diff] [blame] | 1457 | scripts/config.py unset MBEDTLS_ENTROPY_C |
| 1458 | scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED |
| 1459 | scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT |
Gilles Peskine | c109b37 | 2020-11-23 17:39:04 +0100 | [diff] [blame] | 1460 | scripts/config.py unset MBEDTLS_CTR_DRBG_C |
| 1461 | scripts/config.py unset MBEDTLS_HMAC_DRBG_C |
| 1462 | scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC # requires HMAC_DRBG |
Gilles Peskine | c109b37 | 2020-11-23 17:39:04 +0100 | [diff] [blame] | 1463 | make CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS" |
| 1464 | |
Gilles Peskine | 2747d7d | 2021-02-03 14:56:51 +0100 | [diff] [blame] | 1465 | msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, PSA crypto - main suites" |
Gilles Peskine | c109b37 | 2020-11-23 17:39:04 +0100 | [diff] [blame] | 1466 | make test |
| 1467 | |
Gilles Peskine | 8eb2943 | 2021-02-03 20:07:11 +0100 | [diff] [blame] | 1468 | msg "test: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, PSA crypto - ssl-opt.sh (subset)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1469 | tests/ssl-opt.sh -f 'Default\|opaque' |
Gilles Peskine | c109b37 | 2020-11-23 17:39:04 +0100 | [diff] [blame] | 1470 | } |
| 1471 | |
Gilles Peskine | 4bdb254 | 2023-04-28 19:25:25 +0200 | [diff] [blame] | 1472 | component_test_psa_external_rng_use_psa_crypto () { |
| 1473 | msg "build: full + PSA_CRYPTO_EXTERNAL_RNG + USE_PSA_CRYPTO minus CTR_DRBG" |
| 1474 | scripts/config.py full |
| 1475 | scripts/config.py set MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG |
| 1476 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 1477 | scripts/config.py unset MBEDTLS_CTR_DRBG_C |
| 1478 | make CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS" |
| 1479 | |
| 1480 | msg "test: full + PSA_CRYPTO_EXTERNAL_RNG + USE_PSA_CRYPTO minus CTR_DRBG" |
| 1481 | make test |
| 1482 | |
| 1483 | msg "test: full + PSA_CRYPTO_EXTERNAL_RNG + USE_PSA_CRYPTO minus CTR_DRBG" |
| 1484 | tests/ssl-opt.sh -f 'Default\|opaque' |
| 1485 | } |
| 1486 | |
Gilles Peskine | 801c433 | 2023-04-28 21:04:28 +0200 | [diff] [blame] | 1487 | component_test_psa_inject_entropy () { |
| 1488 | msg "build: full + MBEDTLS_PSA_INJECT_ENTROPY" |
| 1489 | scripts/config.py full |
| 1490 | scripts/config.py set MBEDTLS_PSA_INJECT_ENTROPY |
| 1491 | scripts/config.py set MBEDTLS_ENTROPY_NV_SEED |
| 1492 | scripts/config.py set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES |
| 1493 | scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT |
| 1494 | scripts/config.py unset MBEDTLS_PLATFORM_STD_NV_SEED_READ |
| 1495 | scripts/config.py unset MBEDTLS_PLATFORM_STD_NV_SEED_WRITE |
| 1496 | make CFLAGS="$ASAN_CFLAGS '-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'" LDFLAGS="$ASAN_CFLAGS" |
| 1497 | |
| 1498 | msg "test: full + MBEDTLS_PSA_INJECT_ENTROPY" |
| 1499 | make test |
| 1500 | } |
| 1501 | |
Andrzej Kurek | 06969fc | 2023-04-12 10:34:50 -0400 | [diff] [blame] | 1502 | component_test_sw_inet_pton () { |
| 1503 | msg "build: default plus MBEDTLS_TEST_SW_INET_PTON" |
| 1504 | |
| 1505 | # MBEDTLS_TEST_HOOKS required for x509_crt_parse_cn_inet_pton |
| 1506 | scripts/config.py set MBEDTLS_TEST_HOOKS |
| 1507 | make CFLAGS="-DMBEDTLS_TEST_SW_INET_PTON" |
| 1508 | |
| 1509 | msg "test: default plus MBEDTLS_TEST_SW_INET_PTON" |
| 1510 | make test |
| 1511 | } |
| 1512 | |
Manuel Pégourié-Gonnard | b9b630d | 2023-02-16 19:07:31 +0100 | [diff] [blame] | 1513 | component_test_crypto_full_md_light_only () { |
| 1514 | msg "build: crypto_full with only the light subset of MD" |
Przemek Stekiel | fe2367a | 2022-04-28 15:44:18 +0200 | [diff] [blame] | 1515 | scripts/config.py crypto_full |
Gilles Peskine | 884b462 | 2023-07-20 20:11:51 +0200 | [diff] [blame] | 1516 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_CONFIG |
Manuel Pégourié-Gonnard | b9b630d | 2023-02-16 19:07:31 +0100 | [diff] [blame] | 1517 | # Disable MD |
Przemek Stekiel | fe2367a | 2022-04-28 15:44:18 +0200 | [diff] [blame] | 1518 | scripts/config.py unset MBEDTLS_MD_C |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 1519 | # Disable direct dependencies of MD_C |
Przemek Stekiel | fe2367a | 2022-04-28 15:44:18 +0200 | [diff] [blame] | 1520 | scripts/config.py unset MBEDTLS_HKDF_C |
| 1521 | scripts/config.py unset MBEDTLS_HMAC_DRBG_C |
Nick Child | 89e82e1 | 2022-11-09 10:36:10 -0600 | [diff] [blame] | 1522 | scripts/config.py unset MBEDTLS_PKCS7_C |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 1523 | # Disable indirect dependencies of MD_C |
Manuel Pégourié-Gonnard | b9b630d | 2023-02-16 19:07:31 +0100 | [diff] [blame] | 1524 | scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC # needs HMAC_DRBG |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 1525 | # Disable things that would auto-enable MD_C |
| 1526 | scripts/config.py unset MBEDTLS_PKCS5_C |
| 1527 | |
Manuel Pégourié-Gonnard | 1b5ffc6 | 2023-03-14 10:11:20 +0100 | [diff] [blame] | 1528 | # Note: MD-light is auto-enabled in build_info.h by modules that need it, |
| 1529 | # which we haven't disabled, so no need to explicitly enable it. |
| 1530 | make CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" |
Przemek Stekiel | fe2367a | 2022-04-28 15:44:18 +0200 | [diff] [blame] | 1531 | |
Manuel Pégourié-Gonnard | 0d41521 | 2023-02-23 13:02:13 +0100 | [diff] [blame] | 1532 | # Make sure we don't have the HMAC functions, but the hashing functions |
Manuel Pégourié-Gonnard | b9b630d | 2023-02-16 19:07:31 +0100 | [diff] [blame] | 1533 | not grep mbedtls_md_hmac library/md.o |
Manuel Pégourié-Gonnard | 0d41521 | 2023-02-23 13:02:13 +0100 | [diff] [blame] | 1534 | grep mbedtls_md library/md.o |
Manuel Pégourié-Gonnard | b9b630d | 2023-02-16 19:07:31 +0100 | [diff] [blame] | 1535 | |
| 1536 | msg "test: crypto_full with only the light subset of MD" |
Przemek Stekiel | fe2367a | 2022-04-28 15:44:18 +0200 | [diff] [blame] | 1537 | make test |
| 1538 | } |
| 1539 | |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1540 | component_test_full_no_cipher () { |
| 1541 | msg "build: full minus CIPHER" |
| 1542 | scripts/config.py full |
| 1543 | scripts/config.py unset MBEDTLS_CIPHER_C |
Gilles Peskine | 9b8dead | 2023-08-09 19:48:42 +0200 | [diff] [blame] | 1544 | # Don't pull in cipher via PSA mechanisms |
| 1545 | # (currently ignored anyway because we completely disable PSA) |
| 1546 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_CONFIG |
Przemek Stekiel | da5f483 | 2022-05-12 09:46:29 +0200 | [diff] [blame] | 1547 | # Direct dependencies |
| 1548 | scripts/config.py unset MBEDTLS_CCM_C |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1549 | scripts/config.py unset MBEDTLS_CMAC_C |
Przemek Stekiel | da5f483 | 2022-05-12 09:46:29 +0200 | [diff] [blame] | 1550 | scripts/config.py unset MBEDTLS_GCM_C |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1551 | scripts/config.py unset MBEDTLS_NIST_KW_C |
| 1552 | scripts/config.py unset MBEDTLS_PKCS12_C |
| 1553 | scripts/config.py unset MBEDTLS_PKCS5_C |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1554 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_C |
| 1555 | scripts/config.py unset MBEDTLS_SSL_TLS_C |
| 1556 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | da5f483 | 2022-05-12 09:46:29 +0200 | [diff] [blame] | 1557 | # Indirect dependencies |
| 1558 | scripts/config.py unset MBEDTLS_SSL_CLI_C |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1559 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C |
| 1560 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1561 | scripts/config.py unset MBEDTLS_SSL_DTLS_ANTI_REPLAY |
| 1562 | scripts/config.py unset MBEDTLS_SSL_DTLS_CONNECTION_ID |
Dave Rodgman | 1df7070 | 2022-10-26 17:08:54 +0100 | [diff] [blame] | 1563 | scripts/config.py unset MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT |
Przemek Stekiel | da5f483 | 2022-05-12 09:46:29 +0200 | [diff] [blame] | 1564 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 1565 | scripts/config.py unset MBEDTLS_SSL_SRV_C |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1566 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Raef Coles | a7e03ad | 2022-09-28 09:32:48 +0100 | [diff] [blame] | 1567 | scripts/config.py unset MBEDTLS_LMS_C |
Raef Coles | 47bccb7 | 2022-09-28 12:00:20 +0100 | [diff] [blame] | 1568 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
Przemek Stekiel | 10f3a60 | 2022-05-02 10:55:33 +0200 | [diff] [blame] | 1569 | make |
| 1570 | |
| 1571 | msg "test: full minus CIPHER" |
| 1572 | make test |
| 1573 | } |
| 1574 | |
Valerio Setti | e1655b8 | 2023-01-03 15:35:25 +0100 | [diff] [blame] | 1575 | component_test_full_no_bignum () { |
| 1576 | msg "build: full minus bignum" |
| 1577 | scripts/config.py full |
| 1578 | scripts/config.py unset MBEDTLS_BIGNUM_C |
| 1579 | # Direct dependencies of bignum |
| 1580 | scripts/config.py unset MBEDTLS_ECP_C |
| 1581 | scripts/config.py unset MBEDTLS_RSA_C |
| 1582 | scripts/config.py unset MBEDTLS_DHM_C |
| 1583 | # Direct dependencies of ECP |
| 1584 | scripts/config.py unset MBEDTLS_ECDH_C |
| 1585 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 1586 | scripts/config.py unset MBEDTLS_ECJPAKE_C |
| 1587 | scripts/config.py unset MBEDTLS_ECP_RESTARTABLE |
Valerio Setti | 22d0a79 | 2023-06-14 17:23:19 +0200 | [diff] [blame] | 1588 | # Disable what auto-enables ECP_LIGHT |
| 1589 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_EXTENDED |
| 1590 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_COMPRESSED |
Valerio Setti | e1655b8 | 2023-01-03 15:35:25 +0100 | [diff] [blame] | 1591 | # Indirect dependencies of ECP |
| 1592 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 1593 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 1594 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED |
| 1595 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 1596 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 1597 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED |
| 1598 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 1599 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
| 1600 | # Direct dependencies of DHM |
| 1601 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED |
| 1602 | # Direct dependencies of RSA |
| 1603 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 1604 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED |
| 1605 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
| 1606 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 1607 | # PK and its dependencies |
| 1608 | scripts/config.py unset MBEDTLS_PK_C |
| 1609 | scripts/config.py unset MBEDTLS_PK_PARSE_C |
| 1610 | scripts/config.py unset MBEDTLS_PK_WRITE_C |
| 1611 | scripts/config.py unset MBEDTLS_X509_USE_C |
| 1612 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 1613 | scripts/config.py unset MBEDTLS_X509_CRL_PARSE_C |
| 1614 | scripts/config.py unset MBEDTLS_X509_CSR_PARSE_C |
| 1615 | scripts/config.py unset MBEDTLS_X509_CREATE_C |
| 1616 | scripts/config.py unset MBEDTLS_X509_CRT_WRITE_C |
| 1617 | scripts/config.py unset MBEDTLS_X509_CSR_WRITE_C |
| 1618 | scripts/config.py unset MBEDTLS_PKCS7_C |
| 1619 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
| 1620 | scripts/config.py unset MBEDTLS_SSL_ASYNC_PRIVATE |
| 1621 | scripts/config.py unset MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK |
| 1622 | |
| 1623 | make |
| 1624 | |
| 1625 | msg "test: full minus bignum" |
| 1626 | make test |
| 1627 | } |
| 1628 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1629 | component_test_tls1_2_default_stream_cipher_only () { |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1630 | msg "build: default with only stream cipher" |
| 1631 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1632 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1633 | scripts/config.py unset MBEDTLS_GCM_C |
| 1634 | scripts/config.py unset MBEDTLS_CCM_C |
| 1635 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1636 | # Disable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1637 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1638 | # Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1639 | scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1640 | # Enable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
| 1641 | scripts/config.py set MBEDTLS_CIPHER_NULL_CIPHER |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1642 | # Modules that depend on AEAD |
Przemek Stekiel | d582a01 | 2022-09-28 07:59:01 +0200 | [diff] [blame] | 1643 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 52a428b | 2022-10-10 08:47:13 +0200 | [diff] [blame] | 1644 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1645 | |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1646 | make |
| 1647 | |
| 1648 | msg "test: default with only stream cipher" |
| 1649 | make test |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1650 | |
| 1651 | # Not running ssl-opt.sh because most tests require a non-NULL ciphersuite. |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1652 | } |
| 1653 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1654 | component_test_tls1_2_default_stream_cipher_only_use_psa () { |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1655 | msg "build: default with only stream cipher use psa" |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1656 | |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1657 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1658 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1659 | scripts/config.py unset MBEDTLS_GCM_C |
| 1660 | scripts/config.py unset MBEDTLS_CCM_C |
| 1661 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1662 | # Disable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1663 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1664 | # Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1665 | scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1666 | # Enable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
| 1667 | scripts/config.py set MBEDTLS_CIPHER_NULL_CIPHER |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1668 | # Modules that depend on AEAD |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1669 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 52a428b | 2022-10-10 08:47:13 +0200 | [diff] [blame] | 1670 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1671 | |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1672 | make |
| 1673 | |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1674 | msg "test: default with only stream cipher use psa" |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1675 | make test |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1676 | |
| 1677 | # Not running ssl-opt.sh because most tests require a non-NULL ciphersuite. |
Przemek Stekiel | 9550c05 | 2022-09-28 09:51:55 +0200 | [diff] [blame] | 1678 | } |
Przemek Stekiel | 11c362a | 2022-09-27 13:34:31 +0200 | [diff] [blame] | 1679 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1680 | component_test_tls1_2_default_cbc_legacy_cipher_only () { |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1681 | msg "build: default with only CBC-legacy cipher" |
| 1682 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1683 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1684 | scripts/config.py unset MBEDTLS_GCM_C |
| 1685 | scripts/config.py unset MBEDTLS_CCM_C |
| 1686 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1687 | # Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 1688 | scripts/config.py set MBEDTLS_CIPHER_MODE_CBC |
| 1689 | # Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1690 | scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1691 | # Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1692 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1693 | # Modules that depend on AEAD |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1694 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 52a428b | 2022-10-10 08:47:13 +0200 | [diff] [blame] | 1695 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1696 | |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1697 | make |
| 1698 | |
| 1699 | msg "test: default with only CBC-legacy cipher" |
| 1700 | make test |
Przemek Stekiel | 48a6a66 | 2022-09-29 15:22:01 +0200 | [diff] [blame] | 1701 | |
| 1702 | msg "test: default with only CBC-legacy cipher - ssl-opt.sh (subset)" |
| 1703 | tests/ssl-opt.sh -f "TLS 1.2" |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1704 | } |
| 1705 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1706 | component_test_tls1_2_deafult_cbc_legacy_cipher_only_use_psa () { |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1707 | msg "build: default with only CBC-legacy cipher use psa" |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1708 | |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1709 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1710 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1711 | scripts/config.py unset MBEDTLS_GCM_C |
| 1712 | scripts/config.py unset MBEDTLS_CCM_C |
| 1713 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1714 | # Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 1715 | scripts/config.py set MBEDTLS_CIPHER_MODE_CBC |
| 1716 | # Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1717 | scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1718 | # Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1719 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1720 | # Modules that depend on AEAD |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1721 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 52a428b | 2022-10-10 08:47:13 +0200 | [diff] [blame] | 1722 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1723 | |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1724 | make |
| 1725 | |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1726 | msg "test: default with only CBC-legacy cipher use psa" |
| 1727 | make test |
Przemek Stekiel | 48a6a66 | 2022-09-29 15:22:01 +0200 | [diff] [blame] | 1728 | |
| 1729 | msg "test: default with only CBC-legacy cipher use psa - ssl-opt.sh (subset)" |
| 1730 | tests/ssl-opt.sh -f "TLS 1.2" |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1731 | } |
| 1732 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1733 | component_test_tls1_2_default_cbc_legacy_cbc_etm_cipher_only () { |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1734 | msg "build: default with only CBC-legacy and CBC-EtM ciphers" |
| 1735 | |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1736 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1737 | scripts/config.py unset MBEDTLS_GCM_C |
| 1738 | scripts/config.py unset MBEDTLS_CCM_C |
| 1739 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1740 | # Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 1741 | scripts/config.py set MBEDTLS_CIPHER_MODE_CBC |
| 1742 | # Enable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
| 1743 | scripts/config.py set MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 1744 | # Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1745 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1746 | # Modules that depend on AEAD |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1747 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 52a428b | 2022-10-10 08:47:13 +0200 | [diff] [blame] | 1748 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1749 | |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1750 | make |
| 1751 | |
| 1752 | msg "test: default with only CBC-legacy and CBC-EtM ciphers" |
| 1753 | make test |
Przemek Stekiel | 48a6a66 | 2022-09-29 15:22:01 +0200 | [diff] [blame] | 1754 | |
| 1755 | msg "test: default with only CBC-legacy and CBC-EtM ciphers - ssl-opt.sh (subset)" |
| 1756 | tests/ssl-opt.sh -f "TLS 1.2" |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1757 | } |
| 1758 | |
Przemek Stekiel | 48a6a66 | 2022-09-29 15:22:01 +0200 | [diff] [blame] | 1759 | component_test_tls1_2_default_cbc_legacy_cbc_etm_cipher_only_use_psa () { |
| 1760 | msg "build: default with only CBC-legacy and CBC-EtM ciphers use psa" |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1761 | |
| 1762 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1763 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1764 | scripts/config.py unset MBEDTLS_GCM_C |
| 1765 | scripts/config.py unset MBEDTLS_CCM_C |
| 1766 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Przemek Stekiel | 68db0d2 | 2022-09-29 08:32:25 +0200 | [diff] [blame] | 1767 | # Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 1768 | scripts/config.py set MBEDTLS_CIPHER_MODE_CBC |
| 1769 | # Enable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
| 1770 | scripts/config.py set MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 1771 | # Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1772 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
Przemek Stekiel | 6a5cc74 | 2022-10-03 09:04:16 +0200 | [diff] [blame] | 1773 | # Modules that depend on AEAD |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1774 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 52a428b | 2022-10-10 08:47:13 +0200 | [diff] [blame] | 1775 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1776 | |
Przemek Stekiel | 0cc3466 | 2022-09-28 12:06:57 +0200 | [diff] [blame] | 1777 | make |
| 1778 | |
Przemek Stekiel | 48a6a66 | 2022-09-29 15:22:01 +0200 | [diff] [blame] | 1779 | msg "test: default with only CBC-legacy and CBC-EtM ciphers use psa" |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1780 | make test |
Przemek Stekiel | 48a6a66 | 2022-09-29 15:22:01 +0200 | [diff] [blame] | 1781 | |
| 1782 | msg "test: default with only CBC-legacy and CBC-EtM ciphers use psa - ssl-opt.sh (subset)" |
| 1783 | tests/ssl-opt.sh -f "TLS 1.2" |
Przemek Stekiel | b0de1c0 | 2022-09-28 10:23:22 +0200 | [diff] [blame] | 1784 | } |
| 1785 | |
Valerio Setti | 9f0ec53 | 2022-11-08 13:03:24 +0100 | [diff] [blame] | 1786 | # We're not aware of any other (open source) implementation of EC J-PAKE in TLS |
| 1787 | # that we could use for interop testing. However, we now have sort of two |
| 1788 | # implementations ourselves: one using PSA, the other not. At least test that |
| 1789 | # these two interoperate with each other. |
| 1790 | component_test_tls1_2_ecjpake_compatibility() { |
| 1791 | msg "build: TLS1.2 server+client w/ EC-JPAKE w/o USE_PSA" |
| 1792 | scripts/config.py set MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED |
Gilles Peskine | edc8456 | 2023-09-20 15:03:18 +0200 | [diff] [blame] | 1793 | # Explicitly make lib first to avoid a race condition: |
| 1794 | # https://github.com/Mbed-TLS/mbedtls/issues/8229 |
| 1795 | make lib |
Valerio Setti | 9f0ec53 | 2022-11-08 13:03:24 +0100 | [diff] [blame] | 1796 | make -C programs ssl/ssl_server2 ssl/ssl_client2 |
| 1797 | cp programs/ssl/ssl_server2 s2_no_use_psa |
| 1798 | cp programs/ssl/ssl_client2 c2_no_use_psa |
| 1799 | |
| 1800 | msg "build: TLS1.2 server+client w/ EC-JPAKE w/ USE_PSA" |
| 1801 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 1802 | make clean |
Gilles Peskine | edc8456 | 2023-09-20 15:03:18 +0200 | [diff] [blame] | 1803 | make lib |
Valerio Setti | 9f0ec53 | 2022-11-08 13:03:24 +0100 | [diff] [blame] | 1804 | make -C programs ssl/ssl_server2 ssl/ssl_client2 |
| 1805 | make -C programs test/udp_proxy test/query_compile_time_config |
| 1806 | |
Valerio Setti | 70e0290 | 2022-12-02 16:21:56 +0100 | [diff] [blame] | 1807 | msg "test: server w/o USE_PSA - client w/ USE_PSA, text password" |
| 1808 | P_SRV=../s2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: working, TLS" |
| 1809 | msg "test: server w/o USE_PSA - client w/ USE_PSA, opaque password" |
| 1810 | P_SRV=../s2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: opaque password client only, working, TLS" |
| 1811 | msg "test: client w/o USE_PSA - server w/ USE_PSA, text password" |
| 1812 | P_CLI=../c2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: working, TLS" |
| 1813 | msg "test: client w/o USE_PSA - server w/ USE_PSA, opaque password" |
| 1814 | P_CLI=../c2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: opaque password server only, working, TLS" |
Valerio Setti | 9f0ec53 | 2022-11-08 13:03:24 +0100 | [diff] [blame] | 1815 | |
| 1816 | rm s2_no_use_psa c2_no_use_psa |
| 1817 | } |
| 1818 | |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1819 | component_test_everest () { |
| 1820 | msg "build: Everest ECDH context (ASan build)" # ~ 6 min |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1821 | scripts/config.py set MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED |
| 1822 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1823 | make |
| 1824 | |
| 1825 | msg "test: Everest ECDH context - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 1826 | make test |
| 1827 | |
| 1828 | msg "test: Everest ECDH context - ECDH-related part of ssl-opt.sh (ASan build)" # ~ 5s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1829 | tests/ssl-opt.sh -f ECDH |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1830 | |
| 1831 | msg "test: Everest ECDH context - compat.sh with some ECDH ciphersuites (ASan build)" # ~ 3 min |
| 1832 | # Exclude some symmetric ciphers that are redundant here to gain time. |
Manuel Pégourié-Gonnard | 296787f | 2022-04-06 13:28:27 +0200 | [diff] [blame] | 1833 | tests/compat.sh -f ECDH -V NO -e 'ARIA\|CAMELLIA\|CHACHA' |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1834 | } |
| 1835 | |
Gilles Peskine | d3beca9 | 2020-07-03 00:15:37 +0200 | [diff] [blame] | 1836 | component_test_everest_curve25519_only () { |
| 1837 | msg "build: Everest ECDH context, only Curve25519" # ~ 6 min |
Gilles Peskine | d3beca9 | 2020-07-03 00:15:37 +0200 | [diff] [blame] | 1838 | scripts/config.py set MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED |
| 1839 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 1840 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 1841 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
TRodziewicz | 7c1d41d | 2021-04-23 13:33:44 +0200 | [diff] [blame] | 1842 | scripts/config.py unset MBEDTLS_ECJPAKE_C |
Gilles Peskine | d3beca9 | 2020-07-03 00:15:37 +0200 | [diff] [blame] | 1843 | # Disable all curves |
Valerio Setti | 2e0275d | 2023-07-28 16:33:13 +0200 | [diff] [blame] | 1844 | scripts/config.py unset-all "MBEDTLS_ECP_DP_[0-9A-Z_a-z]*_ENABLED" |
Gilles Peskine | d3beca9 | 2020-07-03 00:15:37 +0200 | [diff] [blame] | 1845 | scripts/config.py set MBEDTLS_ECP_DP_CURVE25519_ENABLED |
| 1846 | |
| 1847 | make CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS" |
| 1848 | |
| 1849 | msg "test: Everest ECDH context, only Curve25519" # ~ 50s |
| 1850 | make test |
| 1851 | } |
| 1852 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1853 | component_test_small_ssl_out_content_len () { |
| 1854 | msg "build: small SSL_OUT_CONTENT_LEN (ASan build)" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1855 | scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 16384 |
| 1856 | scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 4096 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1857 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1858 | make |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 1859 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1860 | msg "test: small SSL_OUT_CONTENT_LEN - ssl-opt.sh MFL and large packet tests" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1861 | tests/ssl-opt.sh -f "Max fragment\|Large packet" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1862 | } |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1863 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1864 | component_test_small_ssl_in_content_len () { |
| 1865 | msg "build: small SSL_IN_CONTENT_LEN (ASan build)" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1866 | scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 4096 |
| 1867 | scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 16384 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1868 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1869 | make |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1870 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1871 | msg "test: small SSL_IN_CONTENT_LEN - ssl-opt.sh MFL tests" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1872 | tests/ssl-opt.sh -f "Max fragment" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1873 | } |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1874 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1875 | component_test_small_ssl_dtls_max_buffering () { |
| 1876 | msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1877 | scripts/config.py set MBEDTLS_SSL_DTLS_MAX_BUFFERING 1000 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1878 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1879 | make |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 1880 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1881 | msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0 - ssl-opt.sh specific reordering test" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1882 | tests/ssl-opt.sh -f "DTLS reordering: Buffer out-of-order hs msg before reassembling next, free buffered msg" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1883 | } |
Hanno Becker | 2f5aa4c | 2018-08-24 14:43:44 +0100 | [diff] [blame] | 1884 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1885 | component_test_small_mbedtls_ssl_dtls_max_buffering () { |
| 1886 | msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1" |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 1887 | scripts/config.py set MBEDTLS_SSL_DTLS_MAX_BUFFERING 190 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1888 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 1889 | make |
Hanno Becker | 2f5aa4c | 2018-08-24 14:43:44 +0100 | [diff] [blame] | 1890 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1891 | msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1 - ssl-opt.sh specific reordering test" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1892 | tests/ssl-opt.sh -f "DTLS reordering: Buffer encrypted Finished message, drop for fragmented NewSessionTicket" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1893 | } |
Hanno Becker | 2f5aa4c | 2018-08-24 14:43:44 +0100 | [diff] [blame] | 1894 | |
Gilles Peskine | 75cc771 | 2019-09-06 19:47:17 +0200 | [diff] [blame] | 1895 | component_test_psa_collect_statuses () { |
| 1896 | msg "build+test: psa_collect_statuses" # ~30s |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1897 | scripts/config.py full |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1898 | tests/scripts/psa_collect_statuses.py |
Gilles Peskine | 75cc771 | 2019-09-06 19:47:17 +0200 | [diff] [blame] | 1899 | # Check that psa_crypto_init() succeeded at least once |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1900 | grep -q '^0:psa_crypto_init:' tests/statuses.log |
Gilles Peskine | 75cc771 | 2019-09-06 19:47:17 +0200 | [diff] [blame] | 1901 | rm -f tests/statuses.log |
| 1902 | } |
| 1903 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1904 | component_test_full_cmake_clang () { |
| 1905 | msg "build: cmake, full config, clang" # ~ 50s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 1906 | scripts/config.py full |
Gilles Peskine | da6017c | 2022-10-30 21:02:40 +0100 | [diff] [blame] | 1907 | CC=clang CXX=clang cmake -D CMAKE_BUILD_TYPE:String=Release -D ENABLE_TESTING=On -D TEST_CPP=1 . |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1908 | make |
Hanno Becker | 2f5aa4c | 2018-08-24 14:43:44 +0100 | [diff] [blame] | 1909 | |
k-stachowiak | 0291cb7 | 2019-06-26 15:52:12 +0200 | [diff] [blame] | 1910 | msg "test: main suites (full config, clang)" # ~ 5s |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1911 | make test |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 1912 | |
Gilles Peskine | da6017c | 2022-10-30 21:02:40 +0100 | [diff] [blame] | 1913 | msg "test: cpp_dummy_build (full config, clang)" # ~ 1s |
| 1914 | programs/test/cpp_dummy_build |
| 1915 | |
k-stachowiak | 0291cb7 | 2019-06-26 15:52:12 +0200 | [diff] [blame] | 1916 | msg "test: psa_constant_names (full config, clang)" # ~ 1s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1917 | tests/scripts/test_psa_constant_names.py |
Gilles Peskine | 69e8f7f | 2020-02-26 19:51:43 +0100 | [diff] [blame] | 1918 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1919 | msg "test: ssl-opt.sh default, ECJPAKE, SSL async (full config)" # ~ 1s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 1920 | tests/ssl-opt.sh -f 'Default\|ECJPAKE\|SSL async private' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 1921 | |
Manuel Pégourié-Gonnard | 296787f | 2022-04-06 13:28:27 +0200 | [diff] [blame] | 1922 | msg "test: compat.sh NULL (full config)" # ~ 2 min |
Manuel Pégourié-Gonnard | c572246 | 2022-12-19 11:42:12 +0100 | [diff] [blame] | 1923 | env OPENSSL="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_LEGACY_CLI" GNUTLS_SERV="$GNUTLS_LEGACY_SERV" tests/compat.sh -e '^$' -f 'NULL' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 1924 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1925 | msg "test: compat.sh ARIA + ChachaPoly" |
Manuel Pégourié-Gonnard | c572246 | 2022-12-19 11:42:12 +0100 | [diff] [blame] | 1926 | env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA' |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 1927 | } |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 1928 | |
Gilles Peskine | 0c67160 | 2022-11-29 16:01:41 +0100 | [diff] [blame] | 1929 | skip_suites_without_constant_flow () { |
| 1930 | # Skip the test suites that don't have any constant-flow annotations. |
| 1931 | # This will need to be adjusted if we ever start declaring things as |
| 1932 | # secret from macros or functions inside tests/include or tests/src. |
| 1933 | SKIP_TEST_SUITES=$( |
| 1934 | git -C tests/suites grep -L TEST_CF_ 'test_suite_*.function' | |
| 1935 | sed 's/test_suite_//; s/\.function$//' | |
| 1936 | tr '\n' ,) |
| 1937 | export SKIP_TEST_SUITES |
| 1938 | } |
| 1939 | |
Dave Rodgman | 246210e | 2023-07-31 18:07:44 +0100 | [diff] [blame] | 1940 | skip_all_except_given_suite () { |
| 1941 | # Skip all but the given test suite |
| 1942 | SKIP_TEST_SUITES=$( |
| 1943 | ls -1 tests/suites/test_suite_*.function | |
| 1944 | grep -v $1.function | |
| 1945 | sed 's/tests.suites.test_suite_//; s/\.function$//' | |
| 1946 | tr '\n' ,) |
| 1947 | export SKIP_TEST_SUITES |
| 1948 | } |
| 1949 | |
Manuel Pégourié-Gonnard | 6240def | 2020-07-10 09:35:54 +0200 | [diff] [blame] | 1950 | component_test_memsan_constant_flow () { |
Manuel Pégourié-Gonnard | 0b2112d | 2020-07-22 11:09:28 +0200 | [diff] [blame] | 1951 | # This tests both (1) accesses to undefined memory, and (2) branches or |
| 1952 | # memory access depending on secret values. To distinguish between those: |
| 1953 | # - unset MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN - does the failure persist? |
| 1954 | # - or alternatively, change the build type to MemSanDbg, which enables |
| 1955 | # origin tracking and nicer stack traces (which are useful for debugging |
| 1956 | # anyway), and check if the origin was TEST_CF_SECRET() or something else. |
Neil Armstrong | 0ab7a23 | 2022-03-18 09:57:32 +0100 | [diff] [blame] | 1957 | msg "build: cmake MSan (clang), full config minus MBEDTLS_USE_PSA_CRYPTO with constant flow testing" |
| 1958 | scripts/config.py full |
| 1959 | scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN |
| 1960 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 1961 | scripts/config.py unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 1962 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 1963 | make |
| 1964 | |
| 1965 | msg "test: main suites (full minus MBEDTLS_USE_PSA_CRYPTO, Msan + constant flow)" |
| 1966 | make test |
| 1967 | } |
| 1968 | |
| 1969 | component_test_memsan_constant_flow_psa () { |
| 1970 | # This tests both (1) accesses to undefined memory, and (2) branches or |
| 1971 | # memory access depending on secret values. To distinguish between those: |
| 1972 | # - unset MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN - does the failure persist? |
| 1973 | # - or alternatively, change the build type to MemSanDbg, which enables |
| 1974 | # origin tracking and nicer stack traces (which are useful for debugging |
| 1975 | # anyway), and check if the origin was TEST_CF_SECRET() or something else. |
Manuel Pégourié-Gonnard | 0b2112d | 2020-07-22 11:09:28 +0200 | [diff] [blame] | 1976 | msg "build: cmake MSan (clang), full config with constant flow testing" |
Manuel Pégourié-Gonnard | 6240def | 2020-07-10 09:35:54 +0200 | [diff] [blame] | 1977 | scripts/config.py full |
| 1978 | scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN |
| 1979 | scripts/config.py unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 1980 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 1981 | make |
| 1982 | |
Manuel Pégourié-Gonnard | 0b2112d | 2020-07-22 11:09:28 +0200 | [diff] [blame] | 1983 | msg "test: main suites (Msan + constant flow)" |
Manuel Pégourié-Gonnard | 6240def | 2020-07-10 09:35:54 +0200 | [diff] [blame] | 1984 | make test |
| 1985 | } |
| 1986 | |
Manuel Pégourié-Gonnard | 73afa37 | 2020-08-19 10:27:38 +0200 | [diff] [blame] | 1987 | component_test_valgrind_constant_flow () { |
| 1988 | # This tests both (1) everything that valgrind's memcheck usually checks |
| 1989 | # (heap buffer overflows, use of uninitialized memory, use-after-free, |
| 1990 | # etc.) and (2) branches or memory access depending on secret values, |
| 1991 | # which will be reported as uninitialized memory. To distinguish between |
| 1992 | # secret and actually uninitialized: |
| 1993 | # - unset MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND - does the failure persist? |
| 1994 | # - or alternatively, build with debug info and manually run the offending |
| 1995 | # test suite with valgrind --track-origins=yes, then check if the origin |
| 1996 | # was TEST_CF_SECRET() or something else. |
Neil Armstrong | 0ab7a23 | 2022-03-18 09:57:32 +0100 | [diff] [blame] | 1997 | msg "build: cmake release GCC, full config minus MBEDTLS_USE_PSA_CRYPTO with constant flow testing" |
| 1998 | scripts/config.py full |
| 1999 | scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND |
| 2000 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Gilles Peskine | 0c67160 | 2022-11-29 16:01:41 +0100 | [diff] [blame] | 2001 | skip_suites_without_constant_flow |
Neil Armstrong | 0ab7a23 | 2022-03-18 09:57:32 +0100 | [diff] [blame] | 2002 | cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 2003 | make |
| 2004 | |
| 2005 | # this only shows a summary of the results (how many of each type) |
| 2006 | # details are left in Testing/<date>/DynamicAnalysis.xml |
Gilles Peskine | 0c67160 | 2022-11-29 16:01:41 +0100 | [diff] [blame] | 2007 | msg "test: some suites (full minus MBEDTLS_USE_PSA_CRYPTO, valgrind + constant flow)" |
Neil Armstrong | 0ab7a23 | 2022-03-18 09:57:32 +0100 | [diff] [blame] | 2008 | make memcheck |
Dave Rodgman | 246210e | 2023-07-31 18:07:44 +0100 | [diff] [blame] | 2009 | |
| 2010 | # Test asm path in constant time module - by default, it will test the plain C |
| 2011 | # path under Valgrind or Memsan. Running only the constant_time tests is fast (<1s) |
| 2012 | msg "test: valgrind asm constant_time" |
| 2013 | scripts/config.py --force set MBEDTLS_TEST_CONSTANT_FLOW_ASM |
| 2014 | skip_all_except_given_suite test_suite_constant_time |
| 2015 | cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 2016 | make clean |
| 2017 | make |
| 2018 | make memcheck |
Neil Armstrong | 0ab7a23 | 2022-03-18 09:57:32 +0100 | [diff] [blame] | 2019 | } |
| 2020 | |
| 2021 | component_test_valgrind_constant_flow_psa () { |
| 2022 | # This tests both (1) everything that valgrind's memcheck usually checks |
| 2023 | # (heap buffer overflows, use of uninitialized memory, use-after-free, |
| 2024 | # etc.) and (2) branches or memory access depending on secret values, |
| 2025 | # which will be reported as uninitialized memory. To distinguish between |
| 2026 | # secret and actually uninitialized: |
| 2027 | # - unset MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND - does the failure persist? |
| 2028 | # - or alternatively, build with debug info and manually run the offending |
| 2029 | # test suite with valgrind --track-origins=yes, then check if the origin |
| 2030 | # was TEST_CF_SECRET() or something else. |
Manuel Pégourié-Gonnard | 73afa37 | 2020-08-19 10:27:38 +0200 | [diff] [blame] | 2031 | msg "build: cmake release GCC, full config with constant flow testing" |
| 2032 | scripts/config.py full |
| 2033 | scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND |
Gilles Peskine | 0c67160 | 2022-11-29 16:01:41 +0100 | [diff] [blame] | 2034 | skip_suites_without_constant_flow |
Manuel Pégourié-Gonnard | 73afa37 | 2020-08-19 10:27:38 +0200 | [diff] [blame] | 2035 | cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 2036 | make |
| 2037 | |
| 2038 | # this only shows a summary of the results (how many of each type) |
| 2039 | # details are left in Testing/<date>/DynamicAnalysis.xml |
Gilles Peskine | 0c67160 | 2022-11-29 16:01:41 +0100 | [diff] [blame] | 2040 | msg "test: some suites (valgrind + constant flow)" |
Manuel Pégourié-Gonnard | 73afa37 | 2020-08-19 10:27:38 +0200 | [diff] [blame] | 2041 | make memcheck |
| 2042 | } |
| 2043 | |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2044 | component_test_default_no_deprecated () { |
Gilles Peskine | 8386ea2 | 2020-04-30 09:07:29 +0200 | [diff] [blame] | 2045 | # Test that removing the deprecated features from the default |
| 2046 | # configuration leaves something consistent. |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2047 | msg "build: make, default + MBEDTLS_DEPRECATED_REMOVED" # ~ 30s |
| 2048 | scripts/config.py set MBEDTLS_DEPRECATED_REMOVED |
| 2049 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra' |
| 2050 | |
| 2051 | msg "test: make, default + MBEDTLS_DEPRECATED_REMOVED" # ~ 5s |
| 2052 | make test |
| 2053 | } |
| 2054 | |
| 2055 | component_test_full_no_deprecated () { |
Gilles Peskine | 30de2e8 | 2020-04-20 21:39:22 +0200 | [diff] [blame] | 2056 | msg "build: make, full_no_deprecated config" # ~ 30s |
| 2057 | scripts/config.py full_no_deprecated |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2058 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra' |
| 2059 | |
Gilles Peskine | 30de2e8 | 2020-04-20 21:39:22 +0200 | [diff] [blame] | 2060 | msg "test: make, full_no_deprecated config" # ~ 5s |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2061 | make test |
Valerio Setti | 41b5fb6 | 2023-01-09 12:20:45 +0100 | [diff] [blame] | 2062 | |
| 2063 | msg "test: ensure that X509 has no direct dependency on BIGNUM_C" |
| 2064 | not grep mbedtls_mpi library/libmbedx509.a |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2065 | } |
| 2066 | |
Gilles Peskine | 8386ea2 | 2020-04-30 09:07:29 +0200 | [diff] [blame] | 2067 | component_test_full_no_deprecated_deprecated_warning () { |
| 2068 | # Test that there is nothing deprecated in "full_no_deprecated". |
| 2069 | # A deprecated feature would trigger a warning (made fatal) from |
| 2070 | # MBEDTLS_DEPRECATED_WARNING. |
Gilles Peskine | 30de2e8 | 2020-04-20 21:39:22 +0200 | [diff] [blame] | 2071 | msg "build: make, full_no_deprecated config, MBEDTLS_DEPRECATED_WARNING" # ~ 30s |
| 2072 | scripts/config.py full_no_deprecated |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2073 | scripts/config.py unset MBEDTLS_DEPRECATED_REMOVED |
| 2074 | scripts/config.py set MBEDTLS_DEPRECATED_WARNING |
| 2075 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra' |
| 2076 | |
Gilles Peskine | 30de2e8 | 2020-04-20 21:39:22 +0200 | [diff] [blame] | 2077 | msg "test: make, full_no_deprecated config, MBEDTLS_DEPRECATED_WARNING" # ~ 5s |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2078 | make test |
| 2079 | } |
| 2080 | |
Gilles Peskine | 8386ea2 | 2020-04-30 09:07:29 +0200 | [diff] [blame] | 2081 | component_test_full_deprecated_warning () { |
| 2082 | # Test that when MBEDTLS_DEPRECATED_WARNING is enabled, the build passes |
| 2083 | # with only certain whitelisted types of warnings. |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2084 | msg "build: make, full config + MBEDTLS_DEPRECATED_WARNING, expect warnings" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 2085 | scripts/config.py full |
| 2086 | scripts/config.py set MBEDTLS_DEPRECATED_WARNING |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2087 | # Expect warnings from '#warning' directives in check_config.h. |
| 2088 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-error=cpp' lib programs |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 2089 | |
Gilles Peskine | 8386ea2 | 2020-04-30 09:07:29 +0200 | [diff] [blame] | 2090 | msg "build: make tests, full config + MBEDTLS_DEPRECATED_WARNING, expect warnings" # ~ 30s |
| 2091 | # Set MBEDTLS_TEST_DEPRECATED to enable tests for deprecated features. |
| 2092 | # By default those are disabled when MBEDTLS_DEPRECATED_WARNING is set. |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2093 | # Expect warnings from '#warning' directives in check_config.h and |
| 2094 | # from the use of deprecated functions in test suites. |
| 2095 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-error=deprecated-declarations -Wno-error=cpp -DMBEDTLS_TEST_DEPRECATED' tests |
Gilles Peskine | 841b14b | 2019-11-26 17:37:37 +0100 | [diff] [blame] | 2096 | |
Gilles Peskine | 1093d9f | 2020-04-13 01:03:21 +0200 | [diff] [blame] | 2097 | msg "test: full config + MBEDTLS_TEST_DEPRECATED" # ~ 30s |
| 2098 | make test |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 2099 | } |
Jaeden Amero | ed93bdc | 2018-11-02 16:57:24 +0000 | [diff] [blame] | 2100 | |
Gilles Peskine | ec541fe | 2020-01-31 14:24:14 +0100 | [diff] [blame] | 2101 | # Check that the specified libraries exist and are empty. |
| 2102 | are_empty_libraries () { |
| 2103 | nm "$@" >/dev/null 2>/dev/null |
| 2104 | ! nm "$@" 2>/dev/null | grep -v ':$' | grep . |
| 2105 | } |
| 2106 | |
| 2107 | component_build_crypto_default () { |
| 2108 | msg "build: make, crypto only" |
| 2109 | scripts/config.py crypto |
Gilles Peskine | 6bb3915 | 2020-02-03 11:59:20 +0100 | [diff] [blame] | 2110 | make CFLAGS='-O1 -Werror' |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 2111 | are_empty_libraries library/libmbedx509.* library/libmbedtls.* |
Gilles Peskine | ec541fe | 2020-01-31 14:24:14 +0100 | [diff] [blame] | 2112 | } |
| 2113 | |
| 2114 | component_build_crypto_full () { |
| 2115 | msg "build: make, crypto only, full config" |
| 2116 | scripts/config.py crypto_full |
Gilles Peskine | 6bb3915 | 2020-02-03 11:59:20 +0100 | [diff] [blame] | 2117 | make CFLAGS='-O1 -Werror' |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 2118 | are_empty_libraries library/libmbedx509.* library/libmbedtls.* |
Gilles Peskine | ec541fe | 2020-01-31 14:24:14 +0100 | [diff] [blame] | 2119 | } |
| 2120 | |
Gilles Peskine | fc4f11b | 2022-10-21 19:34:54 +0200 | [diff] [blame] | 2121 | component_test_crypto_for_psa_service () { |
Gilles Peskine | aef1ba6 | 2022-10-11 21:05:06 +0200 | [diff] [blame] | 2122 | msg "build: make, config for PSA crypto service" |
| 2123 | scripts/config.py crypto |
| 2124 | scripts/config.py set MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER |
| 2125 | # Disable things that are not needed for just cryptography, to |
| 2126 | # reach a configuration that would be typical for a PSA cryptography |
| 2127 | # service providing all implemented PSA algorithms. |
| 2128 | # System stuff |
| 2129 | scripts/config.py unset MBEDTLS_ERROR_C |
| 2130 | scripts/config.py unset MBEDTLS_TIMING_C |
Gilles Peskine | 78bffd1 | 2022-10-25 21:02:33 +0200 | [diff] [blame] | 2131 | scripts/config.py unset MBEDTLS_VERSION_FEATURES |
Gilles Peskine | aef1ba6 | 2022-10-11 21:05:06 +0200 | [diff] [blame] | 2132 | # Crypto stuff with no PSA interface |
| 2133 | scripts/config.py unset MBEDTLS_BASE64_C |
Gilles Peskine | 649e04e | 2022-10-25 21:05:57 +0200 | [diff] [blame] | 2134 | # Keep MBEDTLS_CIPHER_C because psa_crypto_cipher, CCM and GCM need it. |
Gilles Peskine | b06f071 | 2022-10-25 21:06:11 +0200 | [diff] [blame] | 2135 | scripts/config.py unset MBEDTLS_HKDF_C # PSA's HKDF is independent |
Gilles Peskine | 649e04e | 2022-10-25 21:05:57 +0200 | [diff] [blame] | 2136 | # Keep MBEDTLS_MD_C because deterministic ECDSA needs it for HMAC_DRBG. |
Gilles Peskine | aef1ba6 | 2022-10-11 21:05:06 +0200 | [diff] [blame] | 2137 | scripts/config.py unset MBEDTLS_NIST_KW_C |
| 2138 | scripts/config.py unset MBEDTLS_PEM_PARSE_C |
| 2139 | scripts/config.py unset MBEDTLS_PEM_WRITE_C |
| 2140 | scripts/config.py unset MBEDTLS_PKCS12_C |
| 2141 | scripts/config.py unset MBEDTLS_PKCS5_C |
Gilles Peskine | fcee740 | 2022-10-11 21:15:24 +0200 | [diff] [blame] | 2142 | # MBEDTLS_PK_PARSE_C and MBEDTLS_PK_WRITE_C are actually currently needed |
| 2143 | # in PSA code to work with RSA keys. We don't require users to set those: |
| 2144 | # they will be reenabled in build_info.h. |
Gilles Peskine | 1f10807 | 2022-10-25 21:02:56 +0200 | [diff] [blame] | 2145 | scripts/config.py unset MBEDTLS_PK_C |
Gilles Peskine | fcee740 | 2022-10-11 21:15:24 +0200 | [diff] [blame] | 2146 | scripts/config.py unset MBEDTLS_PK_PARSE_C |
Gilles Peskine | aef1ba6 | 2022-10-11 21:05:06 +0200 | [diff] [blame] | 2147 | scripts/config.py unset MBEDTLS_PK_WRITE_C |
Gilles Peskine | aef1ba6 | 2022-10-11 21:05:06 +0200 | [diff] [blame] | 2148 | make CFLAGS='-O1 -Werror' all test |
| 2149 | are_empty_libraries library/libmbedx509.* library/libmbedtls.* |
| 2150 | } |
| 2151 | |
Gilles Peskine | ec541fe | 2020-01-31 14:24:14 +0100 | [diff] [blame] | 2152 | component_build_crypto_baremetal () { |
| 2153 | msg "build: make, crypto only, baremetal config" |
| 2154 | scripts/config.py crypto_baremetal |
David Horstmann | 61faf66 | 2021-11-30 11:40:54 +0000 | [diff] [blame] | 2155 | make CFLAGS="-O1 -Werror -I$PWD/tests/include/baremetal-override/" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 2156 | are_empty_libraries library/libmbedx509.* library/libmbedtls.* |
Gilles Peskine | ec541fe | 2020-01-31 14:24:14 +0100 | [diff] [blame] | 2157 | } |
Daniel Axtens | 446af20 | 2020-09-02 21:30:13 +1000 | [diff] [blame] | 2158 | support_build_crypto_baremetal () { |
Daniel Axtens | 814c813 | 2020-08-31 14:22:58 +1000 | [diff] [blame] | 2159 | support_build_baremetal "$@" |
| 2160 | } |
| 2161 | |
| 2162 | component_build_baremetal () { |
| 2163 | msg "build: make, baremetal config" |
| 2164 | scripts/config.py baremetal |
David Horstmann | 61faf66 | 2021-11-30 11:40:54 +0000 | [diff] [blame] | 2165 | make CFLAGS="-O1 -Werror -I$PWD/tests/include/baremetal-override/" |
Daniel Axtens | 814c813 | 2020-08-31 14:22:58 +1000 | [diff] [blame] | 2166 | } |
| 2167 | support_build_baremetal () { |
Daniel Axtens | 446af20 | 2020-09-02 21:30:13 +1000 | [diff] [blame] | 2168 | # Older Glibc versions include time.h from other headers such as stdlib.h, |
| 2169 | # which makes the no-time.h-in-baremetal check fail. Ubuntu 16.04 has this |
| 2170 | # problem, Ubuntu 18.04 is ok. |
| 2171 | ! grep -q -F time.h /usr/include/x86_64-linux-gnu/sys/types.h |
| 2172 | } |
Gilles Peskine | ec541fe | 2020-01-31 14:24:14 +0100 | [diff] [blame] | 2173 | |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2174 | # depends.py family of tests |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2175 | component_test_depends_py_cipher_id () { |
| 2176 | msg "test/build: depends.py cipher_id (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2177 | tests/scripts/depends.py cipher_id --unset-use-psa |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 2178 | } |
Jaeden Amero | acaabe7 | 2018-11-07 11:52:52 +0000 | [diff] [blame] | 2179 | |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2180 | component_test_depends_py_cipher_chaining () { |
| 2181 | msg "test/build: depends.py cipher_chaining (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2182 | tests/scripts/depends.py cipher_chaining --unset-use-psa |
John Durkop | c14be90 | 2020-08-20 06:16:41 -0700 | [diff] [blame] | 2183 | } |
| 2184 | |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2185 | component_test_depends_py_cipher_padding () { |
| 2186 | msg "test/build: depends.py cipher_padding (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2187 | tests/scripts/depends.py cipher_padding --unset-use-psa |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 2188 | } |
Jaeden Amero | acaabe7 | 2018-11-07 11:52:52 +0000 | [diff] [blame] | 2189 | |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2190 | component_test_depends_py_curves () { |
| 2191 | msg "test/build: depends.py curves (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2192 | tests/scripts/depends.py curves --unset-use-psa |
John Durkop | 2ec2eaa | 2020-08-24 18:29:15 -0700 | [diff] [blame] | 2193 | } |
| 2194 | |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2195 | component_test_depends_py_hashes () { |
| 2196 | msg "test/build: depends.py hashes (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2197 | tests/scripts/depends.py hashes --unset-use-psa |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 2198 | } |
Manuel Pégourié-Gonnard | 655c0a8 | 2018-10-30 11:20:45 +0100 | [diff] [blame] | 2199 | |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2200 | component_test_depends_py_kex () { |
| 2201 | msg "test/build: depends.py kex (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2202 | tests/scripts/depends.py kex --unset-use-psa |
Manuel Pégourié-Gonnard | 655c0a8 | 2018-10-30 11:20:45 +0100 | [diff] [blame] | 2203 | } |
| 2204 | |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2205 | component_test_depends_py_pkalgs () { |
| 2206 | msg "test/build: depends.py pkalgs (gcc)" |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2207 | tests/scripts/depends.py pkalgs --unset-use-psa |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 2208 | } |
Manuel Pégourié-Gonnard | 655c0a8 | 2018-10-30 11:20:45 +0100 | [diff] [blame] | 2209 | |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2210 | # PSA equivalents of the depends.py tests |
| 2211 | component_test_depends_py_cipher_id_psa () { |
| 2212 | msg "test/build: depends.py cipher_id (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 2213 | tests/scripts/depends.py cipher_id |
| 2214 | } |
Manuel Pégourié-Gonnard | 655c0a8 | 2018-10-30 11:20:45 +0100 | [diff] [blame] | 2215 | |
Andrzej Kurek | 7cb0077 | 2022-10-24 10:49:22 -0400 | [diff] [blame] | 2216 | component_test_depends_py_cipher_chaining_psa () { |
| 2217 | msg "test/build: depends.py cipher_chaining (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 2218 | tests/scripts/depends.py cipher_chaining |
| 2219 | } |
| 2220 | |
| 2221 | component_test_depends_py_cipher_padding_psa () { |
| 2222 | msg "test/build: depends.py cipher_padding (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 2223 | tests/scripts/depends.py cipher_padding |
| 2224 | } |
| 2225 | |
| 2226 | component_test_depends_py_curves_psa () { |
| 2227 | msg "test/build: depends.py curves (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 2228 | tests/scripts/depends.py curves |
| 2229 | } |
| 2230 | |
| 2231 | component_test_depends_py_hashes_psa () { |
| 2232 | msg "test/build: depends.py hashes (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 2233 | tests/scripts/depends.py hashes |
| 2234 | } |
| 2235 | |
| 2236 | component_test_depends_py_kex_psa () { |
| 2237 | msg "test/build: depends.py kex (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 2238 | tests/scripts/depends.py kex |
| 2239 | } |
| 2240 | |
| 2241 | component_test_depends_py_pkalgs_psa () { |
| 2242 | msg "test/build: depends.py pkalgs (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
Andrzej Kurek | fcbd2ac | 2022-10-05 09:14:07 -0400 | [diff] [blame] | 2243 | tests/scripts/depends.py pkalgs |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 2244 | } |
Manuel Pégourié-Gonnard | 655c0a8 | 2018-10-30 11:20:45 +0100 | [diff] [blame] | 2245 | |
Dave Rodgman | 1a034dc | 2023-01-20 13:18:05 +0000 | [diff] [blame] | 2246 | component_build_no_pk_rsa_alt_support () { |
| 2247 | msg "build: !MBEDTLS_PK_RSA_ALT_SUPPORT" # ~30s |
| 2248 | |
| 2249 | scripts/config.py full |
| 2250 | scripts/config.py unset MBEDTLS_PK_RSA_ALT_SUPPORT |
| 2251 | scripts/config.py set MBEDTLS_RSA_C |
| 2252 | scripts/config.py set MBEDTLS_X509_CRT_WRITE_C |
| 2253 | |
| 2254 | # Only compile - this is primarily to test for compile issues |
| 2255 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/alt-dummy' |
| 2256 | } |
| 2257 | |
Gilles Peskine | cc73cc5 | 2021-05-25 09:04:46 +0200 | [diff] [blame] | 2258 | component_build_module_alt () { |
| 2259 | msg "build: MBEDTLS_XXX_ALT" # ~30s |
| 2260 | scripts/config.py full |
Manuel Pégourié-Gonnard | a6e3d3e | 2022-12-06 12:10:33 +0100 | [diff] [blame] | 2261 | |
| 2262 | # Disable options that are incompatible with some ALT implementations: |
Gilles Peskine | cc73cc5 | 2021-05-25 09:04:46 +0200 | [diff] [blame] | 2263 | # aesni.c and padlock.c reference mbedtls_aes_context fields directly. |
| 2264 | scripts/config.py unset MBEDTLS_AESNI_C |
| 2265 | scripts/config.py unset MBEDTLS_PADLOCK_C |
Jerry Yu | e51eddc | 2023-01-11 14:16:08 +0800 | [diff] [blame] | 2266 | scripts/config.py unset MBEDTLS_AESCE_C |
Manuel Pégourié-Gonnard | a6e3d3e | 2022-12-06 12:10:33 +0100 | [diff] [blame] | 2267 | # MBEDTLS_ECP_RESTARTABLE is documented as incompatible. |
| 2268 | scripts/config.py unset MBEDTLS_ECP_RESTARTABLE |
Gilles Peskine | cc73cc5 | 2021-05-25 09:04:46 +0200 | [diff] [blame] | 2269 | # You can only have one threading implementation: alt or pthread, not both. |
| 2270 | scripts/config.py unset MBEDTLS_THREADING_PTHREAD |
Gilles Peskine | 5c3f18d | 2021-05-31 21:21:12 +0200 | [diff] [blame] | 2271 | # The SpecifiedECDomain parsing code accesses mbedtls_ecp_group fields |
| 2272 | # directly and assumes the implementation works with partial groups. |
| 2273 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_EXTENDED |
Tom Cosgrove | f3ebd90 | 2022-02-20 22:25:31 +0000 | [diff] [blame] | 2274 | # MBEDTLS_SHA256_*ALT can't be used with MBEDTLS_SHA256_USE_A64_CRYPTO_* |
| 2275 | scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT |
| 2276 | scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY |
Tom Cosgrove | 87fbfb5 | 2022-03-15 10:51:52 +0000 | [diff] [blame] | 2277 | # MBEDTLS_SHA512_*ALT can't be used with MBEDTLS_SHA512_USE_A64_CRYPTO_* |
| 2278 | scripts/config.py unset MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT |
| 2279 | scripts/config.py unset MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY |
Manuel Pégourié-Gonnard | a6e3d3e | 2022-12-06 12:10:33 +0100 | [diff] [blame] | 2280 | |
Gilles Peskine | cc73cc5 | 2021-05-25 09:04:46 +0200 | [diff] [blame] | 2281 | # Enable all MBEDTLS_XXX_ALT for whole modules. Do not enable |
| 2282 | # MBEDTLS_XXX_YYY_ALT which are for single functions. |
| 2283 | scripts/config.py set-all 'MBEDTLS_([A-Z0-9]*|NIST_KW)_ALT' |
Gilles Peskine | 1628a9c | 2021-05-31 22:09:58 +0200 | [diff] [blame] | 2284 | scripts/config.py unset MBEDTLS_DHM_ALT #incompatible with MBEDTLS_DEBUG_C |
Manuel Pégourié-Gonnard | a6e3d3e | 2022-12-06 12:10:33 +0100 | [diff] [blame] | 2285 | |
Gilles Peskine | 1628a9c | 2021-05-31 22:09:58 +0200 | [diff] [blame] | 2286 | # We can only compile, not link, since we don't have any implementations |
| 2287 | # suitable for testing with the dummy alt headers. |
| 2288 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/alt-dummy' lib |
| 2289 | } |
| 2290 | |
| 2291 | component_build_dhm_alt () { |
| 2292 | msg "build: MBEDTLS_DHM_ALT" # ~30s |
| 2293 | scripts/config.py full |
| 2294 | scripts/config.py set MBEDTLS_DHM_ALT |
| 2295 | # debug.c currently references mbedtls_dhm_context fields directly. |
| 2296 | scripts/config.py unset MBEDTLS_DEBUG_C |
Gilles Peskine | cc73cc5 | 2021-05-25 09:04:46 +0200 | [diff] [blame] | 2297 | # We can only compile, not link, since we don't have any implementations |
| 2298 | # suitable for testing with the dummy alt headers. |
| 2299 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -I../tests/include/alt-dummy' lib |
| 2300 | } |
| 2301 | |
Manuel Pégourié-Gonnard | 971dea3 | 2019-02-01 12:38:40 +0100 | [diff] [blame] | 2302 | component_test_no_use_psa_crypto_full_cmake_asan() { |
| 2303 | # full minus MBEDTLS_USE_PSA_CRYPTO: run the same set of tests as basic-build-test.sh |
Gilles Peskine | dc3a179 | 2019-09-03 11:42:04 +0200 | [diff] [blame] | 2304 | msg "build: cmake, full config minus MBEDTLS_USE_PSA_CRYPTO, ASan" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 2305 | scripts/config.py full |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 2306 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_C |
| 2307 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 2308 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 2309 | scripts/config.py unset MBEDTLS_PSA_ITS_FILE_C |
Gilles Peskine | dc6d838 | 2020-04-12 14:21:55 +0200 | [diff] [blame] | 2310 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 2311 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C |
Raef Coles | a7e03ad | 2022-09-28 09:32:48 +0100 | [diff] [blame] | 2312 | scripts/config.py unset MBEDTLS_LMS_C |
Raef Coles | 47bccb7 | 2022-09-28 12:00:20 +0100 | [diff] [blame] | 2313 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
Manuel Pégourié-Gonnard | d8167e8 | 2019-02-01 11:12:52 +0100 | [diff] [blame] | 2314 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Andrzej Kurek | de5a007 | 2019-02-01 07:03:03 -0500 | [diff] [blame] | 2315 | make |
Manuel Pégourié-Gonnard | 43be6cd | 2017-06-20 09:53:42 +0200 | [diff] [blame] | 2316 | |
Manuel Pégourié-Gonnard | 971dea3 | 2019-02-01 12:38:40 +0100 | [diff] [blame] | 2317 | msg "test: main suites (full minus MBEDTLS_USE_PSA_CRYPTO)" |
Andrzej Kurek | de5a007 | 2019-02-01 07:03:03 -0500 | [diff] [blame] | 2318 | make test |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 2319 | |
Manuel Pégourié-Gonnard | 182a23b | 2022-12-07 10:38:43 +0100 | [diff] [blame] | 2320 | # Note: ssl-opt.sh has some test cases that depend on |
| 2321 | # MBEDTLS_ECP_RESTARTABLE && !MBEDTLS_USE_PSA_CRYPTO |
| 2322 | # This is the only component where those tests are not skipped. |
Manuel Pégourié-Gonnard | 971dea3 | 2019-02-01 12:38:40 +0100 | [diff] [blame] | 2323 | msg "test: ssl-opt.sh (full minus MBEDTLS_USE_PSA_CRYPTO)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 2324 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 2325 | |
Manuel Pégourié-Gonnard | 971dea3 | 2019-02-01 12:38:40 +0100 | [diff] [blame] | 2326 | msg "test: compat.sh default (full minus MBEDTLS_USE_PSA_CRYPTO)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 2327 | tests/compat.sh |
Andrzej Kurek | 991f9fe | 2018-07-02 09:08:21 -0400 | [diff] [blame] | 2328 | |
Manuel Pégourié-Gonnard | 296787f | 2022-04-06 13:28:27 +0200 | [diff] [blame] | 2329 | msg "test: compat.sh NULL (full minus MBEDTLS_USE_PSA_CRYPTO)" |
Manuel Pégourié-Gonnard | c572246 | 2022-12-19 11:42:12 +0100 | [diff] [blame] | 2330 | env OPENSSL="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_LEGACY_CLI" GNUTLS_SERV="$GNUTLS_LEGACY_SERV" tests/compat.sh -f 'NULL' |
Andrzej Kurek | c470b6b | 2019-01-31 08:20:20 -0500 | [diff] [blame] | 2331 | |
Manuel Pégourié-Gonnard | 971dea3 | 2019-02-01 12:38:40 +0100 | [diff] [blame] | 2332 | msg "test: compat.sh ARIA + ChachaPoly (full minus MBEDTLS_USE_PSA_CRYPTO)" |
Manuel Pégourié-Gonnard | c572246 | 2022-12-19 11:42:12 +0100 | [diff] [blame] | 2333 | env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA' |
Andrzej Kurek | de5a007 | 2019-02-01 07:03:03 -0500 | [diff] [blame] | 2334 | } |
Andrzej Kurek | c470b6b | 2019-01-31 08:20:20 -0500 | [diff] [blame] | 2335 | |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2336 | component_test_psa_crypto_config_accel_ecdsa () { |
Valerio Setti | 5aab43f | 2023-03-29 10:42:07 +0200 | [diff] [blame] | 2337 | msg "build: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA" |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2338 | |
Manuel Pégourié-Gonnard | 200fd0f | 2022-12-27 13:03:10 +0100 | [diff] [blame] | 2339 | # Algorithms and key types to accelerate |
Valerio Setti | c0d2f84 | 2023-06-28 10:48:08 +0200 | [diff] [blame] | 2340 | loc_accel_list="ALG_ECDSA ALG_DETERMINISTIC_ECDSA \ |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2341 | $(helper_get_psa_key_type_list "ECC")" |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2342 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2343 | # Note: Those are handled in a special way by the libtestdriver machinery, |
| 2344 | # so we only want to include them in the accel list when building the main |
| 2345 | # libraries, hence the use of a separate variable. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2346 | loc_curve_list="$(helper_get_psa_curve_list)" |
Manuel Pégourié-Gonnard | 200fd0f | 2022-12-27 13:03:10 +0100 | [diff] [blame] | 2347 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2348 | # Configure |
| 2349 | # --------- |
Manuel Pégourié-Gonnard | 200fd0f | 2022-12-27 13:03:10 +0100 | [diff] [blame] | 2350 | |
Manuel Pégourié-Gonnard | 8d645dc | 2023-06-15 09:07:10 +0200 | [diff] [blame] | 2351 | # Start from default config (no USE_PSA) + TLS 1.3 |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2352 | helper_libtestdriver1_adjust_config "default" |
Manuel Pégourié-Gonnard | 6d7db93 | 2022-12-28 09:48:01 +0100 | [diff] [blame] | 2353 | scripts/config.py set MBEDTLS_SSL_PROTO_TLS1_3 |
Manuel Pégourié-Gonnard | 200fd0f | 2022-12-27 13:03:10 +0100 | [diff] [blame] | 2354 | |
| 2355 | # Disable the module that's accelerated |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2356 | scripts/config.py unset MBEDTLS_ECDSA_C |
Manuel Pégourié-Gonnard | 200fd0f | 2022-12-27 13:03:10 +0100 | [diff] [blame] | 2357 | |
| 2358 | # Disable things that depend on it |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2359 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 2360 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 2361 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2362 | # Build |
| 2363 | # ----- |
| 2364 | |
| 2365 | # These hashes are needed for some ECDSA signature tests. |
Manuel Pégourié-Gonnard | e47c53e | 2023-09-23 08:54:30 +0200 | [diff] [blame] | 2366 | loc_extra_list="ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 2367 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2368 | |
| 2369 | helper_libtestdriver1_make_drivers "$loc_accel_list" "$loc_extra_list" |
| 2370 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2371 | helper_libtestdriver1_make_main "$loc_accel_list $loc_curve_list" |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2372 | |
Manuel Pégourié-Gonnard | e3095e7 | 2022-12-28 10:09:53 +0100 | [diff] [blame] | 2373 | # Make sure this was not re-enabled by accident (additive config) |
Gilles Peskine | 827dbd9 | 2022-02-04 00:30:54 +0100 | [diff] [blame] | 2374 | not grep mbedtls_ecdsa_ library/ecdsa.o |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2375 | |
Manuel Pégourié-Gonnard | 200fd0f | 2022-12-27 13:03:10 +0100 | [diff] [blame] | 2376 | # Run the tests |
| 2377 | # ------------- |
| 2378 | |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 2379 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDSA" |
| 2380 | make test |
| 2381 | } |
| 2382 | |
Valerio Setti | 44b178c | 2023-03-22 14:02:57 +0100 | [diff] [blame] | 2383 | component_test_psa_crypto_config_accel_ecdh () { |
Valerio Setti | 5aab43f | 2023-03-29 10:42:07 +0200 | [diff] [blame] | 2384 | msg "build: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDH" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2385 | |
| 2386 | # Algorithms and key types to accelerate |
Valerio Setti | c0d2f84 | 2023-06-28 10:48:08 +0200 | [diff] [blame] | 2387 | loc_accel_list="ALG_ECDH \ |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2388 | $(helper_get_psa_key_type_list "ECC")" |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2389 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2390 | # Note: Those are handled in a special way by the libtestdriver machinery, |
| 2391 | # so we only want to include them in the accel list when building the main |
| 2392 | # libraries, hence the use of a separate variable. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2393 | loc_curve_list="$(helper_get_psa_curve_list)" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2394 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2395 | # Configure |
| 2396 | # --------- |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2397 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2398 | # Start from default config (no TLS 1.3, no USE_PSA) |
| 2399 | helper_libtestdriver1_adjust_config "default" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2400 | |
Valerio Setti | 44b178c | 2023-03-22 14:02:57 +0100 | [diff] [blame] | 2401 | # Disable the module that's accelerated |
| 2402 | scripts/config.py unset MBEDTLS_ECDH_C |
| 2403 | |
| 2404 | # Disable things that depend on it |
| 2405 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 2406 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 2407 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 2408 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 2409 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED |
| 2410 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2411 | # Build |
| 2412 | # ----- |
| 2413 | |
| 2414 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 2415 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2416 | helper_libtestdriver1_make_main "$loc_accel_list $loc_curve_list" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2417 | |
Valerio Setti | 44b178c | 2023-03-22 14:02:57 +0100 | [diff] [blame] | 2418 | # Make sure this was not re-enabled by accident (additive config) |
| 2419 | not grep mbedtls_ecdh_ library/ecdh.o |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2420 | |
| 2421 | # Run the tests |
| 2422 | # ------------- |
| 2423 | |
Valerio Setti | 44b178c | 2023-03-22 14:02:57 +0100 | [diff] [blame] | 2424 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated ECDH" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2425 | make test |
Manuel Pégourié-Gonnard | 10e3963 | 2022-12-29 12:29:09 +0100 | [diff] [blame] | 2426 | } |
| 2427 | |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2428 | component_test_psa_crypto_config_accel_ffdh () { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2429 | msg "build: full with accelerated FFDH" |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2430 | |
| 2431 | # Algorithms and key types to accelerate |
Valerio Setti | 27602c3 | 2023-07-10 16:38:59 +0200 | [diff] [blame] | 2432 | loc_accel_list="ALG_FFDH \ |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2433 | $(helper_get_psa_key_type_list "DH")" |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2434 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2435 | # Configure |
| 2436 | # --------- |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2437 | |
Przemek Stekiel | 565353e | 2023-07-05 11:07:07 +0200 | [diff] [blame] | 2438 | # start with full (USE_PSA and TLS 1.3) |
Przemek Stekiel | 84f4ff1 | 2023-07-04 12:35:31 +0200 | [diff] [blame] | 2439 | helper_libtestdriver1_adjust_config "full" |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2440 | |
| 2441 | # Disable the module that's accelerated |
| 2442 | scripts/config.py unset MBEDTLS_DHM_C |
| 2443 | |
| 2444 | # Disable things that depend on it |
| 2445 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED |
| 2446 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 2447 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2448 | # Build |
| 2449 | # ----- |
| 2450 | |
| 2451 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 2452 | |
Manuel Pégourié-Gonnard | 981732e | 2023-06-08 09:15:59 +0200 | [diff] [blame] | 2453 | helper_libtestdriver1_make_main "$loc_accel_list" |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2454 | |
| 2455 | # Make sure this was not re-enabled by accident (additive config) |
| 2456 | not grep mbedtls_dhm_ library/dhm.o |
| 2457 | |
| 2458 | # Run the tests |
| 2459 | # ------------- |
| 2460 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2461 | msg "test: full with accelerated FFDH" |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2462 | make test |
Przemek Stekiel | 84f4ff1 | 2023-07-04 12:35:31 +0200 | [diff] [blame] | 2463 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2464 | msg "ssl-opt: full with accelerated FFDH alg" |
Przemek Stekiel | 84f4ff1 | 2023-07-04 12:35:31 +0200 | [diff] [blame] | 2465 | tests/ssl-opt.sh -f "ffdh" |
Przemek Stekiel | dccb202 | 2023-05-11 10:48:50 +0200 | [diff] [blame] | 2466 | } |
| 2467 | |
Przemek Stekiel | 01c248c | 2023-05-26 10:19:49 +0200 | [diff] [blame] | 2468 | component_test_psa_crypto_config_reference_ffdh () { |
Gilles Peskine | b7d577e | 2023-08-09 19:48:58 +0200 | [diff] [blame] | 2469 | msg "build: full with non-accelerated FFDH" |
Przemek Stekiel | 01c248c | 2023-05-26 10:19:49 +0200 | [diff] [blame] | 2470 | |
| 2471 | # Start with full (USE_PSA and TLS 1.3) |
Przemek Stekiel | 565353e | 2023-07-05 11:07:07 +0200 | [diff] [blame] | 2472 | helper_libtestdriver1_adjust_config "full" |
Przemek Stekiel | 01c248c | 2023-05-26 10:19:49 +0200 | [diff] [blame] | 2473 | |
| 2474 | # Disable things that are not supported |
| 2475 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED |
| 2476 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
Przemek Stekiel | 01c248c | 2023-05-26 10:19:49 +0200 | [diff] [blame] | 2477 | make |
| 2478 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2479 | msg "test suites: full with non-accelerated FFDH alg" |
Przemek Stekiel | 01c248c | 2023-05-26 10:19:49 +0200 | [diff] [blame] | 2480 | make test |
| 2481 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2482 | msg "ssl-opt: full with non-accelerated FFDH alg" |
Przemek Stekiel | 84f4ff1 | 2023-07-04 12:35:31 +0200 | [diff] [blame] | 2483 | tests/ssl-opt.sh -f "ffdh" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2484 | } |
| 2485 | |
Valerio Setti | 44b178c | 2023-03-22 14:02:57 +0100 | [diff] [blame] | 2486 | component_test_psa_crypto_config_accel_pake() { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2487 | msg "build: full with accelerated PAKE" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2488 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2489 | loc_accel_list="ALG_JPAKE \ |
| 2490 | $(helper_get_psa_key_type_list "ECC")" |
| 2491 | |
| 2492 | # Note: Those are handled in a special way by the libtestdriver machinery, |
| 2493 | # so we only want to include them in the accel list when building the main |
| 2494 | # libraries, hence the use of a separate variable. |
| 2495 | loc_curve_list="$(helper_get_psa_curve_list)" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2496 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2497 | # Configure |
| 2498 | # --------- |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2499 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2500 | helper_libtestdriver1_adjust_config "full" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2501 | |
| 2502 | # Make built-in fallback not available |
| 2503 | scripts/config.py unset MBEDTLS_ECJPAKE_C |
| 2504 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED |
| 2505 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2506 | # Build |
| 2507 | # ----- |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2508 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2509 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2510 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2511 | helper_libtestdriver1_make_main "$loc_accel_list $loc_curve_list" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2512 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 2513 | # Make sure this was not re-enabled by accident (additive config) |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2514 | not grep mbedtls_ecjpake_init library/ecjpake.o |
| 2515 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 2516 | # Run the tests |
| 2517 | # ------------- |
| 2518 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2519 | msg "test: full with accelerated PAKE" |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2520 | make test |
| 2521 | } |
| 2522 | |
| 2523 | # Auxiliary function to build config for all EC based algorithms (EC-JPAKE, |
| 2524 | # ECDH, ECDSA) with and without drivers. |
| 2525 | # The input parameter is a boolean value which indicates: |
| 2526 | # - 0 keep built-in EC algs, |
| 2527 | # - 1 exclude built-in EC algs (driver only). |
| 2528 | # |
| 2529 | # This is used by the two following components to ensure they always use the |
| 2530 | # same config, except for the use of driver or built-in EC algorithms: |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2531 | # - component_test_psa_crypto_config_accel_ecc_ecp_light_only; |
| 2532 | # - component_test_psa_crypto_config_reference_ecc_ecp_light_only. |
Manuel Pégourié-Gonnard | 171c45f | 2022-12-29 11:31:35 +0100 | [diff] [blame] | 2533 | # This supports comparing their test coverage with analyze_outcomes.py. |
Gilles Peskine | 8dbdf2f | 2023-07-19 19:16:37 +0200 | [diff] [blame] | 2534 | config_psa_crypto_config_ecp_light_only () { |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2535 | DRIVER_ONLY="$1" |
| 2536 | # start with config full for maximum coverage (also enables USE_PSA) |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2537 | helper_libtestdriver1_adjust_config "full" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2538 | if [ "$DRIVER_ONLY" -eq 1 ]; then |
| 2539 | # Disable modules that are accelerated |
| 2540 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 2541 | scripts/config.py unset MBEDTLS_ECDH_C |
| 2542 | scripts/config.py unset MBEDTLS_ECJPAKE_C |
Valerio Setti | 29b395c | 2023-04-05 18:20:30 +0200 | [diff] [blame] | 2543 | scripts/config.py unset MBEDTLS_ECP_C |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2544 | fi |
| 2545 | |
| 2546 | # Restartable feature is not yet supported by PSA. Once it will in |
| 2547 | # the future, the following line could be removed (see issues |
| 2548 | # 6061, 6332 and following ones) |
| 2549 | scripts/config.py unset MBEDTLS_ECP_RESTARTABLE |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2550 | } |
| 2551 | |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2552 | # Keep in sync with component_test_psa_crypto_config_reference_ecc_ecp_light_only |
| 2553 | component_test_psa_crypto_config_accel_ecc_ecp_light_only () { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2554 | msg "build: full with accelerated EC algs" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2555 | |
| 2556 | # Algorithms and key types to accelerate |
| 2557 | loc_accel_list="ALG_ECDSA ALG_DETERMINISTIC_ECDSA \ |
| 2558 | ALG_ECDH \ |
| 2559 | ALG_JPAKE \ |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2560 | $(helper_get_psa_key_type_list "ECC")" |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2561 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2562 | # Note: Those are handled in a special way by the libtestdriver machinery, |
| 2563 | # so we only want to include them in the accel list when building the main |
| 2564 | # libraries, hence the use of a separate variable. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2565 | loc_curve_list="$(helper_get_psa_curve_list)" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2566 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2567 | # Configure |
| 2568 | # --------- |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2569 | |
| 2570 | # Use the same config as reference, only without built-in EC algs |
Gilles Peskine | 8dbdf2f | 2023-07-19 19:16:37 +0200 | [diff] [blame] | 2571 | config_psa_crypto_config_ecp_light_only 1 |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2572 | |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2573 | # Do not disable builtin curves because that support is required for: |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2574 | # - MBEDTLS_PK_PARSE_EC_EXTENDED |
| 2575 | # - MBEDTLS_PK_PARSE_EC_COMPRESSED |
| 2576 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2577 | # Build |
| 2578 | # ----- |
| 2579 | |
| 2580 | # These hashes are needed for some ECDSA signature tests. |
Manuel Pégourié-Gonnard | e47c53e | 2023-09-23 08:54:30 +0200 | [diff] [blame] | 2581 | loc_extra_list="ALG_SHA_1 ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 2582 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2583 | helper_libtestdriver1_make_drivers "$loc_accel_list" "$loc_extra_list" |
| 2584 | |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2585 | helper_libtestdriver1_make_main "$loc_accel_list $loc_curve_list" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2586 | |
| 2587 | # Make sure any built-in EC alg was not re-enabled by accident (additive config) |
| 2588 | not grep mbedtls_ecdsa_ library/ecdsa.o |
| 2589 | not grep mbedtls_ecdh_ library/ecdh.o |
| 2590 | not grep mbedtls_ecjpake_ library/ecjpake.o |
Valerio Setti | 29b395c | 2023-04-05 18:20:30 +0200 | [diff] [blame] | 2591 | not grep mbedtls_ecp_mul library/ecp.o |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2592 | |
| 2593 | # Run the tests |
| 2594 | # ------------- |
| 2595 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2596 | msg "test suites: full with accelerated EC algs" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2597 | make test |
| 2598 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2599 | msg "ssl-opt: full with accelerated EC algs" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2600 | tests/ssl-opt.sh |
| 2601 | } |
| 2602 | |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2603 | # Keep in sync with component_test_psa_crypto_config_accel_ecc_ecp_light_only |
| 2604 | component_test_psa_crypto_config_reference_ecc_ecp_light_only () { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2605 | msg "build: MBEDTLS_PSA_CRYPTO_CONFIG with non-accelerated EC algs" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2606 | |
Gilles Peskine | 8dbdf2f | 2023-07-19 19:16:37 +0200 | [diff] [blame] | 2607 | config_psa_crypto_config_ecp_light_only 0 |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2608 | |
| 2609 | make |
| 2610 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2611 | msg "test suites: full with non-accelerated EC algs" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2612 | make test |
| 2613 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2614 | msg "ssl-opt: full with non-accelerated EC algs" |
Valerio Setti | 42d5f19 | 2023-03-20 13:54:41 +0100 | [diff] [blame] | 2615 | tests/ssl-opt.sh |
| 2616 | } |
| 2617 | |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2618 | # This helper function is used by: |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2619 | # - component_test_psa_crypto_config_accel_ecc_no_ecp_at_all() |
| 2620 | # - component_test_psa_crypto_config_reference_ecc_no_ecp_at_all() |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2621 | # to ensure that both tests use the same underlying configuration when testing |
| 2622 | # driver's coverage with analyze_outcomes.py. |
| 2623 | # |
| 2624 | # This functions accepts 1 boolean parameter as follows: |
| 2625 | # - 1: building with accelerated EC algorithms (ECDSA, ECDH, ECJPAKE), therefore |
| 2626 | # excluding their built-in implementation as well as ECP_C & ECP_LIGHT |
| 2627 | # - 0: include built-in implementation of EC algorithms. |
| 2628 | # |
| 2629 | # PK_C and RSA_C are always disabled to ensure there is no remaining dependency |
| 2630 | # on the ECP module. |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2631 | config_psa_crypto_no_ecp_at_all () { |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2632 | DRIVER_ONLY="$1" |
Valerio Setti | aafe900 | 2023-06-26 15:23:44 +0200 | [diff] [blame] | 2633 | # start with full config for maximum coverage (also enables USE_PSA) |
| 2634 | helper_libtestdriver1_adjust_config "full" |
| 2635 | |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2636 | if [ "$DRIVER_ONLY" -eq 1 ]; then |
| 2637 | # Disable modules that are accelerated |
| 2638 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 2639 | scripts/config.py unset MBEDTLS_ECDH_C |
| 2640 | scripts/config.py unset MBEDTLS_ECJPAKE_C |
| 2641 | # Disable ECP module (entirely) |
| 2642 | scripts/config.py unset MBEDTLS_ECP_C |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2643 | fi |
| 2644 | |
Valerio Setti | aecd32c | 2023-06-14 10:42:31 +0200 | [diff] [blame] | 2645 | # Disable all the features that auto-enable ECP_LIGHT (see build_info.h) |
| 2646 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_EXTENDED |
Valerio Setti | addeee4 | 2023-06-14 10:46:55 +0200 | [diff] [blame] | 2647 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_COMPRESSED |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 2648 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE |
Valerio Setti | aecd32c | 2023-06-14 10:42:31 +0200 | [diff] [blame] | 2649 | |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2650 | # Restartable feature is not yet supported by PSA. Once it will in |
| 2651 | # the future, the following line could be removed (see issues |
| 2652 | # 6061, 6332 and following ones) |
| 2653 | scripts/config.py unset MBEDTLS_ECP_RESTARTABLE |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2654 | } |
| 2655 | |
| 2656 | # Build and test a configuration where driver accelerates all EC algs while |
| 2657 | # all support and dependencies from ECP and ECP_LIGHT are removed on the library |
| 2658 | # side. |
| 2659 | # |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2660 | # Keep in sync with component_test_psa_crypto_config_reference_ecc_no_ecp_at_all() |
| 2661 | component_test_psa_crypto_config_accel_ecc_no_ecp_at_all () { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2662 | msg "build: full + accelerated EC algs - ECP" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2663 | |
| 2664 | # Algorithms and key types to accelerate |
| 2665 | loc_accel_list="ALG_ECDSA ALG_DETERMINISTIC_ECDSA \ |
| 2666 | ALG_ECDH \ |
| 2667 | ALG_JPAKE \ |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2668 | $(helper_get_psa_key_type_list "ECC")" |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2669 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2670 | # Note: Those are handled in a special way by the libtestdriver machinery, |
| 2671 | # so we only want to include them in the accel list when building the main |
| 2672 | # libraries, hence the use of a separate variable. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2673 | loc_curve_list="$(helper_get_psa_curve_list)" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2674 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2675 | # Configure |
| 2676 | # --------- |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 2677 | |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2678 | # Set common configurations between library's and driver's builds |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2679 | config_psa_crypto_no_ecp_at_all 1 |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2680 | # Disable all the builtin curves. All the required algs are accelerated. |
| 2681 | helper_disable_builtin_curves |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2682 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 2683 | # Build |
| 2684 | # ----- |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2685 | |
| 2686 | # Things we wanted supported in libtestdriver1, but not accelerated in the main library: |
Manuel Pégourié-Gonnard | e47c53e | 2023-09-23 08:54:30 +0200 | [diff] [blame] | 2687 | # SHA-1 and all SHA-2/3 variants, as they are used by ECDSA deterministic. |
| 2688 | loc_extra_list="ALG_SHA_1 ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 2689 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2690 | |
Manuel Pégourié-Gonnard | 31639e4 | 2023-05-25 10:07:31 +0200 | [diff] [blame] | 2691 | helper_libtestdriver1_make_drivers "$loc_accel_list" "$loc_extra_list" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2692 | |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2693 | helper_libtestdriver1_make_main "$loc_accel_list $loc_curve_list" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2694 | |
| 2695 | # Make sure any built-in EC alg was not re-enabled by accident (additive config) |
| 2696 | not grep mbedtls_ecdsa_ library/ecdsa.o |
| 2697 | not grep mbedtls_ecdh_ library/ecdh.o |
| 2698 | not grep mbedtls_ecjpake_ library/ecjpake.o |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2699 | # Also ensure that ECP module was not re-enabled |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2700 | not grep mbedtls_ecp_ library/ecp.o |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2701 | |
| 2702 | # Run the tests |
| 2703 | # ------------- |
| 2704 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2705 | msg "test: full + accelerated EC algs - ECP" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2706 | make test |
Valerio Setti | 16b70f2 | 2023-06-27 17:45:49 +0200 | [diff] [blame] | 2707 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2708 | msg "ssl-opt: full + accelerated EC algs - ECP" |
Valerio Setti | 16b70f2 | 2023-06-27 17:45:49 +0200 | [diff] [blame] | 2709 | tests/ssl-opt.sh |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2710 | } |
| 2711 | |
| 2712 | # Reference function used for driver's coverage analysis in analyze_outcomes.py |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2713 | # in conjunction with component_test_psa_crypto_config_accel_ecc_no_ecp_at_all(). |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2714 | # Keep in sync with its accelerated counterpart. |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2715 | component_test_psa_crypto_config_reference_ecc_no_ecp_at_all () { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2716 | msg "build: full + non accelerated EC algs" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2717 | |
Valerio Setti | 4d25a8d | 2023-06-14 10:33:10 +0200 | [diff] [blame] | 2718 | config_psa_crypto_no_ecp_at_all 0 |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2719 | |
| 2720 | make |
| 2721 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2722 | msg "test: full + non accelerated EC algs" |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2723 | make test |
Valerio Setti | 16b70f2 | 2023-06-27 17:45:49 +0200 | [diff] [blame] | 2724 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 2725 | msg "ssl-opt: full + non accelerated EC algs" |
Valerio Setti | 16b70f2 | 2023-06-27 17:45:49 +0200 | [diff] [blame] | 2726 | tests/ssl-opt.sh |
Valerio Setti | e618cb0 | 2023-04-12 14:59:16 +0200 | [diff] [blame] | 2727 | } |
| 2728 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2729 | # This is a common configuration helper used directly from: |
| 2730 | # - common_test_psa_crypto_config_accel_ecc_ffdh_no_bignum |
| 2731 | # - common_test_psa_crypto_config_reference_ecc_ffdh_no_bignum |
| 2732 | # and indirectly from: |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2733 | # - component_test_psa_crypto_config_accel_ecc_no_bignum |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2734 | # - accelerate all EC algs, disable RSA and FFDH |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2735 | # - component_test_psa_crypto_config_reference_ecc_no_bignum |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2736 | # - this is the reference component of the above |
| 2737 | # - it still disables RSA and FFDH, but it uses builtin EC algs |
| 2738 | # - component_test_psa_crypto_config_accel_ecc_ffdh_no_bignum |
| 2739 | # - accelerate all EC and FFDH algs, disable only RSA |
| 2740 | # - component_test_psa_crypto_config_reference_ecc_ffdh_no_bignum |
| 2741 | # - this is the reference component of the above |
| 2742 | # - it still disables RSA, but it uses builtin EC and FFDH algs |
| 2743 | # |
| 2744 | # This function accepts 2 parameters: |
Valerio Setti | 5dfaca4 | 2023-09-05 08:48:51 +0200 | [diff] [blame] | 2745 | # $1: a boolean value which states if we are testing an accelerated scenario |
| 2746 | # or not. |
| 2747 | # $2: a string value which states which components are tested. Allowed values |
| 2748 | # are "ECC" or "ECC_DH". |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2749 | config_psa_crypto_config_accel_ecc_ffdh_no_bignum() { |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2750 | DRIVER_ONLY="$1" |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2751 | TEST_TARGET="$2" |
Valerio Setti | 18535c3 | 2023-07-31 11:27:17 +0200 | [diff] [blame] | 2752 | # start with full config for maximum coverage (also enables USE_PSA) |
Valerio Setti | 29c1b4d | 2023-07-27 10:08:45 +0200 | [diff] [blame] | 2753 | helper_libtestdriver1_adjust_config "full" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2754 | |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2755 | if [ "$DRIVER_ONLY" -eq 1 ]; then |
| 2756 | # Disable modules that are accelerated |
| 2757 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 2758 | scripts/config.py unset MBEDTLS_ECDH_C |
| 2759 | scripts/config.py unset MBEDTLS_ECJPAKE_C |
| 2760 | # Disable ECP module (entirely) |
| 2761 | scripts/config.py unset MBEDTLS_ECP_C |
Manuel Pégourié-Gonnard | 660bbf2 | 2023-06-12 18:42:40 +0200 | [diff] [blame] | 2762 | # Also disable bignum |
| 2763 | scripts/config.py unset MBEDTLS_BIGNUM_C |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2764 | fi |
| 2765 | |
| 2766 | # Disable all the features that auto-enable ECP_LIGHT (see build_info.h) |
| 2767 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_EXTENDED |
| 2768 | scripts/config.py unset MBEDTLS_PK_PARSE_EC_COMPRESSED |
| 2769 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE |
| 2770 | |
Manuel Pégourié-Gonnard | 7dccb66 | 2023-06-12 18:28:42 +0200 | [diff] [blame] | 2771 | # RSA support is intentionally disabled on this test because RSA_C depends |
| 2772 | # on BIGNUM_C. |
Valerio Setti | 2e0275d | 2023-07-28 16:33:13 +0200 | [diff] [blame] | 2773 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset-all "PSA_WANT_KEY_TYPE_RSA_[0-9A-Z_a-z]*" |
| 2774 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset-all "PSA_WANT_ALG_RSA_[0-9A-Z_a-z]*" |
Manuel Pégourié-Gonnard | 7dccb66 | 2023-06-12 18:28:42 +0200 | [diff] [blame] | 2775 | scripts/config.py unset MBEDTLS_RSA_C |
| 2776 | scripts/config.py unset MBEDTLS_PKCS1_V15 |
| 2777 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 2778 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 2779 | # Also disable key exchanges that depend on RSA |
| 2780 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED |
| 2781 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
| 2782 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 2783 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 2784 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 2785 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2786 | if [ "$TEST_TARGET" = "ECC" ]; then |
| 2787 | # When testing ECC only, we disable FFDH support, both from builtin and |
| 2788 | # PSA sides, and also disable the key exchanges that depend on DHM. |
| 2789 | scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_FFDH |
| 2790 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset-all "PSA_WANT_KEY_TYPE_DH_[0-9A-Z_a-z]*" |
| 2791 | scripts/config.py unset MBEDTLS_DHM_C |
| 2792 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED |
| 2793 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 2794 | else |
| 2795 | # When testing ECC and DH instead, we disable DHM and depending key |
| 2796 | # exchanges only in the accelerated build |
| 2797 | if [ "$DRIVER_ONLY" -eq 1 ]; then |
| 2798 | scripts/config.py unset MBEDTLS_DHM_C |
| 2799 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED |
| 2800 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 2801 | fi |
| 2802 | fi |
Manuel Pégourié-Gonnard | 7dccb66 | 2023-06-12 18:28:42 +0200 | [diff] [blame] | 2803 | |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2804 | # Restartable feature is not yet supported by PSA. Once it will in |
| 2805 | # the future, the following line could be removed (see issues |
| 2806 | # 6061, 6332 and following ones) |
| 2807 | scripts/config.py unset MBEDTLS_ECP_RESTARTABLE |
| 2808 | } |
| 2809 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2810 | # Common helper used by: |
| 2811 | # - component_test_psa_crypto_config_accel_ecc_no_bignum |
| 2812 | # - component_test_psa_crypto_config_accel_ecc_ffdh_no_bignum |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2813 | # |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2814 | # The goal is to build and test accelerating either: |
| 2815 | # - ECC only or |
| 2816 | # - both ECC and FFDH |
| 2817 | # |
| 2818 | # It is meant to be used in conjunction with |
Valerio Setti | 5dfaca4 | 2023-09-05 08:48:51 +0200 | [diff] [blame] | 2819 | # common_test_psa_crypto_config_reference_ecc_ffdh_no_bignum() for drivers |
| 2820 | # coverage analysis in the "analyze_outcomes.py" script. |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2821 | common_test_psa_crypto_config_accel_ecc_ffdh_no_bignum () { |
| 2822 | TEST_TARGET="$1" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2823 | |
Valerio Setti | 5dfaca4 | 2023-09-05 08:48:51 +0200 | [diff] [blame] | 2824 | # This is an internal helper to simplify text message handling |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2825 | if [ "$TEST_TARGET" = "ECC_DH" ]; then |
| 2826 | ACCEL_TEXT="ECC/FFDH" |
| 2827 | REMOVED_TEXT="ECP - DH" |
| 2828 | else |
| 2829 | ACCEL_TEXT="ECC" |
| 2830 | REMOVED_TEXT="ECP" |
| 2831 | fi |
| 2832 | |
| 2833 | msg "build: full + accelerated $ACCEL_TEXT algs + USE_PSA - $REMOVED_TEXT - BIGNUM" |
| 2834 | |
| 2835 | # By default we accelerate all EC keys/algs |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2836 | loc_accel_list="ALG_ECDSA ALG_DETERMINISTIC_ECDSA \ |
| 2837 | ALG_ECDH \ |
| 2838 | ALG_JPAKE \ |
Valerio Setti | 0a342c9 | 2023-09-01 09:12:31 +0200 | [diff] [blame] | 2839 | $(helper_get_psa_key_type_list "ECC")" |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2840 | # Optionally we can also add DH to the list of accelerated items |
| 2841 | if [ "$TEST_TARGET" = "ECC_DH" ]; then |
| 2842 | loc_accel_list="$loc_accel_list \ |
| 2843 | ALG_FFDH \ |
Manuel Pégourié-Gonnard | 0d54a2e | 2023-09-21 12:55:30 +0200 | [diff] [blame^] | 2844 | $(helper_get_psa_key_type_list "FFDH")" |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2845 | fi |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2846 | |
Manuel Pégourié-Gonnard | 5a7523e | 2023-09-20 12:45:01 +0200 | [diff] [blame] | 2847 | # Note: Those are handled in a special way by the libtestdriver machinery, |
| 2848 | # so we only want to include them in the accel list when building the main |
| 2849 | # libraries, hence the use of a separate variable. |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2850 | loc_curve_list="$(helper_get_psa_curve_list)" |
| 2851 | |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2852 | # Configure |
| 2853 | # --------- |
| 2854 | |
| 2855 | # Set common configurations between library's and driver's builds |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2856 | config_psa_crypto_config_accel_ecc_ffdh_no_bignum 1 "$TEST_TARGET" |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2857 | # Disable all the builtin curves. All the required algs are accelerated. |
| 2858 | helper_disable_builtin_curves |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2859 | |
| 2860 | # Build |
| 2861 | # ----- |
| 2862 | |
| 2863 | # Things we wanted supported in libtestdriver1, but not accelerated in the main library: |
Manuel Pégourié-Gonnard | e47c53e | 2023-09-23 08:54:30 +0200 | [diff] [blame] | 2864 | # SHA-1 and all SHA-2/3 variants, as they are used by ECDSA deterministic. |
| 2865 | loc_extra_list="ALG_SHA_1 ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 2866 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2867 | |
| 2868 | helper_libtestdriver1_make_drivers "$loc_accel_list" "$loc_extra_list" |
| 2869 | |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 2870 | helper_libtestdriver1_make_main "$loc_accel_list $loc_curve_list" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2871 | |
| 2872 | # Make sure any built-in EC alg was not re-enabled by accident (additive config) |
| 2873 | not grep mbedtls_ecdsa_ library/ecdsa.o |
| 2874 | not grep mbedtls_ecdh_ library/ecdh.o |
| 2875 | not grep mbedtls_ecjpake_ library/ecjpake.o |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2876 | # Also ensure that ECP, RSA, [DHM] or BIGNUM modules were not re-enabled |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2877 | not grep mbedtls_ecp_ library/ecp.o |
Manuel Pégourié-Gonnard | 06aebe4 | 2023-06-12 18:33:34 +0200 | [diff] [blame] | 2878 | not grep mbedtls_rsa_ library/rsa.o |
Manuel Pégourié-Gonnard | 660bbf2 | 2023-06-12 18:42:40 +0200 | [diff] [blame] | 2879 | not grep mbedtls_mpi_ library/bignum.o |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2880 | not grep mbedtls_dhm_ library/dhm.o |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2881 | |
| 2882 | # Run the tests |
| 2883 | # ------------- |
| 2884 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2885 | msg "test suites: full + accelerated $ACCEL_TEXT algs + USE_PSA - $REMOVED_TEXT - DHM - BIGNUM" |
| 2886 | |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2887 | make test |
| 2888 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2889 | msg "ssl-opt: full + accelerated $ACCEL_TEXT algs + USE_PSA - $REMOVED_TEXT - BIGNUM" |
Valerio Setti | 18535c3 | 2023-07-31 11:27:17 +0200 | [diff] [blame] | 2890 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2891 | } |
| 2892 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2893 | # Common helper used by: |
| 2894 | # - component_test_psa_crypto_config_reference_ecc_no_bignum |
| 2895 | # - component_test_psa_crypto_config_reference_ecc_ffdh_no_bignum |
| 2896 | # |
| 2897 | # The goal is to build and test a reference scenario (i.e. with builtin |
| 2898 | # components) compared to the ones used in |
| 2899 | # common_test_psa_crypto_config_accel_ecc_ffdh_no_bignum() above. |
| 2900 | # |
| 2901 | # It is meant to be used in conjunction with |
| 2902 | # common_test_psa_crypto_config_accel_ecc_ffdh_no_bignum() for drivers' |
| 2903 | # coverage analysis in "analyze_outcomes.py" script. |
| 2904 | common_test_psa_crypto_config_reference_ecc_ffdh_no_bignum () { |
| 2905 | TEST_TARGET="$1" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2906 | |
Valerio Setti | 5dfaca4 | 2023-09-05 08:48:51 +0200 | [diff] [blame] | 2907 | # This is an internal helper to simplify text message handling |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2908 | if [ "$TEST_TARGET" = "ECC_DH" ]; then |
| 2909 | ACCEL_TEXT="ECC/FFDH" |
| 2910 | else |
| 2911 | ACCEL_TEXT="ECC" |
| 2912 | fi |
| 2913 | |
| 2914 | msg "build: full + non accelerated $ACCEL_TEXT algs + USE_PSA" |
| 2915 | |
| 2916 | config_psa_crypto_config_accel_ecc_ffdh_no_bignum 0 "$TEST_TARGET" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2917 | |
| 2918 | make |
| 2919 | |
Valerio Setti | 29c1b4d | 2023-07-27 10:08:45 +0200 | [diff] [blame] | 2920 | msg "test suites: full + non accelerated EC algs + USE_PSA" |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2921 | make test |
| 2922 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2923 | msg "ssl-opt: full + non accelerated $ACCEL_TEXT algs + USE_PSA" |
Valerio Setti | 18535c3 | 2023-07-31 11:27:17 +0200 | [diff] [blame] | 2924 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | abd00d0 | 2023-06-12 17:51:33 +0200 | [diff] [blame] | 2925 | } |
| 2926 | |
Valerio Setti | 4e2f244 | 2023-08-15 10:10:26 +0200 | [diff] [blame] | 2927 | component_test_psa_crypto_config_accel_ecc_no_bignum () { |
| 2928 | common_test_psa_crypto_config_accel_ecc_ffdh_no_bignum "ECC" |
| 2929 | } |
| 2930 | |
| 2931 | component_test_psa_crypto_config_reference_ecc_no_bignum () { |
| 2932 | common_test_psa_crypto_config_reference_ecc_ffdh_no_bignum "ECC" |
| 2933 | } |
| 2934 | |
| 2935 | component_test_psa_crypto_config_accel_ecc_ffdh_no_bignum () { |
| 2936 | common_test_psa_crypto_config_accel_ecc_ffdh_no_bignum "ECC_DH" |
| 2937 | } |
| 2938 | |
| 2939 | component_test_psa_crypto_config_reference_ecc_ffdh_no_bignum () { |
| 2940 | common_test_psa_crypto_config_reference_ecc_ffdh_no_bignum "ECC_DH" |
| 2941 | } |
| 2942 | |
Valerio Setti | ac6d35f | 2023-08-04 12:49:11 +0200 | [diff] [blame] | 2943 | # Helper for setting common configurations between: |
| 2944 | # - component_test_tfm_config_p256m_driver_accel_ec() |
| 2945 | # - component_test_tfm_config() |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2946 | common_tfm_config () { |
| 2947 | # Enable TF-M config |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 2948 | cp configs/tfm_mbedcrypto_config_profile_medium.h "$CONFIG_H" |
| 2949 | cp configs/crypto_config_profile_medium.h "$CRYPTO_CONFIG_H" |
| 2950 | |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2951 | # Adjust for the fact that we're building outside the TF-M environment. |
| 2952 | # |
| 2953 | # TF-M has separation, our build doesn't |
| 2954 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_SPM |
| 2955 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER |
| 2956 | # TF-M provdes its own (dummy) implemenation, from their tree |
| 2957 | scripts/config.py unset MBEDTLS_AES_DECRYPT_ALT |
| 2958 | scripts/config.py unset MBEDTLS_AES_SETKEY_DEC_ALT |
| 2959 | # We have an OS that provides entropy, use it |
| 2960 | scripts/config.py unset MBEDTLS_NO_PLATFORM_ENTROPY |
| 2961 | |
| 2962 | # Other config adjustments to make the tests pass. |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 2963 | # Those should probably be adopted upstream. |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2964 | # |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 2965 | # - USE_PSA_CRYPTO for PK_HAVE_ECC_KEYS |
| 2966 | echo "#define MBEDTLS_USE_PSA_CRYPTO" >> "$CONFIG_H" |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2967 | # pkparse.c and pkwrite.c fail to link without this |
| 2968 | echo "#define MBEDTLS_OID_C" >> "$CONFIG_H" |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 2969 | # - ASN1_[PARSE/WRITE]_C found by check_config.h for pkparse/pkwrite |
| 2970 | echo "#define MBEDTLS_ASN1_PARSE_C" >> "$CONFIG_H" |
| 2971 | echo "#define MBEDTLS_ASN1_WRITE_C" >> "$CONFIG_H" |
| 2972 | # - MD_C for HKDF_C |
| 2973 | echo "#define MBEDTLS_MD_C" >> "$CONFIG_H" |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2974 | |
Manuel Pégourié-Gonnard | f7298cd | 2023-09-18 09:55:24 +0200 | [diff] [blame] | 2975 | # Config adjustments for better test coverage in our environment. |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2976 | # These are not needed just to build and pass tests. |
| 2977 | # |
| 2978 | # Enable filesystem I/O for the benefit of PK parse/write tests. |
| 2979 | echo "#define MBEDTLS_FS_IO" >> "$CONFIG_H" |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 2980 | # Disable this for maximal ASan efficiency |
| 2981 | scripts/config.py unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 2982 | |
Manuel Pégourié-Gonnard | f7298cd | 2023-09-18 09:55:24 +0200 | [diff] [blame] | 2983 | # Config adjustments for features that are not supported |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 2984 | # when using only drivers / by p256-m |
| 2985 | # |
| 2986 | # Disable all the features that auto-enable ECP_LIGHT (see build_info.h) |
| 2987 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE |
| 2988 | # Disable deterministic ECDSA as p256-m only does randomized |
| 2989 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_DETERMINISTIC_ECDSA |
| 2990 | |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2991 | } |
| 2992 | |
Valerio Setti | ac6d35f | 2023-08-04 12:49:11 +0200 | [diff] [blame] | 2993 | # Keep this in sync with component_test_tfm_config() as they are both meant |
| 2994 | # to be used in analyze_outcomes.py for driver's coverage analysis. |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 2995 | component_test_tfm_config_p256m_driver_accel_ec () { |
| 2996 | msg "build: TF-M config + p256m driver + accel ECDH(E)/ECDSA" |
| 2997 | |
| 2998 | common_tfm_config |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 2999 | |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3000 | # Set the list of accelerated components in order to remove them from |
Manuel Pégourié-Gonnard | f7298cd | 2023-09-18 09:55:24 +0200 | [diff] [blame] | 3001 | # builtin support. |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3002 | loc_accel_list="ALG_ECDSA \ |
| 3003 | ALG_ECDH \ |
| 3004 | KEY_TYPE_ECC_KEY_PAIR_BASIC \ |
Manuel Pégourié-Gonnard | 25b45db | 2023-08-08 11:06:21 +0200 | [diff] [blame] | 3005 | KEY_TYPE_ECC_KEY_PAIR_IMPORT \ |
| 3006 | KEY_TYPE_ECC_KEY_PAIR_EXPORT \ |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3007 | KEY_TYPE_ECC_KEY_PAIR_GENERATE \ |
| 3008 | KEY_TYPE_ECC_PUBLIC_KEY" |
| 3009 | loc_accel_flags="$( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )" |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 3010 | |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3011 | # Build crypto library specifying we want to use P256M code for EC operations |
Gilles Peskine | 29d0bfb | 2023-09-20 23:11:33 +0200 | [diff] [blame] | 3012 | make CFLAGS="$ASAN_CFLAGS $loc_accel_flags -DMBEDTLS_PSA_P256M_DRIVER_ENABLED" LDFLAGS="$ASAN_CFLAGS" |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3013 | |
| 3014 | # Make sure any built-in EC alg was not re-enabled by accident (additive config) |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 3015 | not grep mbedtls_ecdsa_ library/ecdsa.o |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3016 | not grep mbedtls_ecdh_ library/ecdh.o |
| 3017 | not grep mbedtls_ecjpake_ library/ecjpake.o |
| 3018 | # Also ensure that ECP, RSA, DHM or BIGNUM modules were not re-enabled |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 3019 | not grep mbedtls_ecp_ library/ecp.o |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3020 | not grep mbedtls_rsa_ library/rsa.o |
| 3021 | not grep mbedtls_dhm_ library/dhm.o |
Manuel Pégourié-Gonnard | 96839e7 | 2023-08-08 13:01:29 +0200 | [diff] [blame] | 3022 | not grep mbedtls_mpi_ library/bignum.o |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3023 | |
| 3024 | # Run the tests |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 3025 | msg "test: TF-M config + p256m driver + accel ECDH(E)/ECDSA" |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3026 | make test |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 3027 | } |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3028 | |
Valerio Setti | ac6d35f | 2023-08-04 12:49:11 +0200 | [diff] [blame] | 3029 | # Keep this in sync with component_test_tfm_config_p256m_driver_accel_ec() as |
| 3030 | # they are both meant to be used in analyze_outcomes.py for driver's coverage |
| 3031 | # analysis. |
Valerio Setti | 52ba0e3 | 2023-08-04 12:43:03 +0200 | [diff] [blame] | 3032 | component_test_tfm_config() { |
| 3033 | common_tfm_config |
| 3034 | |
| 3035 | msg "build: TF-M config" |
| 3036 | make tests |
| 3037 | |
| 3038 | msg "test: TF-M config" |
| 3039 | make test |
Valerio Setti | c5c4bd2 | 2023-08-03 14:28:20 +0200 | [diff] [blame] | 3040 | } |
| 3041 | |
Valerio Setti | 5a57e2a | 2023-08-02 11:30:50 +0200 | [diff] [blame] | 3042 | # Common helper for component_full_without_ecdhe_ecdsa() and |
| 3043 | # component_full_without_ecdhe_ecdsa_and_tls13() which: |
| 3044 | # - starts from the "full" configuration minus the list of symbols passed in |
| 3045 | # as 1st parameter |
| 3046 | # - build |
| 3047 | # - test only TLS (i.e. test_suite_tls and ssl-opt) |
| 3048 | build_full_minus_something_and_test_tls () { |
| 3049 | SYMBOLS_TO_DISABLE="$1" |
| 3050 | |
| 3051 | msg "build: full minus something, test TLS" |
| 3052 | |
| 3053 | scripts/config.py full |
| 3054 | for SYM in $SYMBOLS_TO_DISABLE; do |
| 3055 | echo "Disabling $SYM" |
| 3056 | scripts/config.py unset $SYM |
| 3057 | done |
| 3058 | |
| 3059 | make |
| 3060 | |
| 3061 | msg "test: full minus something, test TLS" |
| 3062 | ( cd tests; ./test_suite_ssl ) |
| 3063 | |
| 3064 | msg "ssl-opt: full minus something, test TLS" |
| 3065 | tests/ssl-opt.sh |
| 3066 | } |
| 3067 | |
| 3068 | component_full_without_ecdhe_ecdsa () { |
| 3069 | build_full_minus_something_and_test_tls "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED" |
| 3070 | } |
| 3071 | |
| 3072 | component_full_without_ecdhe_ecdsa_and_tls13 () { |
| 3073 | build_full_minus_something_and_test_tls "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 3074 | MBEDTLS_SSL_PROTO_TLS1_3" |
| 3075 | } |
| 3076 | |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3077 | # This is an helper used by: |
| 3078 | # - component_test_psa_ecc_key_pair_no_derive |
| 3079 | # - component_test_psa_ecc_key_pair_no_generate |
| 3080 | # The goal is to test with all PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy symbols |
| 3081 | # enabled, but one. Input arguments are as follows: |
| 3082 | # - $1 is the key type under test, i.e. ECC/RSA/DH |
| 3083 | # - $2 is the key option to be unset (i.e. generate, derive, etc) |
Valerio Setti | a983655 | 2023-06-22 11:22:23 +0200 | [diff] [blame] | 3084 | build_and_test_psa_want_key_pair_partial() { |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3085 | KEY_TYPE=$1 |
| 3086 | UNSET_OPTION=$2 |
Valerio Setti | f6587be | 2023-06-22 11:33:14 +0200 | [diff] [blame] | 3087 | DISABLED_PSA_WANT="PSA_WANT_KEY_TYPE_${KEY_TYPE}_KEY_PAIR_${UNSET_OPTION}" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3088 | |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3089 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO - ${DISABLED_PSA_WANT}" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3090 | scripts/config.py full |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3091 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 3092 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 3093 | |
| 3094 | # All the PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy are enabled by default in |
| 3095 | # crypto_config.h so we just disable the one we don't want. |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3096 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset "$DISABLED_PSA_WANT" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3097 | |
Valerio Setti | f6587be | 2023-06-22 11:33:14 +0200 | [diff] [blame] | 3098 | make CC=gcc CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3099 | |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3100 | msg "test: full - MBEDTLS_USE_PSA_CRYPTO - ${DISABLED_PSA_WANT}" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3101 | make test |
| 3102 | } |
| 3103 | |
| 3104 | component_test_psa_ecc_key_pair_no_derive() { |
Valerio Setti | a983655 | 2023-06-22 11:22:23 +0200 | [diff] [blame] | 3105 | build_and_test_psa_want_key_pair_partial "ECC" "DERIVE" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3106 | } |
| 3107 | |
| 3108 | component_test_psa_ecc_key_pair_no_generate() { |
Valerio Setti | a983655 | 2023-06-22 11:22:23 +0200 | [diff] [blame] | 3109 | build_and_test_psa_want_key_pair_partial "ECC" "GENERATE" |
Valerio Setti | 249b18a | 2023-06-20 12:08:30 +0200 | [diff] [blame] | 3110 | } |
| 3111 | |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3112 | component_test_psa_crypto_config_accel_rsa_signature () { |
| 3113 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated RSA signature" |
| 3114 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3115 | loc_accel_list="ALG_RSA_PKCS1V15_SIGN ALG_RSA_PSS KEY_TYPE_RSA_KEY_PAIR KEY_TYPE_RSA_PUBLIC_KEY" |
| 3116 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3117 | # Configure |
| 3118 | # --------- |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3119 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3120 | # Start from default config (no TLS 1.3, no USE_PSA) |
| 3121 | helper_libtestdriver1_adjust_config "default" |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3122 | |
| 3123 | # It seems it is not possible to remove only the support for RSA signature |
| 3124 | # in the library. Thus we have to remove all RSA support (signature and |
| 3125 | # encryption/decryption). AS there is no driver support for asymmetric |
| 3126 | # encryption/decryption so far remove RSA encryption/decryption from the |
| 3127 | # application algorithm list. |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3128 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
| 3129 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3130 | |
Manuel Pégourié-Gonnard | aed1d78 | 2023-06-12 17:22:24 +0200 | [diff] [blame] | 3131 | # Remove RSA support and its dependencies |
| 3132 | scripts/config.py unset MBEDTLS_RSA_C |
| 3133 | scripts/config.py unset MBEDTLS_PKCS1_V15 |
| 3134 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 3135 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 3136 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 3137 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 3138 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 3139 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED |
| 3140 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
| 3141 | |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3142 | # Make sure both the library and the test library support the SHA hash |
| 3143 | # algorithms and only those ones (SHA256 is included by default). That way: |
| 3144 | # - the test library can compute the RSA signatures even in the case of a |
| 3145 | # composite RSA signature algorithm based on a SHA hash (no other hash |
| 3146 | # used in the unit tests). |
| 3147 | # - the dependency of RSA signature tests on PSA_WANT_ALG_SHA_xyz is |
| 3148 | # fulfilled as the hash SHA algorithm is supported by the library, and |
| 3149 | # thus the tests are run, not skipped. |
| 3150 | # - when testing a signature key with an algorithm wildcard built from |
| 3151 | # PSA_ALG_ANY_HASH as algorithm to test with the key, the chosen hash |
| 3152 | # algorithm based on the hashes supported by the library is also |
| 3153 | # supported by the test library. |
Manuel Pégourié-Gonnard | aed1d78 | 2023-06-12 17:22:24 +0200 | [diff] [blame] | 3154 | # Disable unwanted hashes here, we'll enable hashes we want in loc_extra_list. |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3155 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3156 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160_C |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3157 | scripts/config.py unset MBEDTLS_MD5_C |
| 3158 | scripts/config.py unset MBEDTLS_RIPEMD160_C |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3159 | |
| 3160 | # We need PEM parsing in the test library as well to support the import |
| 3161 | # of PEM encoded RSA keys. |
Ronald Cron | 7612d8c | 2023-07-20 10:03:54 +0200 | [diff] [blame] | 3162 | scripts/config.py -f "$CONFIG_TEST_DRIVER_H" set MBEDTLS_PEM_PARSE_C |
| 3163 | scripts/config.py -f "$CONFIG_TEST_DRIVER_H" set MBEDTLS_BASE64_C |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3164 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3165 | # Build |
| 3166 | # ----- |
| 3167 | |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3168 | # These hashes are needed for some RSA-PSS signature tests. |
Manuel Pégourié-Gonnard | e47c53e | 2023-09-23 08:54:30 +0200 | [diff] [blame] | 3169 | loc_extra_list="ALG_SHA_1 ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 3170 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3171 | helper_libtestdriver1_make_drivers "$loc_accel_list" "$loc_extra_list" |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3172 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3173 | helper_libtestdriver1_make_main "$loc_accel_list" |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3174 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3175 | # Make sure this was not re-enabled by accident (additive config) |
Gilles Peskine | 827dbd9 | 2022-02-04 00:30:54 +0100 | [diff] [blame] | 3176 | not grep mbedtls_rsa_rsassa_pkcs1_v15_sign library/rsa.o |
| 3177 | not grep mbedtls_rsa_rsassa_pss_sign_ext library/rsa.o |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3178 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3179 | # Run the tests |
| 3180 | # ------------- |
| 3181 | |
Ronald Cron | 403c15c | 2021-09-13 09:38:05 +0200 | [diff] [blame] | 3182 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated RSA signature" |
| 3183 | make test |
| 3184 | } |
| 3185 | |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3186 | # This is a temporary test to verify that full RSA support is present even when |
Valerio Setti | 01cc88a | 2023-06-15 11:53:08 +0200 | [diff] [blame] | 3187 | # only one single new symbols (PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC) is defined. |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3188 | component_test_new_psa_want_key_pair_symbol() { |
Valerio Setti | 01cc88a | 2023-06-15 11:53:08 +0200 | [diff] [blame] | 3189 | msg "Build: crypto config - MBEDTLS_RSA_C + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC" |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3190 | |
Valerio Setti | 4590bc2 | 2023-06-13 15:39:23 +0200 | [diff] [blame] | 3191 | # Create a temporary output file unless there is already one set |
| 3192 | if [ "$MBEDTLS_TEST_OUTCOME_FILE" ]; then |
| 3193 | REMOVE_OUTCOME_ON_EXIT="no" |
| 3194 | else |
| 3195 | REMOVE_OUTCOME_ON_EXIT="yes" |
| 3196 | MBEDTLS_TEST_OUTCOME_FILE="$PWD/out.csv" |
| 3197 | export MBEDTLS_TEST_OUTCOME_FILE |
| 3198 | fi |
| 3199 | |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3200 | # Start from crypto configuration |
| 3201 | scripts/config.py crypto |
| 3202 | |
| 3203 | # Remove RSA support and its dependencies |
| 3204 | scripts/config.py unset MBEDTLS_PKCS1_V15 |
| 3205 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 3206 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED |
| 3207 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 3208 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 3209 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED |
| 3210 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
| 3211 | scripts/config.py unset MBEDTLS_RSA_C |
| 3212 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 3213 | |
| 3214 | # Enable PSA support |
| 3215 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 3216 | |
Valerio Setti | 01cc88a | 2023-06-15 11:53:08 +0200 | [diff] [blame] | 3217 | # Keep only PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC enabled in order to ensure |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3218 | # that proper translations is done in crypto_legacy.h. |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3219 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT |
| 3220 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT |
| 3221 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3222 | |
| 3223 | make |
| 3224 | |
Valerio Setti | 01cc88a | 2023-06-15 11:53:08 +0200 | [diff] [blame] | 3225 | msg "Test: crypto config - MBEDTLS_RSA_C + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC" |
Valerio Setti | 4590bc2 | 2023-06-13 15:39:23 +0200 | [diff] [blame] | 3226 | make test |
| 3227 | |
| 3228 | # Parse only 1 relevant line from the outcome file, i.e. a test which is |
| 3229 | # performing RSA signature. |
| 3230 | msg "Verify that 'RSA PKCS1 Sign #1 (SHA512, 1536 bits RSA)' is PASS" |
| 3231 | cat $MBEDTLS_TEST_OUTCOME_FILE | grep 'RSA PKCS1 Sign #1 (SHA512, 1536 bits RSA)' | grep -q "PASS" |
| 3232 | |
| 3233 | if [ "$REMOVE_OUTCOME_ON_EXIT" == "yes" ]; then |
| 3234 | rm $MBEDTLS_TEST_OUTCOME_FILE |
| 3235 | fi |
Valerio Setti | a1a0b1b | 2023-06-13 14:19:03 +0200 | [diff] [blame] | 3236 | } |
| 3237 | |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3238 | component_test_psa_crypto_config_accel_hash () { |
| 3239 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated hash" |
| 3240 | |
Manuel Pégourié-Gonnard | cc21ad4 | 2023-09-22 09:46:14 +0200 | [diff] [blame] | 3241 | loc_accel_list="ALG_MD5 ALG_RIPEMD160 ALG_SHA_1 \ |
| 3242 | ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 3243 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3244 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3245 | # Configure |
| 3246 | # --------- |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3247 | |
| 3248 | # Start from default config (no TLS 1.3, no USE_PSA) |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3249 | helper_libtestdriver1_adjust_config "default" |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3250 | |
| 3251 | # Disable the things that are being accelerated |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3252 | scripts/config.py unset MBEDTLS_MD5_C |
| 3253 | scripts/config.py unset MBEDTLS_RIPEMD160_C |
| 3254 | scripts/config.py unset MBEDTLS_SHA1_C |
Manuel Pégourié-Gonnard | c584c27 | 2023-03-22 00:32:04 +0100 | [diff] [blame] | 3255 | scripts/config.py unset MBEDTLS_SHA224_C |
| 3256 | scripts/config.py unset MBEDTLS_SHA256_C |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3257 | scripts/config.py unset MBEDTLS_SHA384_C |
| 3258 | scripts/config.py unset MBEDTLS_SHA512_C |
Manuel Pégourié-Gonnard | cc21ad4 | 2023-09-22 09:46:14 +0200 | [diff] [blame] | 3259 | scripts/config.py unset MBEDTLS_SHA3_C |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3260 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3261 | # Build |
| 3262 | # ----- |
| 3263 | |
| 3264 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 3265 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3266 | helper_libtestdriver1_make_main "$loc_accel_list" |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3267 | |
Manuel Pégourié-Gonnard | c584c27 | 2023-03-22 00:32:04 +0100 | [diff] [blame] | 3268 | # There's a risk of something getting re-enabled via config_psa.h; |
| 3269 | # make sure it did not happen. Note: it's OK for MD_C to be enabled. |
| 3270 | not grep mbedtls_md5 library/md5.o |
| 3271 | not grep mbedtls_sha1 library/sha1.o |
| 3272 | not grep mbedtls_sha256 library/sha256.o |
| 3273 | not grep mbedtls_sha512 library/sha512.o |
| 3274 | not grep mbedtls_ripemd160 library/ripemd160.o |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3275 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3276 | # Run the tests |
| 3277 | # ------------- |
| 3278 | |
Ronald Cron | b231245 | 2021-05-08 14:32:59 +0200 | [diff] [blame] | 3279 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated hash" |
| 3280 | make test |
| 3281 | } |
| 3282 | |
Manuel Pégourié-Gonnard | 9b14639 | 2023-03-09 15:56:14 +0100 | [diff] [blame] | 3283 | component_test_psa_crypto_config_accel_hash_keep_builtins () { |
| 3284 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated+builtin hash" |
| 3285 | # This component ensures that all the test cases for |
| 3286 | # md_psa_dynamic_dispatch with legacy+driver in test_suite_md are run. |
| 3287 | |
Manuel Pégourié-Gonnard | cc21ad4 | 2023-09-22 09:46:14 +0200 | [diff] [blame] | 3288 | loc_accel_list="ALG_MD5 ALG_RIPEMD160 ALG_SHA_1 \ |
| 3289 | ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 3290 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Manuel Pégourié-Gonnard | 9b14639 | 2023-03-09 15:56:14 +0100 | [diff] [blame] | 3291 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3292 | # Start from default config (no TLS 1.3, no USE_PSA) |
| 3293 | helper_libtestdriver1_adjust_config "default" |
Manuel Pégourié-Gonnard | 9b14639 | 2023-03-09 15:56:14 +0100 | [diff] [blame] | 3294 | |
Manuel Pégourié-Gonnard | 31639e4 | 2023-05-25 10:07:31 +0200 | [diff] [blame] | 3295 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
Manuel Pégourié-Gonnard | 9b14639 | 2023-03-09 15:56:14 +0100 | [diff] [blame] | 3296 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3297 | helper_libtestdriver1_make_main "$loc_accel_list" |
Manuel Pégourié-Gonnard | 9b14639 | 2023-03-09 15:56:14 +0100 | [diff] [blame] | 3298 | |
| 3299 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated+builtin hash" |
| 3300 | make test |
| 3301 | } |
| 3302 | |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3303 | # Auxiliary function to build config for hashes with and without drivers |
| 3304 | config_psa_crypto_hash_use_psa () { |
| 3305 | DRIVER_ONLY="$1" |
| 3306 | # start with config full for maximum coverage (also enables USE_PSA) |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3307 | helper_libtestdriver1_adjust_config "full" |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3308 | if [ "$DRIVER_ONLY" -eq 1 ]; then |
| 3309 | # disable the built-in implementation of hashes |
| 3310 | scripts/config.py unset MBEDTLS_MD5_C |
| 3311 | scripts/config.py unset MBEDTLS_RIPEMD160_C |
| 3312 | scripts/config.py unset MBEDTLS_SHA1_C |
| 3313 | scripts/config.py unset MBEDTLS_SHA224_C |
| 3314 | scripts/config.py unset MBEDTLS_SHA256_C # see external RNG below |
| 3315 | scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT |
| 3316 | scripts/config.py unset MBEDTLS_SHA384_C |
| 3317 | scripts/config.py unset MBEDTLS_SHA512_C |
| 3318 | scripts/config.py unset MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT |
Manuel Pégourié-Gonnard | cc21ad4 | 2023-09-22 09:46:14 +0200 | [diff] [blame] | 3319 | scripts/config.py unset MBEDTLS_SHA3_C |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3320 | fi |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3321 | } |
| 3322 | |
Przemek Stekiel | 120ed8f | 2022-10-27 10:29:15 +0200 | [diff] [blame] | 3323 | # Note that component_test_psa_crypto_config_reference_hash_use_psa |
| 3324 | # is related to this component and both components need to be kept in sync. |
| 3325 | # For details please see comments for component_test_psa_crypto_config_reference_hash_use_psa. |
Manuel Pégourié-Gonnard | 525add6 | 2022-07-06 13:06:57 +0200 | [diff] [blame] | 3326 | component_test_psa_crypto_config_accel_hash_use_psa () { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3327 | msg "test: full with accelerated hashes" |
Manuel Pégourié-Gonnard | 525add6 | 2022-07-06 13:06:57 +0200 | [diff] [blame] | 3328 | |
Manuel Pégourié-Gonnard | cc21ad4 | 2023-09-22 09:46:14 +0200 | [diff] [blame] | 3329 | loc_accel_list="ALG_MD5 ALG_RIPEMD160 ALG_SHA_1 \ |
| 3330 | ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 3331 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3332 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3333 | # Configure |
| 3334 | # --------- |
Manuel Pégourié-Gonnard | 525add6 | 2022-07-06 13:06:57 +0200 | [diff] [blame] | 3335 | |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3336 | config_psa_crypto_hash_use_psa 1 |
Manuel Pégourié-Gonnard | f0f63bc | 2022-07-08 19:12:33 +0200 | [diff] [blame] | 3337 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3338 | # Build |
| 3339 | # ----- |
| 3340 | |
| 3341 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 3342 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3343 | helper_libtestdriver1_make_main "$loc_accel_list" |
Manuel Pégourié-Gonnard | 525add6 | 2022-07-06 13:06:57 +0200 | [diff] [blame] | 3344 | |
Manuel Pégourié-Gonnard | f0f63bc | 2022-07-08 19:12:33 +0200 | [diff] [blame] | 3345 | # There's a risk of something getting re-enabled via config_psa.h; |
Manuel Pégourié-Gonnard | 49e67f8 | 2023-03-16 11:39:20 +0100 | [diff] [blame] | 3346 | # make sure it did not happen. Note: it's OK for MD_C to be enabled. |
Manuel Pégourié-Gonnard | f0f63bc | 2022-07-08 19:12:33 +0200 | [diff] [blame] | 3347 | not grep mbedtls_md5 library/md5.o |
| 3348 | not grep mbedtls_sha1 library/sha1.o |
Manuel Pégourié-Gonnard | 7b0825d | 2022-07-11 11:06:09 +0200 | [diff] [blame] | 3349 | not grep mbedtls_sha256 library/sha256.o |
Manuel Pégourié-Gonnard | f0f63bc | 2022-07-08 19:12:33 +0200 | [diff] [blame] | 3350 | not grep mbedtls_sha512 library/sha512.o |
| 3351 | not grep mbedtls_ripemd160 library/ripemd160.o |
| 3352 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3353 | # Run the tests |
| 3354 | # ------------- |
| 3355 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3356 | msg "test: full with accelerated hashes" |
Manuel Pégourié-Gonnard | 525add6 | 2022-07-06 13:06:57 +0200 | [diff] [blame] | 3357 | make test |
Andrzej Kurek | 07e3570 | 2022-09-05 15:39:23 -0400 | [diff] [blame] | 3358 | |
Manuel Pégourié-Gonnard | 30d9466 | 2022-11-29 12:37:53 +0100 | [diff] [blame] | 3359 | # This is mostly useful so that we can later compare outcome files with |
| 3360 | # the reference config in analyze_outcomes.py, to check that the |
| 3361 | # dependency declarations in ssl-opt.sh and in TLS code are correct. |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3362 | msg "test: ssl-opt.sh, full with accelerated hashes" |
Przemek Stekiel | 5f6f32a | 2022-10-27 08:24:43 +0200 | [diff] [blame] | 3363 | tests/ssl-opt.sh |
Andrzej Kurek | 07e3570 | 2022-09-05 15:39:23 -0400 | [diff] [blame] | 3364 | |
Manuel Pégourié-Gonnard | 30d9466 | 2022-11-29 12:37:53 +0100 | [diff] [blame] | 3365 | # This is to make sure all ciphersuites are exercised, but we don't need |
| 3366 | # interop testing (besides, we already got some from ssl-opt.sh). |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3367 | msg "test: compat.sh, full with accelerated hashes" |
Manuel Pégourié-Gonnard | 30d9466 | 2022-11-29 12:37:53 +0100 | [diff] [blame] | 3368 | tests/compat.sh -p mbedTLS -V YES |
Manuel Pégourié-Gonnard | 525add6 | 2022-07-06 13:06:57 +0200 | [diff] [blame] | 3369 | } |
| 3370 | |
Przemek Stekiel | 120ed8f | 2022-10-27 10:29:15 +0200 | [diff] [blame] | 3371 | # This component provides reference configuration for test_psa_crypto_config_accel_hash_use_psa |
| 3372 | # without accelerated hash. The outcome from both components are used by the analyze_outcomes.py |
| 3373 | # script to find regression in test coverage when accelerated hash is used (tests and ssl-opt). |
| 3374 | # Both components need to be kept in sync. |
Przemek Stekiel | 01df9dd | 2022-10-20 14:21:21 +0200 | [diff] [blame] | 3375 | component_test_psa_crypto_config_reference_hash_use_psa() { |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3376 | msg "test: full without accelerated hashes" |
Przemek Stekiel | aa88e0b | 2022-11-15 13:21:14 +0100 | [diff] [blame] | 3377 | |
| 3378 | config_psa_crypto_hash_use_psa 0 |
Przemek Stekiel | 01df9dd | 2022-10-20 14:21:21 +0200 | [diff] [blame] | 3379 | |
Przemek Stekiel | ab0451b | 2022-10-24 11:29:35 +0200 | [diff] [blame] | 3380 | make |
| 3381 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3382 | msg "test: full without accelerated hashes" |
Przemek Stekiel | 01df9dd | 2022-10-20 14:21:21 +0200 | [diff] [blame] | 3383 | make test |
| 3384 | |
Gilles Peskine | 14302ed | 2023-07-19 19:30:04 +0200 | [diff] [blame] | 3385 | msg "test: ssl-opt.sh, full without accelerated hashes" |
Przemek Stekiel | 5f6f32a | 2022-10-27 08:24:43 +0200 | [diff] [blame] | 3386 | tests/ssl-opt.sh |
Ronald Cron | 3a8714d | 2021-10-18 11:26:01 +0200 | [diff] [blame] | 3387 | } |
Manuel Pégourié-Gonnard | 97ab2a3 | 2022-07-06 10:46:57 +0200 | [diff] [blame] | 3388 | |
John Durkop | 4377bf7 | 2020-10-23 01:26:57 -0700 | [diff] [blame] | 3389 | component_test_psa_crypto_config_accel_cipher () { |
| 3390 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated cipher" |
| 3391 | |
| 3392 | loc_accel_list="ALG_CBC_NO_PADDING ALG_CBC_PKCS7 ALG_CTR ALG_CFB ALG_OFB ALG_XTS KEY_TYPE_DES" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3393 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3394 | # Configure |
| 3395 | # --------- |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3396 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3397 | # Start from the default config (no TLS 1.3, no USE_PSA) |
| 3398 | helper_libtestdriver1_adjust_config "default" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3399 | |
Manuel Pégourié-Gonnard | 7ae342f | 2023-06-08 09:26:04 +0200 | [diff] [blame] | 3400 | # There is no intended accelerator support for ALG CMAC. Therefore, asking |
| 3401 | # for it in the build implies the inclusion of the Mbed TLS cipher |
| 3402 | # operations. As we want to test here with cipher operations solely |
| 3403 | # supported by accelerators, disabled this PSA configuration option. |
| 3404 | # (Note: the same applies to STREAM_CIPHER and ECB_NO_PADDING, which are |
| 3405 | # already disabled by helper_libtestdriver1_adjust_config above.) |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3406 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CMAC |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3407 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3408 | # Disable the things that are being accelerated |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3409 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC |
| 3410 | scripts/config.py unset MBEDTLS_CIPHER_PADDING_PKCS7 |
| 3411 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CTR |
| 3412 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CFB |
| 3413 | scripts/config.py unset MBEDTLS_CIPHER_MODE_OFB |
| 3414 | scripts/config.py unset MBEDTLS_CIPHER_MODE_XTS |
| 3415 | scripts/config.py unset MBEDTLS_DES_C |
| 3416 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3417 | # Build |
| 3418 | # ----- |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3419 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3420 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 3421 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3422 | helper_libtestdriver1_make_main "$loc_accel_list" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3423 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3424 | # Make sure this was not re-enabled by accident (additive config) |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3425 | not grep mbedtls_des* library/des.o |
| 3426 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3427 | # Run the tests |
| 3428 | # ------------- |
| 3429 | |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3430 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated cipher" |
| 3431 | make test |
| 3432 | } |
| 3433 | |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3434 | component_test_psa_crypto_config_accel_aead () { |
| 3435 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated AEAD" |
| 3436 | |
Przemek Stekiel | ee1bb41 | 2022-10-11 11:52:25 +0200 | [diff] [blame] | 3437 | loc_accel_list="ALG_GCM ALG_CCM ALG_CHACHA20_POLY1305 KEY_TYPE_AES KEY_TYPE_CHACHA20 KEY_TYPE_ARIA KEY_TYPE_CAMELLIA" |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3438 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3439 | # Configure |
| 3440 | # --------- |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3441 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3442 | # Start from default config (no TLS 1.3, no USE_PSA) |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3443 | helper_libtestdriver1_adjust_config "default" |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3444 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3445 | # Disable things that are being accelerated |
Przemek Stekiel | ee1bb41 | 2022-10-11 11:52:25 +0200 | [diff] [blame] | 3446 | scripts/config.py unset MBEDTLS_GCM_C |
| 3447 | scripts/config.py unset MBEDTLS_CCM_C |
| 3448 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
| 3449 | # Features that depend on AEAD |
| 3450 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
Przemek Stekiel | 072fad1 | 2022-10-13 09:59:52 +0200 | [diff] [blame] | 3451 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3452 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3453 | # Build |
| 3454 | # ----- |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3455 | |
Manuel Pégourié-Gonnard | 8df87bf | 2023-06-12 17:09:38 +0200 | [diff] [blame] | 3456 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 3457 | |
Manuel Pégourié-Gonnard | 27dd73f | 2023-05-25 10:39:23 +0200 | [diff] [blame] | 3458 | helper_libtestdriver1_make_main "$loc_accel_list" |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3459 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3460 | # Make sure this was not re-enabled by accident (additive config) |
Przemek Stekiel | ee1bb41 | 2022-10-11 11:52:25 +0200 | [diff] [blame] | 3461 | not grep mbedtls_ccm library/ccm.o |
| 3462 | not grep mbedtls_gcm library/gcm.o |
| 3463 | not grep mbedtls_chachapoly library/chachapoly.o |
| 3464 | |
Manuel Pégourié-Gonnard | 239094d | 2023-05-31 12:51:50 +0200 | [diff] [blame] | 3465 | # Run the tests |
| 3466 | # ------------- |
| 3467 | |
Przemek Stekiel | e290f2e | 2022-10-02 20:58:39 +0200 | [diff] [blame] | 3468 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated AEAD" |
| 3469 | make test |
| 3470 | } |
| 3471 | |
Gilles Peskine | 36dea15 | 2023-07-20 22:19:45 +0200 | [diff] [blame] | 3472 | component_test_aead_chachapoly_disabled() { |
| 3473 | msg "build: full minus CHACHAPOLY" |
John Durkop | f4c4cb0 | 2020-10-28 20:09:55 -0700 | [diff] [blame] | 3474 | scripts/config.py full |
John Durkop | 9814fa2 | 2020-11-04 12:28:15 -0800 | [diff] [blame] | 3475 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3476 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CHACHA20_POLY1305 |
John Durkop | f4c4cb0 | 2020-10-28 20:09:55 -0700 | [diff] [blame] | 3477 | make CC=gcc CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS" |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3478 | |
Gilles Peskine | 36dea15 | 2023-07-20 22:19:45 +0200 | [diff] [blame] | 3479 | msg "test: full minus CHACHAPOLY" |
| 3480 | make test |
| 3481 | } |
| 3482 | |
| 3483 | component_test_aead_only_ccm() { |
| 3484 | msg "build: full minus CHACHAPOLY and GCM" |
| 3485 | scripts/config.py full |
| 3486 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
| 3487 | scripts/config.py unset MBEDTLS_GCM_C |
| 3488 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CHACHA20_POLY1305 |
| 3489 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_GCM |
| 3490 | make CC=gcc CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3491 | |
| 3492 | msg "test: full minus CHACHAPOLY and GCM" |
John Durkop | 9814fa2 | 2020-11-04 12:28:15 -0800 | [diff] [blame] | 3493 | make test |
John Durkop | f4c4cb0 | 2020-10-28 20:09:55 -0700 | [diff] [blame] | 3494 | } |
| 3495 | |
Ronald Cron | e501d0e | 2023-07-10 08:31:19 +0200 | [diff] [blame] | 3496 | component_test_ccm_aes_sha256() { |
| 3497 | msg "build: CCM + AES + SHA256 configuration" |
| 3498 | |
Ronald Cron | 7612d8c | 2023-07-20 10:03:54 +0200 | [diff] [blame] | 3499 | cp "$CONFIG_TEST_DRIVER_H" "$CONFIG_H" |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3500 | cp configs/crypto-config-ccm-aes-sha256.h "$CRYPTO_CONFIG_H" |
Ronald Cron | e501d0e | 2023-07-10 08:31:19 +0200 | [diff] [blame] | 3501 | |
| 3502 | make CC=gcc |
| 3503 | |
| 3504 | msg "test: CCM + AES + SHA256 configuration" |
| 3505 | make test |
| 3506 | } |
| 3507 | |
John Durkop | 9814fa2 | 2020-11-04 12:28:15 -0800 | [diff] [blame] | 3508 | # This should be renamed to test and updated once the accelerator ECDH code is in place and ready to test. |
John Durkop | f4c4cb0 | 2020-10-28 20:09:55 -0700 | [diff] [blame] | 3509 | component_build_psa_accel_alg_ecdh() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3510 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_ECDH without MBEDTLS_ECDH_C" |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3511 | scripts/config.py full |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3512 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3513 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3514 | scripts/config.py unset MBEDTLS_ECDH_C |
| 3515 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 3516 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 3517 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 3518 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 3519 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED |
| 3520 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3521 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_ECDH -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3522 | } |
| 3523 | |
| 3524 | # This should be renamed to test and updated once the accelerator ECC key pair code is in place and ready to test. |
| 3525 | component_build_psa_accel_key_type_ecc_key_pair() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3526 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_xxx" |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3527 | scripts/config.py full |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3528 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3529 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Valerio Setti | b2fd673 | 2023-08-15 17:10:47 +0200 | [diff] [blame] | 3530 | scripts/config.py -f "$CRYPTO_CONFIG_H" set-all "PSA_WANT_KEY_TYPE_ECC_[0-9A-Z_a-z]*" |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3531 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3532 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3533 | } |
| 3534 | |
| 3535 | # This should be renamed to test and updated once the accelerator ECC public key code is in place and ready to test. |
| 3536 | component_build_psa_accel_key_type_ecc_public_key() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3537 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3538 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3539 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3540 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3541 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1 |
| 3542 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC |
| 3543 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT |
| 3544 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT |
| 3545 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE |
| 3546 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3547 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3548 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3549 | } |
| 3550 | |
| 3551 | # This should be renamed to test and updated once the accelerator HMAC code is in place and ready to test. |
| 3552 | component_build_psa_accel_alg_hmac() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3553 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_HMAC" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3554 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3555 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3556 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3557 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3558 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HMAC -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3559 | } |
| 3560 | |
| 3561 | # This should be renamed to test and updated once the accelerator HKDF code is in place and ready to test. |
| 3562 | component_build_psa_accel_alg_hkdf() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3563 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_HKDF without MBEDTLS_HKDF_C" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3564 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3565 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3566 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3567 | scripts/config.py unset MBEDTLS_HKDF_C |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 3568 | # Make sure to unset TLS1_3 since it requires HKDF_C and will not build properly without it. |
| 3569 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3570 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3571 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HKDF -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3572 | } |
| 3573 | |
| 3574 | # This should be renamed to test and updated once the accelerator MD5 code is in place and ready to test. |
| 3575 | component_build_psa_accel_alg_md5() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3576 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_MD5 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3577 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3578 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3579 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3580 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 3581 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 3582 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 3583 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 3584 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 3585 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 3586 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
Gilles Peskine | fa65237 | 2022-10-13 22:05:38 +0200 | [diff] [blame] | 3587 | scripts/config.py unset MBEDTLS_LMS_C |
| 3588 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3589 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3590 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_MD5 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3591 | } |
| 3592 | |
| 3593 | # This should be renamed to test and updated once the accelerator RIPEMD160 code is in place and ready to test. |
| 3594 | component_build_psa_accel_alg_ripemd160() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3595 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RIPEMD160 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3596 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3597 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3598 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3599 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3600 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 3601 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 3602 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 3603 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 3604 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 3605 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
Gilles Peskine | fa65237 | 2022-10-13 22:05:38 +0200 | [diff] [blame] | 3606 | scripts/config.py unset MBEDTLS_LMS_C |
| 3607 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3608 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3609 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RIPEMD160 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3610 | } |
| 3611 | |
| 3612 | # This should be renamed to test and updated once the accelerator SHA1 code is in place and ready to test. |
| 3613 | component_build_psa_accel_alg_sha1() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3614 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_1 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3615 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3616 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3617 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3618 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3619 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 3620 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 3621 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 3622 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 3623 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 3624 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
Gilles Peskine | fa65237 | 2022-10-13 22:05:38 +0200 | [diff] [blame] | 3625 | scripts/config.py unset MBEDTLS_LMS_C |
| 3626 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3627 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3628 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_1 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3629 | } |
| 3630 | |
| 3631 | # This should be renamed to test and updated once the accelerator SHA224 code is in place and ready to test. |
| 3632 | component_build_psa_accel_alg_sha224() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3633 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_224 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3634 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3635 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3636 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3637 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3638 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 3639 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 3640 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 3641 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 3642 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3643 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3644 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_224 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3645 | } |
| 3646 | |
| 3647 | # This should be renamed to test and updated once the accelerator SHA256 code is in place and ready to test. |
| 3648 | component_build_psa_accel_alg_sha256() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3649 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_256 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3650 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3651 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3652 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3653 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3654 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 3655 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 3656 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 3657 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 3658 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3659 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3660 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_256 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3661 | } |
| 3662 | |
| 3663 | # This should be renamed to test and updated once the accelerator SHA384 code is in place and ready to test. |
| 3664 | component_build_psa_accel_alg_sha384() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3665 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_384 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3666 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3667 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3668 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3669 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3670 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 3671 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 3672 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 3673 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 3674 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
Gilles Peskine | fa65237 | 2022-10-13 22:05:38 +0200 | [diff] [blame] | 3675 | scripts/config.py unset MBEDTLS_LMS_C |
| 3676 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3677 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3678 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_384 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3679 | } |
| 3680 | |
| 3681 | # This should be renamed to test and updated once the accelerator SHA512 code is in place and ready to test. |
| 3682 | component_build_psa_accel_alg_sha512() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3683 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_512 - other hashes" |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3684 | scripts/config.py full |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3685 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3686 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3687 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 3688 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 3689 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 3690 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 3691 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 3692 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 3693 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
Gilles Peskine | fa65237 | 2022-10-13 22:05:38 +0200 | [diff] [blame] | 3694 | scripts/config.py unset MBEDTLS_LMS_C |
| 3695 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
John Durkop | 1b7ee05 | 2020-11-27 08:51:22 -0800 | [diff] [blame] | 3696 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3697 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_512 -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3698 | } |
| 3699 | |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3700 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3701 | component_build_psa_accel_alg_rsa_pkcs1v15_crypt() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3702 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3703 | scripts/config.py full |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3704 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3705 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3706 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1 |
| 3707 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN |
| 3708 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
| 3709 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PSS |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3710 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3711 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3712 | } |
| 3713 | |
| 3714 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3715 | component_build_psa_accel_alg_rsa_pkcs1v15_sign() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3716 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_PKCS1V15_SIGN + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3717 | scripts/config.py full |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3718 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3719 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3720 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1 |
| 3721 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
| 3722 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
| 3723 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PSS |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3724 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3725 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3726 | } |
| 3727 | |
| 3728 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3729 | component_build_psa_accel_alg_rsa_oaep() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3730 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_OAEP + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3731 | scripts/config.py full |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3732 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3733 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3734 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_OAEP 1 |
| 3735 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
| 3736 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN |
| 3737 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PSS |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3738 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3739 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_OAEP -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3740 | } |
| 3741 | |
| 3742 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3743 | component_build_psa_accel_alg_rsa_pss() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3744 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_PSS + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3745 | scripts/config.py full |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3746 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3747 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3748 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PSS 1 |
| 3749 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
| 3750 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN |
| 3751 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3752 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3753 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PSS -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3754 | } |
| 3755 | |
| 3756 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3757 | component_build_psa_accel_key_type_rsa_key_pair() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3758 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_xxx + PSA_WANT_ALG_RSA_PSS" |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3759 | scripts/config.py full |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3760 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3761 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3762 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PSS 1 |
| 3763 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1 |
| 3764 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1 |
| 3765 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1 |
| 3766 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1 |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3767 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3768 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
| 3769 | } |
| 3770 | |
| 3771 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
John Durkop | 6ba40d1 | 2020-11-10 08:50:04 -0800 | [diff] [blame] | 3772 | component_build_psa_accel_key_type_rsa_public_key() { |
Gilles Peskine | eb41e0d | 2023-07-19 19:36:55 +0200 | [diff] [blame] | 3773 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + PSA_WANT_ALG_RSA_PSS" |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3774 | scripts/config.py full |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3775 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
Ronald Cron | f660655 | 2022-03-15 11:23:25 +0100 | [diff] [blame] | 3776 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3777 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PSS 1 |
| 3778 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1 |
John Durkop | bd069d3 | 2020-10-31 22:14:03 -0700 | [diff] [blame] | 3779 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 3780 | make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS" |
John Durkop | d032195 | 2020-10-29 21:37:36 -0700 | [diff] [blame] | 3781 | } |
| 3782 | |
Dave Rodgman | c164c07 | 2023-06-28 09:43:23 +0100 | [diff] [blame] | 3783 | |
Dave Rodgman | 904c589 | 2023-06-28 17:36:02 +0100 | [diff] [blame] | 3784 | support_build_tfm_armcc () { |
Dave Rodgman | c164c07 | 2023-06-28 09:43:23 +0100 | [diff] [blame] | 3785 | armc6_cc="$ARMC6_BIN_DIR/armclang" |
| 3786 | (check_tools "$armc6_cc" > /dev/null 2>&1) |
| 3787 | } |
| 3788 | |
Dave Rodgman | 904c589 | 2023-06-28 17:36:02 +0100 | [diff] [blame] | 3789 | component_build_tfm_armcc() { |
| 3790 | # test the TF-M configuration can build cleanly with various warning flags enabled |
Ronald Cron | 7a93ac5 | 2023-07-20 09:49:12 +0200 | [diff] [blame] | 3791 | cp configs/tfm_mbedcrypto_config_profile_medium.h "$CONFIG_H" |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3792 | cp configs/crypto_config_profile_medium.h "$CRYPTO_CONFIG_H" |
Dave Rodgman | c164c07 | 2023-06-28 09:43:23 +0100 | [diff] [blame] | 3793 | |
Dave Rodgman | 88651c4 | 2023-06-29 12:35:51 +0100 | [diff] [blame] | 3794 | msg "build: TF-M config, armclang armv7-m thumb2" |
Dave Rodgman | fb374e6 | 2023-06-29 11:58:16 +0100 | [diff] [blame] | 3795 | make clean |
| 3796 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m -mthumb -Os -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused" |
| 3797 | } |
| 3798 | |
| 3799 | component_build_tfm() { |
| 3800 | # test the TF-M configuration can build cleanly with various warning flags enabled |
Ronald Cron | 7a93ac5 | 2023-07-20 09:49:12 +0200 | [diff] [blame] | 3801 | cp configs/tfm_mbedcrypto_config_profile_medium.h "$CONFIG_H" |
Ronald Cron | 6b49b55 | 2023-07-20 09:57:54 +0200 | [diff] [blame] | 3802 | cp configs/crypto_config_profile_medium.h "$CRYPTO_CONFIG_H" |
Dave Rodgman | fb374e6 | 2023-06-29 11:58:16 +0100 | [diff] [blame] | 3803 | |
Dave Rodgman | 88651c4 | 2023-06-29 12:35:51 +0100 | [diff] [blame] | 3804 | msg "build: TF-M config, clang, armv7-m thumb2" |
| 3805 | make lib CC="clang" CFLAGS="--target=arm-linux-gnueabihf -march=armv7-m -mthumb -Os -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused" |
Dave Rodgman | c164c07 | 2023-06-28 09:43:23 +0100 | [diff] [blame] | 3806 | |
Dave Rodgman | 904c589 | 2023-06-28 17:36:02 +0100 | [diff] [blame] | 3807 | msg "build: TF-M config, gcc native build" |
| 3808 | make clean |
Dave Rodgman | 1a4936a | 2023-06-29 14:07:50 +0100 | [diff] [blame] | 3809 | make lib CC="gcc" CFLAGS="-Os -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wformat-signedness -Wlogical-op" |
Dave Rodgman | c164c07 | 2023-06-28 09:43:23 +0100 | [diff] [blame] | 3810 | } |
| 3811 | |
Dave Rodgman | 6001fb2 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3812 | component_build_aes_variations() { # ~45s |
Dave Rodgman | cd04020 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3813 | # aes.o has many #if defined(...) guards that intersect in complex ways. |
| 3814 | # Test that all the combinations build cleanly. The most common issue is |
| 3815 | # unused variables/functions, so ensure -Wunused is set. |
| 3816 | |
Dave Rodgman | 6001fb2 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3817 | msg "build: aes.o for all combinations of relevant config options" |
Dave Rodgman | 0f0f769 | 2023-06-29 12:10:45 +0100 | [diff] [blame] | 3818 | |
Dave Rodgman | 6001fb2 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3819 | for a in set unset; do |
| 3820 | for b in set unset; do |
| 3821 | for c in set unset; do |
| 3822 | for d in set unset; do |
| 3823 | for e in set unset; do |
| 3824 | for f in set unset; do |
| 3825 | for g in set unset; do |
Dave Rodgman | 0f0f769 | 2023-06-29 12:10:45 +0100 | [diff] [blame] | 3826 | echo ./scripts/config.py $a MBEDTLS_AES_SETKEY_ENC_ALT |
| 3827 | echo ./scripts/config.py $b MBEDTLS_AES_DECRYPT_ALT |
| 3828 | echo ./scripts/config.py $c MBEDTLS_AES_ROM_TABLES |
| 3829 | echo ./scripts/config.py $d MBEDTLS_AES_ENCRYPT_ALT |
| 3830 | echo ./scripts/config.py $e MBEDTLS_AES_SETKEY_DEC_ALT |
| 3831 | echo ./scripts/config.py $f MBEDTLS_AES_FEWER_TABLES |
| 3832 | echo ./scripts/config.py $g MBEDTLS_PADLOCK_C |
Dave Rodgman | 6001fb2 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3833 | |
Dave Rodgman | 0f0f769 | 2023-06-29 12:10:45 +0100 | [diff] [blame] | 3834 | ./scripts/config.py $a MBEDTLS_AES_SETKEY_ENC_ALT |
| 3835 | ./scripts/config.py $b MBEDTLS_AES_DECRYPT_ALT |
| 3836 | ./scripts/config.py $c MBEDTLS_AES_ROM_TABLES |
| 3837 | ./scripts/config.py $d MBEDTLS_AES_ENCRYPT_ALT |
| 3838 | ./scripts/config.py $e MBEDTLS_AES_SETKEY_DEC_ALT |
| 3839 | ./scripts/config.py $f MBEDTLS_AES_FEWER_TABLES |
| 3840 | ./scripts/config.py $g MBEDTLS_PADLOCK_C |
Dave Rodgman | 6001fb2 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3841 | |
Dave Rodgman | 0f0f769 | 2023-06-29 12:10:45 +0100 | [diff] [blame] | 3842 | rm -f library/aes.o |
| 3843 | make -C library aes.o CC="clang" CFLAGS="-O0 -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused" |
Dave Rodgman | 6001fb2 | 2023-06-29 09:29:00 +0100 | [diff] [blame] | 3844 | done |
| 3845 | done |
| 3846 | done |
| 3847 | done |
| 3848 | done |
| 3849 | done |
| 3850 | done |
| 3851 | } |
| 3852 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3853 | component_test_no_platform () { |
| 3854 | # Full configuration build, without platform support, file IO and net sockets. |
| 3855 | # This should catch missing mbedtls_printf definitions, and by disabling file |
| 3856 | # IO, it should catch missing '#include <stdio.h>' |
| 3857 | msg "build: full config except platform/fsio/net, make, gcc, C99" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3858 | scripts/config.py full |
| 3859 | scripts/config.py unset MBEDTLS_PLATFORM_C |
| 3860 | scripts/config.py unset MBEDTLS_NET_C |
| 3861 | scripts/config.py unset MBEDTLS_PLATFORM_MEMORY |
| 3862 | scripts/config.py unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 3863 | scripts/config.py unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 3864 | scripts/config.py unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
Gilles Peskine | ef843f2 | 2022-09-18 14:05:23 +0200 | [diff] [blame] | 3865 | scripts/config.py unset MBEDTLS_PLATFORM_VSNPRINTF_ALT |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3866 | scripts/config.py unset MBEDTLS_PLATFORM_TIME_ALT |
| 3867 | scripts/config.py unset MBEDTLS_PLATFORM_EXIT_ALT |
Gilles Peskine | 6497b5a | 2022-06-30 17:01:40 +0200 | [diff] [blame] | 3868 | scripts/config.py unset MBEDTLS_PLATFORM_SETBUF_ALT |
Gilles Peskine | 32e889d | 2020-04-12 23:43:28 +0200 | [diff] [blame] | 3869 | scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3870 | scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED |
| 3871 | scripts/config.py unset MBEDTLS_FS_IO |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3872 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3873 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C |
| 3874 | scripts/config.py unset MBEDTLS_PSA_ITS_FILE_C |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3875 | # Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19, |
| 3876 | # to re-enable platform integration features otherwise disabled in C99 builds |
Gilles Peskine | 6ec0f0f | 2019-09-20 19:23:10 +0200 | [diff] [blame] | 3877 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -Os -D_DEFAULT_SOURCE' lib programs |
| 3878 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' test |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3879 | } |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 3880 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3881 | component_build_no_std_function () { |
| 3882 | # catch compile bugs in _uninit functions |
| 3883 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3884 | scripts/config.py full |
| 3885 | scripts/config.py set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
| 3886 | scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED |
Gilles Peskine | 32e889d | 2020-04-12 23:43:28 +0200 | [diff] [blame] | 3887 | scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT |
Gilles Peskine | f4d2fd4 | 2021-10-08 11:45:47 +0200 | [diff] [blame] | 3888 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check . |
Gilles Peskine | dbf7b7e | 2021-10-07 19:34:57 +0200 | [diff] [blame] | 3889 | make |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3890 | } |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 3891 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3892 | component_build_no_ssl_srv () { |
Ronald Cron | de1adee | 2022-03-07 16:20:30 +0100 | [diff] [blame] | 3893 | msg "build: full config except SSL server, make, gcc" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3894 | scripts/config.py full |
| 3895 | scripts/config.py unset MBEDTLS_SSL_SRV_C |
Gilles Peskine | 6ec0f0f | 2019-09-20 19:23:10 +0200 | [diff] [blame] | 3896 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1' |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3897 | } |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 3898 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3899 | component_build_no_ssl_cli () { |
Ronald Cron | de1adee | 2022-03-07 16:20:30 +0100 | [diff] [blame] | 3900 | msg "build: full config except SSL client, make, gcc" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3901 | scripts/config.py full |
| 3902 | scripts/config.py unset MBEDTLS_SSL_CLI_C |
Gilles Peskine | 6ec0f0f | 2019-09-20 19:23:10 +0200 | [diff] [blame] | 3903 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1' |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3904 | } |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 3905 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3906 | component_build_no_sockets () { |
| 3907 | # Note, C99 compliance can also be tested with the sockets support disabled, |
| 3908 | # as that requires a POSIX platform (which isn't the same as C99). |
| 3909 | msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3910 | scripts/config.py full |
| 3911 | scripts/config.py unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 3912 | scripts/config.py set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Gilles Peskine | 6ec0f0f | 2019-09-20 19:23:10 +0200 | [diff] [blame] | 3913 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3914 | } |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 3915 | |
Andrzej Kurek | 69f20aa | 2019-09-05 09:27:47 -0400 | [diff] [blame] | 3916 | component_test_memory_buffer_allocator_backtrace () { |
| 3917 | msg "build: default config with memory buffer allocator and backtrace enabled" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3918 | scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 3919 | scripts/config.py set MBEDTLS_PLATFORM_MEMORY |
| 3920 | scripts/config.py set MBEDTLS_MEMORY_BACKTRACE |
| 3921 | scripts/config.py set MBEDTLS_MEMORY_DEBUG |
Gilles Peskine | e7fc7ef | 2021-10-19 21:33:32 +0200 | [diff] [blame] | 3922 | CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release . |
Andrzej Kurek | 69f20aa | 2019-09-05 09:27:47 -0400 | [diff] [blame] | 3923 | make |
| 3924 | |
| 3925 | msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C and MBEDTLS_MEMORY_BACKTRACE" |
| 3926 | make test |
| 3927 | } |
| 3928 | |
| 3929 | component_test_memory_buffer_allocator () { |
| 3930 | msg "build: default config with memory buffer allocator" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3931 | scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 3932 | scripts/config.py set MBEDTLS_PLATFORM_MEMORY |
Gilles Peskine | e7fc7ef | 2021-10-19 21:33:32 +0200 | [diff] [blame] | 3933 | CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release . |
Hanno Becker | 0fb9ba2 | 2019-02-26 14:34:13 +0000 | [diff] [blame] | 3934 | make |
| 3935 | |
| 3936 | msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C" |
| 3937 | make test |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 3938 | |
| 3939 | msg "test: ssl-opt.sh, MBEDTLS_MEMORY_BUFFER_ALLOC_C" |
| 3940 | # MBEDTLS_MEMORY_BUFFER_ALLOC is slow. Skip tests that tend to time out. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3941 | tests/ssl-opt.sh -e '^DTLS proxy' |
Hanno Becker | 0fb9ba2 | 2019-02-26 14:34:13 +0000 | [diff] [blame] | 3942 | } |
| 3943 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3944 | component_test_no_max_fragment_length () { |
| 3945 | # Run max fragment length tests with MFL disabled |
| 3946 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3947 | scripts/config.py unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3948 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 3949 | make |
Hanno Becker | 5175ac6 | 2017-09-18 15:36:25 +0100 | [diff] [blame] | 3950 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3951 | msg "test: ssl-opt.sh, MFL-related tests" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3952 | tests/ssl-opt.sh -f "Max fragment length" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3953 | } |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 3954 | |
Hanno Becker | 545ced4 | 2019-02-19 11:10:48 +0000 | [diff] [blame] | 3955 | component_test_asan_remove_peer_certificate () { |
| 3956 | msg "build: default config with MBEDTLS_SSL_KEEP_PEER_CERTIFICATE disabled (ASan build)" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3957 | scripts/config.py unset MBEDTLS_SSL_KEEP_PEER_CERTIFICATE |
Hanno Becker | 545ced4 | 2019-02-19 11:10:48 +0000 | [diff] [blame] | 3958 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 3959 | make |
| 3960 | |
| 3961 | msg "test: !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
| 3962 | make test |
| 3963 | |
| 3964 | msg "test: ssl-opt.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3965 | tests/ssl-opt.sh |
Hanno Becker | 545ced4 | 2019-02-19 11:10:48 +0000 | [diff] [blame] | 3966 | |
| 3967 | msg "test: compat.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3968 | tests/compat.sh |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 3969 | |
| 3970 | msg "test: context-info.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3971 | tests/context-info.sh |
Hanno Becker | 545ced4 | 2019-02-19 11:10:48 +0000 | [diff] [blame] | 3972 | } |
| 3973 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3974 | component_test_no_max_fragment_length_small_ssl_out_content_len () { |
| 3975 | msg "build: no MFL extension, small SSL_OUT_CONTENT_LEN (ASan build)" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 3976 | scripts/config.py unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 3977 | scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 16384 |
| 3978 | scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 4096 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3979 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 3980 | make |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 3981 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3982 | msg "test: MFL tests (disabled MFL extension case) & large packet tests" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3983 | tests/ssl-opt.sh -f "Max fragment length\|Large buffer" |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 3984 | |
| 3985 | msg "test: context-info.sh (disabled MFL extension case)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3986 | tests/context-info.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 3987 | } |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 3988 | |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 3989 | component_test_variable_ssl_in_out_buffer_len () { |
| 3990 | msg "build: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled (ASan build)" |
| 3991 | scripts/config.py set MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH |
| 3992 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 3993 | make |
| 3994 | |
| 3995 | msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled" |
| 3996 | make test |
| 3997 | |
| 3998 | msg "test: ssl-opt.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 3999 | tests/ssl-opt.sh |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 4000 | |
| 4001 | msg "test: compat.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4002 | tests/compat.sh |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 4003 | } |
| 4004 | |
Manuel Pégourié-Gonnard | 6a543ba | 2022-11-25 11:30:10 +0100 | [diff] [blame] | 4005 | component_test_dtls_cid_legacy () { |
Hannes Tschofenig | df84bb3 | 2022-11-23 11:14:03 +0100 | [diff] [blame] | 4006 | msg "build: MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled (ASan build)" |
Hannes Tschofenig | fd6cca4 | 2021-10-12 09:22:33 +0200 | [diff] [blame] | 4007 | scripts/config.py set MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT 1 |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 4008 | |
| 4009 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 4010 | make |
| 4011 | |
Hannes Tschofenig | df84bb3 | 2022-11-23 11:14:03 +0100 | [diff] [blame] | 4012 | msg "test: MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy)" |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 4013 | make test |
| 4014 | |
Hannes Tschofenig | df84bb3 | 2022-11-23 11:14:03 +0100 | [diff] [blame] | 4015 | msg "test: ssl-opt.sh, MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4016 | tests/ssl-opt.sh |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 4017 | |
Manuel Pégourié-Gonnard | 6a543ba | 2022-11-25 11:30:10 +0100 | [diff] [blame] | 4018 | msg "test: compat.sh, MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4019 | tests/compat.sh |
Darryl Green | aad82f9 | 2019-12-02 10:53:11 +0000 | [diff] [blame] | 4020 | } |
| 4021 | |
Piotr Nowicki | 0937ed2 | 2019-11-26 16:32:40 +0100 | [diff] [blame] | 4022 | component_test_ssl_alloc_buffer_and_mfl () { |
| 4023 | msg "build: default config with memory buffer allocator and MFL extension" |
| 4024 | scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 4025 | scripts/config.py set MBEDTLS_PLATFORM_MEMORY |
| 4026 | scripts/config.py set MBEDTLS_MEMORY_DEBUG |
| 4027 | scripts/config.py set MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 4028 | scripts/config.py set MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH |
Gilles Peskine | e7fc7ef | 2021-10-19 21:33:32 +0200 | [diff] [blame] | 4029 | CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release . |
Piotr Nowicki | 0937ed2 | 2019-11-26 16:32:40 +0100 | [diff] [blame] | 4030 | make |
| 4031 | |
| 4032 | msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG and MBEDTLS_SSL_MAX_FRAGMENT_LENGTH" |
| 4033 | make test |
| 4034 | |
| 4035 | msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG and MBEDTLS_SSL_MAX_FRAGMENT_LENGTH" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4036 | tests/ssl-opt.sh -f "Handshake memory usage" |
Piotr Nowicki | 0937ed2 | 2019-11-26 16:32:40 +0100 | [diff] [blame] | 4037 | } |
| 4038 | |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4039 | component_test_when_no_ciphersuites_have_mac () { |
| 4040 | msg "build: when no ciphersuites have MAC" |
| 4041 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4042 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC |
TRodziewicz | 2add5c1 | 2021-04-28 16:50:20 +0200 | [diff] [blame] | 4043 | scripts/config.py unset MBEDTLS_CMAC_C |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4044 | make |
| 4045 | |
| 4046 | msg "test: !MBEDTLS_SSL_SOME_MODES_USE_MAC" |
| 4047 | make test |
| 4048 | |
| 4049 | msg "test ssl-opt.sh: !MBEDTLS_SSL_SOME_MODES_USE_MAC" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4050 | tests/ssl-opt.sh -f 'Default\|EtM' -e 'without EtM' |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4051 | } |
| 4052 | |
Raoul Strackx | a4e8614 | 2020-06-15 17:03:13 +0200 | [diff] [blame] | 4053 | component_test_no_date_time () { |
| 4054 | msg "build: default config without MBEDTLS_HAVE_TIME_DATE" |
| 4055 | scripts/config.py unset MBEDTLS_HAVE_TIME_DATE |
Gilles Peskine | f4d2fd4 | 2021-10-08 11:45:47 +0200 | [diff] [blame] | 4056 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check . |
Raoul Strackx | a4e8614 | 2020-06-15 17:03:13 +0200 | [diff] [blame] | 4057 | make |
| 4058 | |
| 4059 | msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites" |
| 4060 | make test |
| 4061 | } |
| 4062 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4063 | component_test_platform_calloc_macro () { |
| 4064 | msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4065 | scripts/config.py set MBEDTLS_PLATFORM_MEMORY |
| 4066 | scripts/config.py set MBEDTLS_PLATFORM_CALLOC_MACRO calloc |
| 4067 | scripts/config.py set MBEDTLS_PLATFORM_FREE_MACRO free |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4068 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 4069 | make |
Hanno Becker | e5fecec | 2018-10-11 11:02:52 +0100 | [diff] [blame] | 4070 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4071 | msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)" |
| 4072 | make test |
| 4073 | } |
Hanno Becker | e5fecec | 2018-10-11 11:02:52 +0100 | [diff] [blame] | 4074 | |
Gilles Peskine | c4ef7a9 | 2019-09-17 19:04:38 +0200 | [diff] [blame] | 4075 | component_test_malloc_0_null () { |
| 4076 | msg "build: malloc(0) returns NULL (ASan+UBSan build)" |
Manuel Pégourié-Gonnard | 68192fc | 2020-03-04 10:34:47 +0100 | [diff] [blame] | 4077 | scripts/config.py full |
Gilles Peskine | cf4fe58 | 2023-07-20 19:00:15 +0200 | [diff] [blame] | 4078 | make CC=gcc CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"$PWD/tests/configs/user-config-malloc-0-null.h\"' $ASAN_CFLAGS -O" LDFLAGS="$ASAN_CFLAGS" |
Gilles Peskine | c4ef7a9 | 2019-09-17 19:04:38 +0200 | [diff] [blame] | 4079 | |
| 4080 | msg "test: malloc(0) returns NULL (ASan+UBSan build)" |
| 4081 | make test |
| 4082 | |
| 4083 | msg "selftest: malloc(0) returns NULL (ASan+UBSan build)" |
| 4084 | # Just the calloc selftest. "make test" ran the others as part of the |
| 4085 | # test suites. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4086 | programs/test/selftest calloc |
Gilles Peskine | 765d240 | 2020-02-11 18:26:34 +0100 | [diff] [blame] | 4087 | |
| 4088 | msg "test ssl-opt.sh: malloc(0) returns NULL (ASan+UBSan build)" |
| 4089 | # Run a subset of the tests. The choice is a balance between coverage |
| 4090 | # and time (including time indirectly wasted due to flaky tests). |
| 4091 | # The current choice is to skip tests whose description includes |
| 4092 | # "proxy", which is an approximation of skipping tests that use the |
| 4093 | # UDP proxy, which tend to be slower and flakier. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4094 | tests/ssl-opt.sh -e 'proxy' |
Gilles Peskine | c4ef7a9 | 2019-09-17 19:04:38 +0200 | [diff] [blame] | 4095 | } |
| 4096 | |
Dave Rodgman | 6a08b68 | 2023-06-19 11:51:33 +0100 | [diff] [blame] | 4097 | support_test_aesni() { |
| 4098 | # Check that gcc targets x86_64 (we can build AESNI), and check for |
| 4099 | # AESNI support on the host (we can run AESNI). |
| 4100 | # |
| 4101 | # The name of this function is possibly slightly misleading, but needs to align |
| 4102 | # with the name of the corresponding test, component_test_aesni. |
Dave Rodgman | f8986e3 | 2023-06-19 10:55:59 +0100 | [diff] [blame] | 4103 | # |
| 4104 | # In principle 32-bit x86 can support AESNI, but our implementation does not |
| 4105 | # support 32-bit x86, so we check for x86-64. |
| 4106 | # We can only grep /proc/cpuinfo on Linux, so this also checks for Linux |
Dave Rodgman | 6a08b68 | 2023-06-19 11:51:33 +0100 | [diff] [blame] | 4107 | (gcc -v 2>&1 | grep Target | grep -q x86_64) && |
| 4108 | [[ "$HOSTTYPE" == "x86_64" && "$OSTYPE" == "linux-gnu" ]] && |
Jerry Yu | a7de78d | 2023-08-08 12:57:35 +0800 | [diff] [blame] | 4109 | (lscpu | grep -qw aes) |
Dave Rodgman | f8986e3 | 2023-06-19 10:55:59 +0100 | [diff] [blame] | 4110 | } |
| 4111 | |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4112 | component_test_aesni () { # ~ 60s |
| 4113 | # This tests the two AESNI implementations (intrinsics and assembly), and also the plain C |
| 4114 | # fallback. It also tests the logic that is used to select which implementation(s) to build. |
| 4115 | # |
| 4116 | # This test does not require the host to have support for AESNI (if it doesn't, the run-time |
| 4117 | # AESNI detection will fallback to the plain C implementation, so the tests will instead |
| 4118 | # exercise the plain C impl). |
| 4119 | |
Dave Rodgman | be60fcc | 2023-06-16 17:04:52 +0100 | [diff] [blame] | 4120 | msg "build: default config with different AES implementations" |
Dave Rodgman | 838dc46 | 2023-06-16 13:18:19 +0100 | [diff] [blame] | 4121 | scripts/config.py set MBEDTLS_AESNI_C |
Jerry Yu | 17a9d2e | 2023-08-03 16:14:18 +0800 | [diff] [blame] | 4122 | scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY |
Dave Rodgman | 838dc46 | 2023-06-16 13:18:19 +0100 | [diff] [blame] | 4123 | scripts/config.py set MBEDTLS_HAVE_ASM |
| 4124 | |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4125 | # test the intrinsics implementation |
| 4126 | msg "AES tests, test intrinsics" |
Dave Rodgman | 838dc46 | 2023-06-16 13:18:19 +0100 | [diff] [blame] | 4127 | make clean |
Jerry Yu | a7de78d | 2023-08-08 12:57:35 +0800 | [diff] [blame] | 4128 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mpclmul -msse2 -maes' |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4129 | # check that we built intrinsics - this should be used by default when supported by the compiler |
Jerry Yu | 1221a31 | 2023-08-03 16:09:07 +0800 | [diff] [blame] | 4130 | ./programs/test/selftest aes | grep "AESNI code" | grep -q "intrinsics" |
Dave Rodgman | be60fcc | 2023-06-16 17:04:52 +0100 | [diff] [blame] | 4131 | |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4132 | # test the asm implementation |
| 4133 | msg "AES tests, test assembly" |
| 4134 | make clean |
Jerry Yu | a7de78d | 2023-08-08 12:57:35 +0800 | [diff] [blame] | 4135 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mno-pclmul -mno-sse2 -mno-aes' |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4136 | # check that we built assembly - this should be built if the compiler does not support intrinsics |
Jerry Yu | 1221a31 | 2023-08-03 16:09:07 +0800 | [diff] [blame] | 4137 | ./programs/test/selftest aes | grep "AESNI code" | grep -q "assembly" |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4138 | |
| 4139 | # test the plain C implementation |
Dave Rodgman | be60fcc | 2023-06-16 17:04:52 +0100 | [diff] [blame] | 4140 | scripts/config.py unset MBEDTLS_AESNI_C |
Jerry Yu | 17a9d2e | 2023-08-03 16:14:18 +0800 | [diff] [blame] | 4141 | scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY |
Dave Rodgman | be60fcc | 2023-06-16 17:04:52 +0100 | [diff] [blame] | 4142 | msg "AES tests, plain C" |
| 4143 | make clean |
Jerry Yu | a7de78d | 2023-08-08 12:57:35 +0800 | [diff] [blame] | 4144 | make CC=gcc CFLAGS='-O2 -Werror' |
Dave Rodgman | 96a9e6a | 2023-06-16 20:18:36 +0100 | [diff] [blame] | 4145 | # check that there is no AESNI code present |
Jerry Yu | 1221a31 | 2023-08-03 16:09:07 +0800 | [diff] [blame] | 4146 | ./programs/test/selftest aes | not grep -q "AESNI code" |
Jerry Yu | 76a51b9 | 2023-08-08 16:03:55 +0800 | [diff] [blame] | 4147 | not grep -q "AES note: using AESNI" ./programs/test/selftest |
| 4148 | grep -q "AES note: built-in implementation." ./programs/test/selftest |
Jerry Yu | 8a599c0 | 2023-08-03 17:01:02 +0800 | [diff] [blame] | 4149 | |
| 4150 | # test the intrinsics implementation |
| 4151 | scripts/config.py set MBEDTLS_AESNI_C |
| 4152 | scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY |
| 4153 | msg "AES tests, test AESNI only" |
| 4154 | make clean |
Jerry Yu | a7de78d | 2023-08-08 12:57:35 +0800 | [diff] [blame] | 4155 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mpclmul -msse2 -maes' |
Jerry Yu | a7de78d | 2023-08-08 12:57:35 +0800 | [diff] [blame] | 4156 | ./programs/test/selftest aes | grep -q "AES note: using AESNI" |
| 4157 | ./programs/test/selftest aes | not grep -q "AES note: built-in implementation." |
Jerry Yu | 76a51b9 | 2023-08-08 16:03:55 +0800 | [diff] [blame] | 4158 | grep -q "AES note: using AESNI" ./programs/test/selftest |
| 4159 | not grep -q "AES note: built-in implementation." ./programs/test/selftest |
Dave Rodgman | 838dc46 | 2023-06-16 13:18:19 +0100 | [diff] [blame] | 4160 | } |
| 4161 | |
Jerry Yu | 193cbc0 | 2023-08-03 17:06:29 +0800 | [diff] [blame] | 4162 | |
Jerry Yu | b6d39c2 | 2023-08-16 15:11:48 +0800 | [diff] [blame] | 4163 | |
| 4164 | support_test_aesni_m32() { |
| 4165 | support_test_m32_o0 && (lscpu | grep -qw aes) |
| 4166 | } |
| 4167 | |
| 4168 | component_test_aesni_m32 () { # ~ 60s |
| 4169 | # This tests are duplicated from component_test_aesni for i386 target |
| 4170 | # |
| 4171 | # AESNI intrinsic code supports i386 and assembly code does not support it. |
| 4172 | |
| 4173 | msg "build: default config with different AES implementations" |
| 4174 | scripts/config.py set MBEDTLS_AESNI_C |
| 4175 | scripts/config.py set MBEDTLS_PADLOCK_C |
| 4176 | scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY |
| 4177 | scripts/config.py set MBEDTLS_HAVE_ASM |
| 4178 | |
| 4179 | # test the intrinsics implementation |
| 4180 | msg "AES tests, test intrinsics" |
| 4181 | make clean |
| 4182 | make CC=gcc CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes' LDFLAGS='-m32' |
| 4183 | # check that we built intrinsics - this should be used by default when supported by the compiler |
| 4184 | ./programs/test/selftest aes | grep "AESNI code" | grep -q "intrinsics" |
| 4185 | grep -q "AES note: using AESNI" ./programs/test/selftest |
| 4186 | grep -q "AES note: built-in implementation." ./programs/test/selftest |
| 4187 | grep -q "AES note: using VIA Padlock" ./programs/test/selftest |
| 4188 | grep -q mbedtls_aesni_has_support ./programs/test/selftest |
| 4189 | |
| 4190 | scripts/config.py set MBEDTLS_AESNI_C |
Jerry Yu | b6d39c2 | 2023-08-16 15:11:48 +0800 | [diff] [blame] | 4191 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 4192 | scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY |
| 4193 | msg "AES tests, test AESNI only" |
| 4194 | make clean |
| 4195 | make CC=gcc CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes' LDFLAGS='-m32' |
| 4196 | ./programs/test/selftest aes | grep -q "AES note: using AESNI" |
| 4197 | ./programs/test/selftest aes | not grep -q "AES note: built-in implementation." |
| 4198 | grep -q "AES note: using AESNI" ./programs/test/selftest |
| 4199 | not grep -q "AES note: built-in implementation." ./programs/test/selftest |
| 4200 | not grep -q "AES note: using VIA Padlock" ./programs/test/selftest |
| 4201 | not grep -q mbedtls_aesni_has_support ./programs/test/selftest |
| 4202 | } |
| 4203 | |
Jerry Yu | 193cbc0 | 2023-08-03 17:06:29 +0800 | [diff] [blame] | 4204 | # For timebeing, no aarch64 gcc available in CI and no arm64 CI node. |
| 4205 | component_build_aes_aesce_armcc () { |
| 4206 | msg "Build: AESCE test on arm64 platform without plain C." |
| 4207 | scripts/config.py baremetal |
| 4208 | |
| 4209 | # armc[56] don't support SHA-512 intrinsics |
| 4210 | scripts/config.py unset MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT |
| 4211 | |
| 4212 | # Stop armclang warning about feature detection for A64_CRYPTO. |
| 4213 | # With this enabled, the library does build correctly under armclang, |
| 4214 | # but in baremetal builds (as tested here), feature detection is |
| 4215 | # unavailable, and the user is notified via a #warning. So enabling |
| 4216 | # this feature would prevent us from building with -Werror on |
| 4217 | # armclang. Tracked in #7198. |
| 4218 | scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT |
| 4219 | scripts/config.py set MBEDTLS_HAVE_ASM |
| 4220 | |
| 4221 | msg "AESCE, build with default configuration." |
| 4222 | scripts/config.py set MBEDTLS_AESCE_C |
| 4223 | scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY |
| 4224 | armc6_build_test "-O1 --target=aarch64-arm-none-eabi -march=armv8-a+crypto" |
| 4225 | |
| 4226 | msg "AESCE, build AESCE only" |
| 4227 | scripts/config.py set MBEDTLS_AESCE_C |
| 4228 | scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY |
| 4229 | armc6_build_test "-O1 --target=aarch64-arm-none-eabi -march=armv8-a+crypto" |
| 4230 | } |
| 4231 | |
Jerry Yu | c935aa6 | 2023-08-03 17:08:27 +0800 | [diff] [blame] | 4232 | # For timebeing, no VIA Padlock platform available. |
| 4233 | component_build_aes_via_padlock () { |
| 4234 | |
| 4235 | msg "AES:VIA PadLock, build with default configuration." |
Jerry Yu | 506759f | 2023-08-16 17:11:22 +0800 | [diff] [blame] | 4236 | scripts/config.py unset MBEDTLS_AESNI_C |
Jerry Yu | c935aa6 | 2023-08-03 17:08:27 +0800 | [diff] [blame] | 4237 | scripts/config.py set MBEDTLS_PADLOCK_C |
| 4238 | scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY |
| 4239 | make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS" |
Jerry Yu | 506759f | 2023-08-16 17:11:22 +0800 | [diff] [blame] | 4240 | grep -q mbedtls_padlock_has_support ./programs/test/selftest |
Jerry Yu | c935aa6 | 2023-08-03 17:08:27 +0800 | [diff] [blame] | 4241 | |
| 4242 | } |
| 4243 | |
| 4244 | support_build_aes_via_padlock_only () { |
| 4245 | ( [ "$MBEDTLS_TEST_PLATFORM" == "Linux-x86_64" ] || \ |
| 4246 | [ "$MBEDTLS_TEST_PLATFORM" == "Linux-amd64" ] ) && \ |
| 4247 | [ "`dpkg --print-foreign-architectures`" == "i386" ] |
| 4248 | } |
| 4249 | |
Jerry Yu | 193cbc0 | 2023-08-03 17:06:29 +0800 | [diff] [blame] | 4250 | support_build_aes_aesce_armcc () { |
| 4251 | support_build_armcc |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4252 | } |
| 4253 | |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4254 | component_test_aes_only_128_bit_keys () { |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4255 | msg "build: default config + AES_ONLY_128_BIT_KEY_LENGTH" |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 4256 | scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4257 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 4258 | |
| 4259 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 4260 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4261 | msg "test: default config + AES_ONLY_128_BIT_KEY_LENGTH" |
| 4262 | make test |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4263 | } |
| 4264 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4265 | component_test_no_ctr_drbg_aes_only_128_bit_keys () { |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 4266 | msg "build: default config + AES_ONLY_128_BIT_KEY_LENGTH - CTR_DRBG_C" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4267 | scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH |
| 4268 | scripts/config.py unset MBEDTLS_CTR_DRBG_C |
| 4269 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 4270 | |
Gilles Peskine | 592f591 | 2019-10-07 18:49:32 +0200 | [diff] [blame] | 4271 | make CC=clang CFLAGS='-Werror -Wall -Wextra' |
| 4272 | |
Gilles Peskine | 3b46cd3 | 2020-02-18 17:56:33 +0100 | [diff] [blame] | 4273 | msg "test: default config + AES_ONLY_128_BIT_KEY_LENGTH - CTR_DRBG_C" |
| 4274 | make test |
| 4275 | } |
Gilles Peskine | 592f591 | 2019-10-07 18:49:32 +0200 | [diff] [blame] | 4276 | |
| 4277 | component_test_aes_only_128_bit_keys_have_builtins () { |
| 4278 | msg "build: default config + AES_ONLY_128_BIT_KEY_LENGTH - AESNI_C - AESCE_C" |
| 4279 | scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH |
| 4280 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 4281 | scripts/config.py unset MBEDTLS_AESNI_C |
| 4282 | scripts/config.py unset MBEDTLS_AESCE_C |
| 4283 | |
| 4284 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Gilles Peskine | 3b46cd3 | 2020-02-18 17:56:33 +0100 | [diff] [blame] | 4285 | |
| 4286 | msg "test: default config + AES_ONLY_128_BIT_KEY_LENGTH - AESNI_C - AESCE_C" |
| 4287 | make test |
Gilles Peskine | 592f591 | 2019-10-07 18:49:32 +0200 | [diff] [blame] | 4288 | |
| 4289 | msg "selftest: default config + AES_ONLY_128_BIT_KEY_LENGTH - AESNI_C - AESCE_C" |
| 4290 | programs/test/selftest |
| 4291 | } |
| 4292 | |
| 4293 | component_test_aes_fewer_tables () { |
| 4294 | msg "build: default config with AES_FEWER_TABLES enabled" |
| 4295 | scripts/config.py set MBEDTLS_AES_FEWER_TABLES |
| 4296 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Gilles Peskine | 3b46cd3 | 2020-02-18 17:56:33 +0100 | [diff] [blame] | 4297 | |
| 4298 | msg "test: AES_FEWER_TABLES" |
| 4299 | make test |
| 4300 | } |
Gilles Peskine | 592f591 | 2019-10-07 18:49:32 +0200 | [diff] [blame] | 4301 | |
| 4302 | component_test_aes_rom_tables () { |
| 4303 | msg "build: default config with AES_ROM_TABLES enabled" |
| 4304 | scripts/config.py set MBEDTLS_AES_ROM_TABLES |
| 4305 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
| 4306 | |
| 4307 | msg "test: AES_ROM_TABLES" |
Gilles Peskine | f96aefe | 2019-07-24 14:58:38 +0200 | [diff] [blame] | 4308 | make test |
| 4309 | } |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4310 | |
Gilles Peskine | 004206c | 2019-10-21 17:11:33 +0200 | [diff] [blame] | 4311 | component_test_aes_fewer_tables_and_rom_tables () { |
Gilles Peskine | f96aefe | 2019-07-24 14:58:38 +0200 | [diff] [blame] | 4312 | msg "build: default config with AES_ROM_TABLES and AES_FEWER_TABLES enabled" |
| 4313 | scripts/config.py set MBEDTLS_AES_FEWER_TABLES |
| 4314 | scripts/config.py set MBEDTLS_AES_ROM_TABLES |
| 4315 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
| 4316 | |
Steven Cooreman | d57203d | 2020-07-16 20:28:59 +0200 | [diff] [blame] | 4317 | msg "test: AES_FEWER_TABLES + AES_ROM_TABLES" |
Ronald Cron | 32a432a | 2023-03-28 09:19:04 +0200 | [diff] [blame] | 4318 | make test |
Steven Cooreman | 753f973 | 2021-03-15 11:38:44 +0100 | [diff] [blame] | 4319 | } |
Steven Cooreman | 6801f08 | 2021-02-19 17:21:22 +0100 | [diff] [blame] | 4320 | |
Gilles Peskine | 3587dfd | 2021-09-20 19:20:04 +0200 | [diff] [blame] | 4321 | component_test_ctr_drbg_aes_256_sha_256 () { |
| 4322 | msg "build: full + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)" |
Ronald Cron | 17b3afc | 2020-12-10 18:17:09 +0100 | [diff] [blame] | 4323 | scripts/config.py full |
| 4324 | scripts/config.py unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 4325 | scripts/config.py set MBEDTLS_ENTROPY_FORCE_SHA256 |
Steven Cooreman | d57203d | 2020-07-16 20:28:59 +0200 | [diff] [blame] | 4326 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Ronald Cron | 32a432a | 2023-03-28 09:19:04 +0200 | [diff] [blame] | 4327 | make |
Steven Cooreman | d57203d | 2020-07-16 20:28:59 +0200 | [diff] [blame] | 4328 | |
| 4329 | msg "test: full + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)" |
| 4330 | make test |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4331 | } |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 4332 | |
Andrzej Kurek | 232e8f9 | 2019-10-03 03:18:01 -0400 | [diff] [blame] | 4333 | component_test_ctr_drbg_aes_128_sha_512 () { |
Gilles Peskine | 56c0161 | 2019-07-03 20:43:32 +0200 | [diff] [blame] | 4334 | msg "build: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY (ASan build)" |
Gilles Peskine | ca14459 | 2021-11-04 12:52:14 +0100 | [diff] [blame] | 4335 | scripts/config.py full |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4336 | scripts/config.py unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 4337 | scripts/config.py set MBEDTLS_CTR_DRBG_USE_128_BIT_KEY |
Gilles Peskine | cf74050 | 2019-07-03 20:43:05 +0200 | [diff] [blame] | 4338 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 4339 | make |
| 4340 | |
| 4341 | msg "test: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY (ASan build)" |
Gilles Peskine | 56c0161 | 2019-07-03 20:43:32 +0200 | [diff] [blame] | 4342 | make test |
Gilles Peskine | cf74050 | 2019-07-03 20:43:05 +0200 | [diff] [blame] | 4343 | } |
Gilles Peskine | ca14459 | 2021-11-04 12:52:14 +0100 | [diff] [blame] | 4344 | |
Gilles Peskine | cf74050 | 2019-07-03 20:43:05 +0200 | [diff] [blame] | 4345 | component_test_ctr_drbg_aes_128_sha_256 () { |
| 4346 | msg "build: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)" |
Gilles Peskine | ec10bf1 | 2019-09-20 19:56:06 +0200 | [diff] [blame] | 4347 | scripts/config.py full |
| 4348 | scripts/config.py unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 4349 | scripts/config.py set MBEDTLS_CTR_DRBG_USE_128_BIT_KEY |
| 4350 | scripts/config.py set MBEDTLS_ENTROPY_FORCE_SHA256 |
Gilles Peskine | e094a18 | 2020-04-14 20:08:41 +0200 | [diff] [blame] | 4351 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Gilles Peskine | ec10bf1 | 2019-09-20 19:56:06 +0200 | [diff] [blame] | 4352 | make |
| 4353 | |
| 4354 | msg "test: full + MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + MBEDTLS_ENTROPY_FORCE_SHA256 (ASan build)" |
| 4355 | make test |
| 4356 | } |
| 4357 | |
| 4358 | component_test_se_default () { |
| 4359 | msg "build: default config + MBEDTLS_PSA_CRYPTO_SE_C" |
| 4360 | scripts/config.py set MBEDTLS_PSA_CRYPTO_SE_C |
| 4361 | make CC=clang CFLAGS="$ASAN_CFLAGS -Os" LDFLAGS="$ASAN_CFLAGS" |
Manuel Pégourié-Gonnard | 68192fc | 2020-03-04 10:34:47 +0100 | [diff] [blame] | 4362 | |
Gilles Peskine | ec10bf1 | 2019-09-20 19:56:06 +0200 | [diff] [blame] | 4363 | msg "test: default config + MBEDTLS_PSA_CRYPTO_SE_C" |
| 4364 | make test |
| 4365 | } |
| 4366 | |
Manuel Pégourié-Gonnard | 68192fc | 2020-03-04 10:34:47 +0100 | [diff] [blame] | 4367 | component_test_psa_crypto_drivers () { |
Gilles Peskine | 1997f30 | 2023-07-26 18:45:20 +0200 | [diff] [blame] | 4368 | msg "build: full + test drivers dispatching to builtins" |
Gilles Peskine | ec10bf1 | 2019-09-20 19:56:06 +0200 | [diff] [blame] | 4369 | scripts/config.py full |
Gilles Peskine | 1997f30 | 2023-07-26 18:45:20 +0200 | [diff] [blame] | 4370 | scripts/config.py unset MBEDTLS_PSA_CRYPTO_CONFIG |
Gilles Peskine | ec10bf1 | 2019-09-20 19:56:06 +0200 | [diff] [blame] | 4371 | loc_cflags="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST_ALL" |
| 4372 | loc_cflags="${loc_cflags} '-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'" |
| 4373 | loc_cflags="${loc_cflags} -I../tests/include -O2" |
| 4374 | |
| 4375 | make CC=gcc CFLAGS="${loc_cflags}" LDFLAGS="$ASAN_CFLAGS" |
| 4376 | |
Gilles Peskine | 1997f30 | 2023-07-26 18:45:20 +0200 | [diff] [blame] | 4377 | msg "test: full + test drivers dispatching to builtins" |
Gilles Peskine | ec10bf1 | 2019-09-20 19:56:06 +0200 | [diff] [blame] | 4378 | make test |
| 4379 | } |
| 4380 | |
Gilles Peskine | abf9b4d | 2019-07-03 20:42:16 +0200 | [diff] [blame] | 4381 | component_test_make_shared () { |
| 4382 | msg "build/test: make shared" # ~ 40s |
| 4383 | make SHARED=1 all check |
| 4384 | ldd programs/util/strerror | grep libmbedcrypto |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4385 | programs/test/dlopen_demo.sh |
Gilles Peskine | abf9b4d | 2019-07-03 20:42:16 +0200 | [diff] [blame] | 4386 | } |
| 4387 | |
| 4388 | component_test_cmake_shared () { |
| 4389 | msg "build/test: cmake shared" # ~ 2min |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4390 | cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On . |
| 4391 | make |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4392 | ldd programs/util/strerror | grep libmbedcrypto |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 4393 | make test |
| 4394 | programs/test/dlopen_demo.sh |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4395 | } |
Gilles Peskine | 8fd5942 | 2019-10-21 17:11:33 +0200 | [diff] [blame] | 4396 | |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 4397 | test_build_opt () { |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 4398 | info=$1 cc=$2; shift 2 |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4399 | $cc --version |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 4400 | for opt in "$@"; do |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 4401 | msg "build/test: $cc $opt, $info" # ~ 30s |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 4402 | make CC="$cc" CFLAGS="$opt -std=c99 -pedantic -Wall -Wextra -Werror" |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 4403 | # We're confident enough in compilers to not run _all_ the tests, |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 4404 | # but at least run the unit tests. In particular, runs with |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 4405 | # optimizations use inline assembly whereas runs with -O0 |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 4406 | # skip inline assembly. |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 4407 | make test # ~30s |
| 4408 | make clean |
| 4409 | done |
| 4410 | } |
| 4411 | |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4412 | # For FreeBSD we invoke the function by name so this condition is added |
| 4413 | # to disable the existing test_clang_opt function for linux. |
| 4414 | if [[ $(uname) != "Linux" ]]; then |
| 4415 | component_test_clang_opt () { |
| 4416 | scripts/config.py full |
| 4417 | test_build_opt 'full config' clang -O0 -Os -O2 |
| 4418 | } |
| 4419 | fi |
| 4420 | |
| 4421 | component_test_clang_latest_opt () { |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4422 | scripts/config.py full |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4423 | test_build_opt 'full config' "$CLANG_LATEST" -O0 -Os -O2 |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4424 | } |
| 4425 | support_test_clang_latest_opt () { |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4426 | type "$CLANG_LATEST" >/dev/null 2>/dev/null |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 4427 | } |
| 4428 | |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4429 | component_test_clang_earliest_opt () { |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 4430 | scripts/config.py full |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4431 | test_build_opt 'full config' "$CLANG_EARLIEST" -O0 |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4432 | } |
| 4433 | support_test_clang_earliest_opt () { |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4434 | type "$CLANG_EARLIEST" >/dev/null 2>/dev/null |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4435 | } |
| 4436 | |
| 4437 | component_test_gcc_latest_opt () { |
| 4438 | scripts/config.py full |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4439 | test_build_opt 'full config' "$GCC_LATEST" -O0 -Os -O2 |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4440 | } |
| 4441 | support_test_gcc_latest_opt () { |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4442 | type "$GCC_LATEST" >/dev/null 2>/dev/null |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4443 | } |
| 4444 | |
| 4445 | component_test_gcc_earliest_opt () { |
| 4446 | scripts/config.py full |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4447 | test_build_opt 'full config' "$GCC_EARLIEST" -O0 |
Gowtham Suresh Kumar | a12baf8 | 2023-07-19 08:39:20 +0100 | [diff] [blame] | 4448 | } |
| 4449 | support_test_gcc_earliest_opt () { |
Gowtham Suresh Kumar | 6f1977b | 2023-07-28 17:04:47 +0100 | [diff] [blame] | 4450 | type "$GCC_EARLIEST" >/dev/null 2>/dev/null |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 4451 | } |
| 4452 | |
| 4453 | component_build_mbedtls_config_file () { |
| 4454 | msg "build: make with MBEDTLS_CONFIG_FILE" # ~40s |
Gilles Peskine | 2003c2f | 2022-04-07 20:55:57 +0200 | [diff] [blame] | 4455 | scripts/config.py -w full_config.h full |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4456 | echo '#error "MBEDTLS_CONFIG_FILE is not working"' >"$CONFIG_H" |
| 4457 | make CFLAGS="-I '$PWD' -DMBEDTLS_CONFIG_FILE='\"full_config.h\"'" |
Gilles Peskine | 45e680e | 2022-04-13 23:23:21 +0200 | [diff] [blame] | 4458 | # Make sure this feature is enabled. We'll disable it in the next phase. |
Gilles Peskine | e10df77 | 2022-04-07 21:06:41 +0200 | [diff] [blame] | 4459 | programs/test/query_compile_time_config MBEDTLS_NIST_KW_C |
| 4460 | make clean |
| 4461 | |
| 4462 | msg "build: make with MBEDTLS_CONFIG_FILE + MBEDTLS_USER_CONFIG_FILE" |
| 4463 | # In the user config, disable one feature (for simplicity, pick a feature |
| 4464 | # that nothing else depends on). |
| 4465 | echo '#undef MBEDTLS_NIST_KW_C' >user_config.h |
| 4466 | make CFLAGS="-I '$PWD' -DMBEDTLS_CONFIG_FILE='\"full_config.h\"' -DMBEDTLS_USER_CONFIG_FILE='\"user_config.h\"'" |
| 4467 | not programs/test/query_compile_time_config MBEDTLS_NIST_KW_C |
| 4468 | |
| 4469 | rm -f user_config.h full_config.h |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4470 | } |
| 4471 | |
Gilles Peskine | 7d904e7 | 2022-04-07 21:59:14 +0200 | [diff] [blame] | 4472 | component_build_psa_config_file () { |
| 4473 | msg "build: make with MBEDTLS_PSA_CRYPTO_CONFIG_FILE" # ~40s |
| 4474 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 4475 | cp "$CRYPTO_CONFIG_H" psa_test_config.h |
| 4476 | echo '#error "MBEDTLS_PSA_CRYPTO_CONFIG_FILE is not working"' >"$CRYPTO_CONFIG_H" |
| 4477 | make CFLAGS="-I '$PWD' -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE='\"psa_test_config.h\"'" |
Gilles Peskine | 45e680e | 2022-04-13 23:23:21 +0200 | [diff] [blame] | 4478 | # Make sure this feature is enabled. We'll disable it in the next phase. |
Gilles Peskine | 7d904e7 | 2022-04-07 21:59:14 +0200 | [diff] [blame] | 4479 | programs/test/query_compile_time_config MBEDTLS_CMAC_C |
| 4480 | make clean |
| 4481 | |
| 4482 | msg "build: make with MBEDTLS_PSA_CRYPTO_CONFIG_FILE + MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE" # ~40s |
| 4483 | # In the user config, disable one feature, which will reflect on the |
| 4484 | # mbedtls configuration so we can query it with query_compile_time_config. |
| 4485 | echo '#undef PSA_WANT_ALG_CMAC' >psa_user_config.h |
| 4486 | scripts/config.py unset MBEDTLS_CMAC_C |
| 4487 | make CFLAGS="-I '$PWD' -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE='\"psa_test_config.h\"' -DMBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE='\"psa_user_config.h\"'" |
| 4488 | not programs/test/query_compile_time_config MBEDTLS_CMAC_C |
| 4489 | |
| 4490 | rm -f psa_test_config.h psa_user_config.h |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4491 | } |
| 4492 | |
Gilles Peskine | df6e84a | 2023-02-22 22:09:51 +0100 | [diff] [blame] | 4493 | component_build_psa_alt_headers () { |
| 4494 | msg "build: make with PSA alt headers" # ~20s |
| 4495 | |
| 4496 | # Generate alternative versions of the substitutable headers with the |
| 4497 | # same content except different include guards. |
| 4498 | make -C tests include/alt-extra/psa/crypto_platform_alt.h include/alt-extra/psa/crypto_struct_alt.h |
| 4499 | |
| 4500 | # Build the library and some programs. |
| 4501 | # Don't build the fuzzers to avoid having to go through hoops to set |
| 4502 | # a correct include path for programs/fuzz/Makefile. |
| 4503 | make CFLAGS="-I ../tests/include/alt-extra -DMBEDTLS_PSA_CRYPTO_PLATFORM_FILE='\"psa/crypto_platform_alt.h\"' -DMBEDTLS_PSA_CRYPTO_STRUCT_FILE='\"psa/crypto_struct_alt.h\"'" lib |
| 4504 | make -C programs -o fuzz CFLAGS="-I ../tests/include/alt-extra -DMBEDTLS_PSA_CRYPTO_PLATFORM_FILE='\"psa/crypto_platform_alt.h\"' -DMBEDTLS_PSA_CRYPTO_STRUCT_FILE='\"psa/crypto_struct_alt.h\"'" |
| 4505 | |
| 4506 | # Check that we're getting the alternative include guards and not the |
| 4507 | # original include guards. |
| 4508 | programs/test/query_included_headers | grep -x PSA_CRYPTO_PLATFORM_ALT_H |
| 4509 | programs/test/query_included_headers | grep -x PSA_CRYPTO_STRUCT_ALT_H |
| 4510 | programs/test/query_included_headers | not grep -x PSA_CRYPTO_PLATFORM_H |
| 4511 | programs/test/query_included_headers | not grep -x PSA_CRYPTO_STRUCT_H |
| 4512 | } |
| 4513 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4514 | component_test_m32_o0 () { |
Gilles Peskine | 77f0535 | 2021-10-07 19:27:16 +0200 | [diff] [blame] | 4515 | # Build without optimization, so as to use portable C code (in a 32-bit |
| 4516 | # build) and not the i386-specific inline assembly. |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4517 | msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s |
| 4518 | scripts/config.py full |
Jerry Yu | bdd96b9 | 2023-08-16 17:34:27 +0800 | [diff] [blame] | 4519 | scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4520 | make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O0" LDFLAGS="-m32 $ASAN_CFLAGS" |
| 4521 | |
| 4522 | msg "test: i386, make, gcc -O0 (ASan build)" |
| 4523 | make test |
| 4524 | } |
| 4525 | support_test_m32_o0 () { |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 4526 | case $(uname -m) in |
Pengyu Lv | c92df3b | 2022-10-21 10:50:26 +0000 | [diff] [blame] | 4527 | amd64|x86_64) true;; |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4528 | *) false;; |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 4529 | esac |
| 4530 | } |
| 4531 | |
Gilles Peskine | ff0aee0 | 2021-10-05 09:36:03 +0200 | [diff] [blame] | 4532 | component_test_m32_o2 () { |
| 4533 | # Build with optimization, to use the i386 specific inline assembly |
| 4534 | # and go faster for tests. |
| 4535 | msg "build: i386, make, gcc -O2 (ASan build)" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4536 | scripts/config.py full |
Jerry Yu | bdd96b9 | 2023-08-16 17:34:27 +0800 | [diff] [blame] | 4537 | scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers |
Gilles Peskine | ff0aee0 | 2021-10-05 09:36:03 +0200 | [diff] [blame] | 4538 | make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS" |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 4539 | |
Gilles Peskine | ff0aee0 | 2021-10-05 09:36:03 +0200 | [diff] [blame] | 4540 | msg "test: i386, make, gcc -O2 (ASan build)" |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4541 | make test |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4542 | |
Gilles Peskine | ff0aee0 | 2021-10-05 09:36:03 +0200 | [diff] [blame] | 4543 | msg "test ssl-opt.sh, i386, make, gcc-O2" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4544 | tests/ssl-opt.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4545 | } |
Gilles Peskine | cf52222 | 2021-10-07 19:25:29 +0200 | [diff] [blame] | 4546 | support_test_m32_o2 () { |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 4547 | support_test_m32_o0 "$@" |
| 4548 | } |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4549 | |
Gilles Peskine | 0c6b799 | 2019-04-12 20:29:48 +0200 | [diff] [blame] | 4550 | component_test_m32_everest () { |
| 4551 | msg "build: i386, Everest ECDH context (ASan build)" # ~ 6 min |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4552 | scripts/config.py set MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED |
Jerry Yu | bdd96b9 | 2023-08-16 17:34:27 +0800 | [diff] [blame] | 4553 | scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers |
Gilles Peskine | 8fd5942 | 2019-10-21 17:11:33 +0200 | [diff] [blame] | 4554 | make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS" |
Gilles Peskine | 0c6b799 | 2019-04-12 20:29:48 +0200 | [diff] [blame] | 4555 | |
| 4556 | msg "test: i386, Everest ECDH context - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 4557 | make test |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4558 | |
| 4559 | msg "test: i386, Everest ECDH context - ECDH-related part of ssl-opt.sh (ASan build)" # ~ 5s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4560 | tests/ssl-opt.sh -f ECDH |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 4561 | |
| 4562 | msg "test: i386, Everest ECDH context - compat.sh with some ECDH ciphersuites (ASan build)" # ~ 3 min |
| 4563 | # Exclude some symmetric ciphers that are redundant here to gain time. |
Manuel Pégourié-Gonnard | 296787f | 2022-04-06 13:28:27 +0200 | [diff] [blame] | 4564 | tests/compat.sh -f ECDH -V NO -e 'ARIA\|CAMELLIA\|CHACHA' |
Gilles Peskine | 0c6b799 | 2019-04-12 20:29:48 +0200 | [diff] [blame] | 4565 | } |
| 4566 | support_test_m32_everest () { |
| 4567 | support_test_m32_o0 "$@" |
| 4568 | } |
| 4569 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4570 | component_test_mx32 () { |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4571 | msg "build: 64-bit ILP32, make, gcc" # ~ 30s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4572 | scripts/config.py full |
Gilles Peskine | 5d26e7c | 2019-06-07 14:50:09 +0200 | [diff] [blame] | 4573 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32' LDFLAGS='-mx32' |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4574 | |
| 4575 | msg "test: 64-bit ILP32, make, gcc" |
| 4576 | make test |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4577 | } |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 4578 | support_test_mx32 () { |
| 4579 | case $(uname -m) in |
| 4580 | amd64|x86_64) true;; |
| 4581 | *) false;; |
| 4582 | esac |
| 4583 | } |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4584 | |
Peter Kolbus | 60c6da2 | 2018-12-27 06:59:04 -0600 | [diff] [blame] | 4585 | component_test_min_mpi_window_size () { |
| 4586 | msg "build: Default + MBEDTLS_MPI_WINDOW_SIZE=1 (ASan build)" # ~ 10s |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4587 | scripts/config.py set MBEDTLS_MPI_WINDOW_SIZE 1 |
Peter Kolbus | 60c6da2 | 2018-12-27 06:59:04 -0600 | [diff] [blame] | 4588 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 4589 | make |
| 4590 | |
| 4591 | msg "test: MBEDTLS_MPI_WINDOW_SIZE=1 - main suites (inc. selftests) (ASan build)" # ~ 10s |
| 4592 | make test |
| 4593 | } |
| 4594 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4595 | component_test_have_int32 () { |
| 4596 | msg "build: gcc, force 32-bit bignum limbs" |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4597 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 4598 | scripts/config.py unset MBEDTLS_AESNI_C |
| 4599 | scripts/config.py unset MBEDTLS_PADLOCK_C |
Jerry Yu | e51eddc | 2023-01-11 14:16:08 +0800 | [diff] [blame] | 4600 | scripts/config.py unset MBEDTLS_AESCE_C |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4601 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 4602 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4603 | msg "test: gcc, force 32-bit bignum limbs" |
| 4604 | make test |
| 4605 | } |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 4606 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4607 | component_test_have_int64 () { |
| 4608 | msg "build: gcc, force 64-bit bignum limbs" |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4609 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 4610 | scripts/config.py unset MBEDTLS_AESNI_C |
| 4611 | scripts/config.py unset MBEDTLS_PADLOCK_C |
Jerry Yu | e51eddc | 2023-01-11 14:16:08 +0800 | [diff] [blame] | 4612 | scripts/config.py unset MBEDTLS_AESCE_C |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4613 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 4614 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4615 | msg "test: gcc, force 64-bit bignum limbs" |
| 4616 | make test |
| 4617 | } |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 4618 | |
Gabor Mezei | e256cc1 | 2023-07-26 17:28:48 +0200 | [diff] [blame] | 4619 | component_test_have_int32_cmake_new_bignum () { |
| 4620 | msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" |
| 4621 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 4622 | scripts/config.py unset MBEDTLS_AESNI_C |
| 4623 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 4624 | scripts/config.py unset MBEDTLS_AESCE_C |
| 4625 | scripts/config.py set MBEDTLS_TEST_HOOKS |
Janos Follath | 2f04582 | 2023-07-31 10:57:16 +0100 | [diff] [blame] | 4626 | scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT |
Janos Follath | f3135af | 2023-07-31 10:07:57 +0100 | [diff] [blame] | 4627 | make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS" |
Gabor Mezei | e256cc1 | 2023-07-26 17:28:48 +0200 | [diff] [blame] | 4628 | |
| 4629 | msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" |
| 4630 | make test |
| 4631 | } |
| 4632 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4633 | component_test_no_udbl_division () { |
| 4634 | msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4635 | scripts/config.py full |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4636 | scripts/config.py set MBEDTLS_NO_UDBL_DIVISION |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4637 | make CFLAGS='-Werror -O1' |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4638 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4639 | msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 4640 | make test |
| 4641 | } |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4642 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4643 | component_test_no_64bit_multiplication () { |
| 4644 | msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4645 | scripts/config.py full |
Gilles Peskine | 3bdd412 | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4646 | scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4647 | make CFLAGS='-Werror -O1' |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4648 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4649 | msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 4650 | make test |
| 4651 | } |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4652 | |
Gilles Peskine | 3809f5f | 2020-11-09 15:40:05 +0100 | [diff] [blame] | 4653 | component_test_no_strings () { |
| 4654 | msg "build: no strings" # ~10s |
| 4655 | scripts/config.py full |
| 4656 | # Disable options that activate a large amount of string constants. |
| 4657 | scripts/config.py unset MBEDTLS_DEBUG_C |
| 4658 | scripts/config.py unset MBEDTLS_ERROR_C |
| 4659 | scripts/config.py set MBEDTLS_ERROR_STRERROR_DUMMY |
| 4660 | scripts/config.py unset MBEDTLS_VERSION_FEATURES |
| 4661 | make CFLAGS='-Werror -Os' |
| 4662 | |
| 4663 | msg "test: no strings" # ~ 10s |
| 4664 | make test |
| 4665 | } |
| 4666 | |
Hanno Becker | c5722d1 | 2020-10-09 11:10:42 +0100 | [diff] [blame] | 4667 | component_test_no_x509_info () { |
| 4668 | msg "build: full + MBEDTLS_X509_REMOVE_INFO" # ~ 10s |
| 4669 | scripts/config.pl full |
| 4670 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
| 4671 | scripts/config.pl set MBEDTLS_X509_REMOVE_INFO |
Gilles Peskine | ff0aee0 | 2021-10-05 09:36:03 +0200 | [diff] [blame] | 4672 | make CFLAGS='-Werror -O2' |
Hanno Becker | c5722d1 | 2020-10-09 11:10:42 +0100 | [diff] [blame] | 4673 | |
| 4674 | msg "test: full + MBEDTLS_X509_REMOVE_INFO" # ~ 10s |
| 4675 | make test |
| 4676 | |
| 4677 | msg "test: ssl-opt.sh, full + MBEDTLS_X509_REMOVE_INFO" # ~ 1 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4678 | tests/ssl-opt.sh |
Hanno Becker | c5722d1 | 2020-10-09 11:10:42 +0100 | [diff] [blame] | 4679 | } |
| 4680 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4681 | component_build_arm_none_eabi_gcc () { |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4682 | msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1, baremetal+debug" # ~ 10s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4683 | scripts/config.py baremetal |
Gilles Peskine | aeedd74 | 2020-09-02 11:03:04 +0200 | [diff] [blame] | 4684 | make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra -O1' lib |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 4685 | |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4686 | msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1, baremetal+debug" |
Manuel Pégourié-Gonnard | a14b8f0 | 2023-03-28 12:49:39 +0200 | [diff] [blame] | 4687 | ${ARM_NONE_EABI_GCC_PREFIX}size -t library/*.o |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4688 | } |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4689 | |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 4690 | component_build_arm_linux_gnueabi_gcc_arm5vte () { |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4691 | msg "build: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=arm5vte, baremetal+debug" # ~ 10s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4692 | scripts/config.py baremetal |
Gilles Peskine | 2c897d7 | 2019-08-09 16:05:05 +0200 | [diff] [blame] | 4693 | # Build for a target platform that's close to what Debian uses |
| 4694 | # for its "armel" distribution (https://wiki.debian.org/ArmEabiPort). |
Dave Rodgman | 017a199 | 2022-03-31 14:07:01 +0100 | [diff] [blame] | 4695 | # See https://github.com/Mbed-TLS/mbedtls/pull/2169 and comments. |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 4696 | # Build everything including programs, see for example |
Dave Rodgman | 017a199 | 2022-03-31 14:07:01 +0100 | [diff] [blame] | 4697 | # https://github.com/Mbed-TLS/mbedtls/pull/3449#issuecomment-675313720 |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 4698 | make CC="${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc" AR="${ARM_LINUX_GNUEABI_GCC_PREFIX}ar" CFLAGS='-Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-march=armv5te' |
| 4699 | |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4700 | msg "size: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=armv5te -O1, baremetal+debug" |
Manuel Pégourié-Gonnard | a14b8f0 | 2023-03-28 12:49:39 +0200 | [diff] [blame] | 4701 | ${ARM_LINUX_GNUEABI_GCC_PREFIX}size -t library/*.o |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 4702 | } |
| 4703 | support_build_arm_linux_gnueabi_gcc_arm5vte () { |
| 4704 | type ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc >/dev/null 2>&1 |
| 4705 | } |
| 4706 | |
| 4707 | component_build_arm_none_eabi_gcc_arm5vte () { |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4708 | msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -march=arm5vte, baremetal+debug" # ~ 10s |
Manuel Pégourié-Gonnard | 3a6c769 | 2020-08-18 10:28:51 +0200 | [diff] [blame] | 4709 | scripts/config.py baremetal |
| 4710 | # This is an imperfect substitute for |
| 4711 | # component_build_arm_linux_gnueabi_gcc_arm5vte |
Manuel Pégourié-Gonnard | ae505ee | 2021-07-06 09:44:59 +0200 | [diff] [blame] | 4712 | # in case the gcc-arm-linux-gnueabi toolchain is not available |
Gilles Peskine | aeedd74 | 2020-09-02 11:03:04 +0200 | [diff] [blame] | 4713 | make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" CFLAGS='-std=c99 -Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-march=armv5te' SHELL='sh -x' lib |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 4714 | |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4715 | msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -march=armv5te -O1, baremetal+debug" |
Manuel Pégourié-Gonnard | a14b8f0 | 2023-03-28 12:49:39 +0200 | [diff] [blame] | 4716 | ${ARM_NONE_EABI_GCC_PREFIX}size -t library/*.o |
Gilles Peskine | 93e4e03 | 2019-08-05 11:34:25 +0200 | [diff] [blame] | 4717 | } |
| 4718 | |
Gilles Peskine | 6e2fb86 | 2020-04-30 23:00:53 +0200 | [diff] [blame] | 4719 | component_build_arm_none_eabi_gcc_m0plus () { |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4720 | msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -mthumb -mcpu=cortex-m0plus, baremetal_size" # ~ 10s |
| 4721 | scripts/config.py baremetal_size |
Gilles Peskine | aeedd74 | 2020-09-02 11:03:04 +0200 | [diff] [blame] | 4722 | make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra -mthumb -mcpu=cortex-m0plus -Os' lib |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 4723 | |
Gilles Peskine | e36fe81 | 2021-09-01 20:00:33 +0200 | [diff] [blame] | 4724 | msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -mthumb -mcpu=cortex-m0plus -Os, baremetal_size" |
Manuel Pégourié-Gonnard | a14b8f0 | 2023-03-28 12:49:39 +0200 | [diff] [blame] | 4725 | ${ARM_NONE_EABI_GCC_PREFIX}size -t library/*.o |
Manuel Pégourié-Gonnard | 67f8037 | 2023-06-06 13:01:18 +0200 | [diff] [blame] | 4726 | for lib in library/*.a; do |
| 4727 | echo "$lib:" |
| 4728 | ${ARM_NONE_EABI_GCC_PREFIX}size -t $lib | grep TOTALS |
| 4729 | done |
Gilles Peskine | 6e2fb86 | 2020-04-30 23:00:53 +0200 | [diff] [blame] | 4730 | } |
| 4731 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4732 | component_build_arm_none_eabi_gcc_no_udbl_division () { |
Gilles Peskine | 6d06134 | 2020-04-30 18:19:32 +0200 | [diff] [blame] | 4733 | msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4734 | scripts/config.py baremetal |
| 4735 | scripts/config.py set MBEDTLS_NO_UDBL_DIVISION |
Gilles Peskine | aeedd74 | 2020-09-02 11:03:04 +0200 | [diff] [blame] | 4736 | make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra' lib |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4737 | echo "Checking that software 64-bit division is not required" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4738 | not grep __aeabi_uldiv library/*.o |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4739 | } |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4740 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4741 | component_build_arm_none_eabi_gcc_no_64bit_multiplication () { |
Gilles Peskine | 6d06134 | 2020-04-30 18:19:32 +0200 | [diff] [blame] | 4742 | msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4743 | scripts/config.py baremetal |
| 4744 | scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION |
Gilles Peskine | aeedd74 | 2020-09-02 11:03:04 +0200 | [diff] [blame] | 4745 | make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -O1 -march=armv6-m -mthumb' lib |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4746 | echo "Checking that software 64-bit multiplication is not required" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 4747 | not grep __aeabi_lmul library/*.o |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4748 | } |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 4749 | |
Dave Rodgman | 8c315f2 | 2023-06-02 10:26:24 -0400 | [diff] [blame] | 4750 | component_build_arm_clang_thumb () { |
| 4751 | # ~ 30s |
| 4752 | |
| 4753 | scripts/config.py baremetal |
| 4754 | |
| 4755 | msg "build: clang thumb 2, make" |
| 4756 | make clean |
| 4757 | make CC="clang" CFLAGS='-std=c99 -Werror -Os --target=arm-linux-gnueabihf -march=armv7-m -mthumb' lib |
| 4758 | |
| 4759 | # Some Thumb 1 asm is sensitive to optimisation level, so test both -O0 and -Os |
| 4760 | msg "build: clang thumb 1 -O0, make" |
| 4761 | make clean |
| 4762 | make CC="clang" CFLAGS='-std=c99 -Werror -O0 --target=arm-linux-gnueabihf -mcpu=arm1136j-s -mthumb' lib |
| 4763 | |
| 4764 | msg "build: clang thumb 1 -Os, make" |
| 4765 | make clean |
| 4766 | make CC="clang" CFLAGS='-std=c99 -Werror -Os --target=arm-linux-gnueabihf -mcpu=arm1136j-s -mthumb' lib |
| 4767 | } |
| 4768 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4769 | component_build_armcc () { |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 4770 | msg "build: ARM Compiler 5" |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 4771 | scripts/config.py baremetal |
Tom Cosgrove | 87fbfb5 | 2022-03-15 10:51:52 +0000 | [diff] [blame] | 4772 | # armc[56] don't support SHA-512 intrinsics |
| 4773 | scripts/config.py unset MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT |
Dave Rodgman | 2f386c5 | 2023-03-02 13:38:33 +0000 | [diff] [blame] | 4774 | |
Dave Rodgman | 0fddf82 | 2023-03-02 15:32:12 +0000 | [diff] [blame] | 4775 | # Stop armclang warning about feature detection for A64_CRYPTO. |
| 4776 | # With this enabled, the library does build correctly under armclang, |
| 4777 | # but in baremetal builds (as tested here), feature detection is |
| 4778 | # unavailable, and the user is notified via a #warning. So enabling |
| 4779 | # this feature would prevent us from building with -Werror on |
| 4780 | # armclang. Tracked in #7198. |
Dave Rodgman | 2f386c5 | 2023-03-02 13:38:33 +0000 | [diff] [blame] | 4781 | scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT |
| 4782 | |
Hanno Becker | f0762e9 | 2022-07-15 12:08:19 +0100 | [diff] [blame] | 4783 | scripts/config.py set MBEDTLS_HAVE_ASM |
Tom Cosgrove | 87fbfb5 | 2022-03-15 10:51:52 +0000 | [diff] [blame] | 4784 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 4785 | make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib |
Gilles Peskine | 18487f6 | 2020-04-30 23:11:54 +0200 | [diff] [blame] | 4786 | |
| 4787 | msg "size: ARM Compiler 5" |
| 4788 | "$ARMC5_FROMELF" -z library/*.o |
| 4789 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 4790 | make clean |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 4791 | |
Dave Rodgman | b45d58b | 2023-06-02 13:54:00 -0400 | [diff] [blame] | 4792 | # Compile mostly with -O1 since some Arm inline assembly is disabled for -O0. |
Hanno Becker | f0762e9 | 2022-07-15 12:08:19 +0100 | [diff] [blame] | 4793 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 4794 | # ARM Compiler 6 - Target ARMv7-A |
Dave Rodgman | 03f7a6e | 2022-08-17 14:35:29 +0100 | [diff] [blame] | 4795 | armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv7-a" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 4796 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 4797 | # ARM Compiler 6 - Target ARMv7-M |
Dave Rodgman | 03f7a6e | 2022-08-17 14:35:29 +0100 | [diff] [blame] | 4798 | armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv7-m" |
| 4799 | |
| 4800 | # ARM Compiler 6 - Target ARMv7-M+DSP |
| 4801 | armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv7-m+dsp" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 4802 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 4803 | # ARM Compiler 6 - Target ARMv8-A - AArch32 |
Dave Rodgman | 03f7a6e | 2022-08-17 14:35:29 +0100 | [diff] [blame] | 4804 | armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv8.2-a" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 4805 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 4806 | # ARM Compiler 6 - Target ARMv8-M |
Dave Rodgman | 03f7a6e | 2022-08-17 14:35:29 +0100 | [diff] [blame] | 4807 | armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv8-m.main" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 4808 | |
Tom Cosgrove | 6ec39ca | 2023-06-09 15:34:31 +0100 | [diff] [blame] | 4809 | # ARM Compiler 6 - Target ARMv8.2-A - AArch64 |
| 4810 | armc6_build_test "-O1 --target=aarch64-arm-none-eabi -march=armv8.2-a+crypto" |
| 4811 | |
Dave Rodgman | b45d58b | 2023-06-02 13:54:00 -0400 | [diff] [blame] | 4812 | # ARM Compiler 6 - Target Cortex-M0 - no optimisation |
| 4813 | armc6_build_test "-O0 --target=arm-arm-none-eabi -mcpu=cortex-m0" |
| 4814 | |
Dave Rodgman | 99318e6 | 2023-05-24 12:27:42 +0100 | [diff] [blame] | 4815 | # ARM Compiler 6 - Target Cortex-M0 |
| 4816 | armc6_build_test "-Os --target=arm-arm-none-eabi -mcpu=cortex-m0" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 4817 | } |
Tom Cosgrove | 6ec39ca | 2023-06-09 15:34:31 +0100 | [diff] [blame] | 4818 | |
Pengyu Lv | df07003 | 2023-02-24 16:03:31 +0800 | [diff] [blame] | 4819 | support_build_armcc () { |
Pengyu Lv | c6298ad | 2023-03-01 10:31:29 +0800 | [diff] [blame] | 4820 | armc5_cc="$ARMC5_BIN_DIR/armcc" |
| 4821 | armc6_cc="$ARMC6_BIN_DIR/armclang" |
| 4822 | (check_tools "$armc5_cc" "$armc6_cc" > /dev/null 2>&1) |
Pengyu Lv | df07003 | 2023-02-24 16:03:31 +0800 | [diff] [blame] | 4823 | } |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 4824 | |
Jerry Yu | 81d5e1f | 2022-01-27 13:01:01 +0800 | [diff] [blame] | 4825 | component_test_tls13_only () { |
| 4826 | msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3, without MBEDTLS_SSL_PROTO_TLS1_2" |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4827 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Jerry Yu | da5af22 | 2021-12-24 18:45:45 +0800 | [diff] [blame] | 4828 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4829 | |
Gilles Peskine | 4bb369c | 2022-10-29 17:44:19 +0200 | [diff] [blame] | 4830 | msg "test: TLS 1.3 only, all key exchange modes enabled" |
| 4831 | make test |
Jerry Yu | baa4934 | 2022-02-15 10:26:40 +0800 | [diff] [blame] | 4832 | |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4833 | msg "ssl-opt.sh: TLS 1.3 only, all key exchange modes enabled" |
| 4834 | tests/ssl-opt.sh |
Jerry Yu | da5af22 | 2021-12-24 18:45:45 +0800 | [diff] [blame] | 4835 | } |
| 4836 | |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4837 | component_test_tls13_only_psk () { |
| 4838 | msg "build: TLS 1.3 only from default, only PSK key exchange mode" |
| 4839 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 4840 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
| 4841 | scripts/config.py unset MBEDTLS_ECDH_C |
Przemek Stekiel | 0c23147 | 2023-06-14 11:12:45 +0200 | [diff] [blame] | 4842 | scripts/config.py unset MBEDTLS_DHM_C |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4843 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 4844 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 4845 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
| 4846 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 4847 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
Dave Rodgman | 71565cf | 2022-11-11 10:37:38 +0000 | [diff] [blame] | 4848 | scripts/config.py unset MBEDTLS_PKCS7_C |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4849 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | e3dac4a | 2022-06-10 17:21:51 +0200 | [diff] [blame] | 4850 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4851 | |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4852 | msg "test_suite_ssl: TLS 1.3 only, only PSK key exchange mode enabled" |
| 4853 | cd tests; ./test_suite_ssl; cd .. |
Ronald Cron | e3dac4a | 2022-06-10 17:21:51 +0200 | [diff] [blame] | 4854 | |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4855 | msg "ssl-opt.sh: TLS 1.3 only, only PSK key exchange mode enabled" |
| 4856 | tests/ssl-opt.sh |
| 4857 | } |
| 4858 | |
| 4859 | component_test_tls13_only_ephemeral () { |
| 4860 | msg "build: TLS 1.3 only from default, only ephemeral key exchange mode" |
| 4861 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 4862 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
Xiaokang Qian | 2dbfeda | 2022-11-15 10:52:57 +0000 | [diff] [blame] | 4863 | scripts/config.py unset MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4864 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4865 | |
| 4866 | msg "test_suite_ssl: TLS 1.3 only, only ephemeral key exchange mode" |
| 4867 | cd tests; ./test_suite_ssl; cd .. |
| 4868 | |
| 4869 | msg "ssl-opt.sh: TLS 1.3 only, only ephemeral key exchange mode" |
| 4870 | tests/ssl-opt.sh |
| 4871 | } |
| 4872 | |
Przemek Stekiel | a01c242 | 2023-06-13 10:46:48 +0200 | [diff] [blame] | 4873 | component_test_tls13_only_ephemeral_ffdh () { |
| 4874 | msg "build: TLS 1.3 only from default, only ephemeral ffdh key exchange mode" |
| 4875 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 4876 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
| 4877 | scripts/config.py unset MBEDTLS_SSL_EARLY_DATA |
Przemek Stekiel | ce05f54 | 2023-06-15 16:44:08 +0200 | [diff] [blame] | 4878 | scripts/config.py unset MBEDTLS_ECDH_C |
| 4879 | |
Przemek Stekiel | a01c242 | 2023-06-13 10:46:48 +0200 | [diff] [blame] | 4880 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4881 | |
| 4882 | msg "test_suite_ssl: TLS 1.3 only, only ephemeral ffdh key exchange mode" |
| 4883 | cd tests; ./test_suite_ssl; cd .. |
| 4884 | |
| 4885 | msg "ssl-opt.sh: TLS 1.3 only, only ephemeral ffdh key exchange mode" |
| 4886 | tests/ssl-opt.sh |
| 4887 | } |
| 4888 | |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4889 | component_test_tls13_only_psk_ephemeral () { |
| 4890 | msg "build: TLS 1.3 only from default, only PSK ephemeral key exchange mode" |
| 4891 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 4892 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 4893 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 4894 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 4895 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
| 4896 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 4897 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
Dave Rodgman | 71565cf | 2022-11-11 10:37:38 +0000 | [diff] [blame] | 4898 | scripts/config.py unset MBEDTLS_PKCS7_C |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4899 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4900 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4901 | |
| 4902 | msg "test_suite_ssl: TLS 1.3 only, only PSK ephemeral key exchange mode" |
| 4903 | cd tests; ./test_suite_ssl; cd .. |
| 4904 | |
| 4905 | msg "ssl-opt.sh: TLS 1.3 only, only PSK ephemeral key exchange mode" |
| 4906 | tests/ssl-opt.sh |
| 4907 | } |
| 4908 | |
Przemek Stekiel | a01c242 | 2023-06-13 10:46:48 +0200 | [diff] [blame] | 4909 | component_test_tls13_only_psk_ephemeral_ffdh () { |
| 4910 | msg "build: TLS 1.3 only from default, only PSK ephemeral ffdh key exchange mode" |
| 4911 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 4912 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 4913 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 4914 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 4915 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
| 4916 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 4917 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 4918 | scripts/config.py unset MBEDTLS_PKCS7_C |
| 4919 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Przemek Stekiel | ce05f54 | 2023-06-15 16:44:08 +0200 | [diff] [blame] | 4920 | scripts/config.py unset MBEDTLS_ECDH_C |
Przemek Stekiel | a01c242 | 2023-06-13 10:46:48 +0200 | [diff] [blame] | 4921 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4922 | |
| 4923 | msg "test_suite_ssl: TLS 1.3 only, only PSK ephemeral ffdh key exchange mode" |
| 4924 | cd tests; ./test_suite_ssl; cd .. |
| 4925 | |
| 4926 | msg "ssl-opt.sh: TLS 1.3 only, only PSK ephemeral ffdh key exchange mode" |
| 4927 | tests/ssl-opt.sh |
| 4928 | } |
| 4929 | |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4930 | component_test_tls13_only_psk_all () { |
| 4931 | msg "build: TLS 1.3 only from default, without ephemeral key exchange mode" |
| 4932 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 4933 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 4934 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 4935 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
| 4936 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 4937 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
Dave Rodgman | 71565cf | 2022-11-11 10:37:38 +0000 | [diff] [blame] | 4938 | scripts/config.py unset MBEDTLS_PKCS7_C |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4939 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4940 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4941 | |
| 4942 | msg "test_suite_ssl: TLS 1.3 only, PSK and PSK ephemeral key exchange modes" |
| 4943 | cd tests; ./test_suite_ssl; cd .. |
| 4944 | |
| 4945 | msg "ssl-opt.sh: TLS 1.3 only, PSK and PSK ephemeral key exchange modes" |
| 4946 | tests/ssl-opt.sh |
| 4947 | } |
| 4948 | |
| 4949 | component_test_tls13_only_ephemeral_all () { |
| 4950 | msg "build: TLS 1.3 only from default, without PSK key exchange mode" |
| 4951 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4952 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | c3f43b6 | 2022-10-17 17:35:32 +0200 | [diff] [blame] | 4953 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4954 | |
| 4955 | msg "test_suite_ssl: TLS 1.3 only, ephemeral and PSK ephemeral key exchange modes" |
| 4956 | cd tests; ./test_suite_ssl; cd .. |
| 4957 | |
| 4958 | msg "ssl-opt.sh: TLS 1.3 only, ephemeral and PSK ephemeral key exchange modes" |
| 4959 | tests/ssl-opt.sh |
Ronald Cron | e3dac4a | 2022-06-10 17:21:51 +0200 | [diff] [blame] | 4960 | } |
| 4961 | |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 4962 | component_test_tls13 () { |
| 4963 | msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding" |
| 4964 | scripts/config.py set MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | fdb0e3f | 2021-12-09 10:39:19 +0100 | [diff] [blame] | 4965 | scripts/config.py set MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE |
| 4966 | scripts/config.py set MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 1 |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4967 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | fdb0e3f | 2021-12-09 10:39:19 +0100 | [diff] [blame] | 4968 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 4969 | make |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 4970 | msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding" |
Ronald Cron | fdb0e3f | 2021-12-09 10:39:19 +0100 | [diff] [blame] | 4971 | make test |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 4972 | msg "ssl-opt.sh (TLS 1.3)" |
Gilles Peskine | 827dbd9 | 2022-02-04 00:30:54 +0100 | [diff] [blame] | 4973 | tests/ssl-opt.sh |
Ronald Cron | fdb0e3f | 2021-12-09 10:39:19 +0100 | [diff] [blame] | 4974 | } |
| 4975 | |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 4976 | component_test_tls13_no_compatibility_mode () { |
| 4977 | msg "build: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding" |
| 4978 | scripts/config.py set MBEDTLS_SSL_PROTO_TLS1_3 |
Ronald Cron | fdb0e3f | 2021-12-09 10:39:19 +0100 | [diff] [blame] | 4979 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE |
| 4980 | scripts/config.py set MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 1 |
Ronald Cron | c2e110f | 2022-11-22 09:01:46 +0100 | [diff] [blame] | 4981 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Hanno Becker | a711f6e | 2020-05-04 12:03:51 +0100 | [diff] [blame] | 4982 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 4983 | make |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 4984 | msg "test: default config with MBEDTLS_SSL_PROTO_TLS1_3 enabled, without padding" |
Hanno Becker | 6c53ecc | 2021-08-01 19:20:10 +0100 | [diff] [blame] | 4985 | make test |
Ronald Cron | 6f135e1 | 2021-12-08 16:57:54 +0100 | [diff] [blame] | 4986 | msg "ssl-opt.sh (TLS 1.3 no compatibility mode)" |
Gilles Peskine | 827dbd9 | 2022-02-04 00:30:54 +0100 | [diff] [blame] | 4987 | tests/ssl-opt.sh |
Hanno Becker | 6c53ecc | 2021-08-01 19:20:10 +0100 | [diff] [blame] | 4988 | } |
| 4989 | |
Jan Bruckner | 151f642 | 2023-02-10 12:45:19 +0100 | [diff] [blame] | 4990 | component_test_tls13_only_record_size_limit () { |
| 4991 | msg "build: TLS 1.3 only from default, record size limit extension enabled" |
| 4992 | scripts/config.py set MBEDTLS_SSL_RECORD_SIZE_LIMIT |
| 4993 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 4994 | |
| 4995 | msg "test_suite_ssl: TLS 1.3 only, record size limit extension enabled" |
| 4996 | cd tests; ./test_suite_ssl; cd .. |
| 4997 | |
| 4998 | msg "ssl-opt.sh: (TLS 1.3 only, record size limit extension tests only)" |
| 4999 | # Both the server and the client will currently abort the handshake when they encounter the |
| 5000 | # record size limit extension. There is no way to prevent gnutls-cli from sending the extension |
| 5001 | # which makes all G_NEXT_CLI + P_SRV tests fail. Thus, run only the tests for the this extension. |
| 5002 | tests/ssl-opt.sh -f "Record Size Limit" |
| 5003 | } |
| 5004 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5005 | component_build_mingw () { |
| 5006 | msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s |
Jerry Yu | bdd96b9 | 2023-08-16 17:34:27 +0800 | [diff] [blame] | 5007 | scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers |
Andrzej Kurek | 232e8f9 | 2019-10-03 03:18:01 -0400 | [diff] [blame] | 5008 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 lib programs |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 5009 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5010 | # note Make tests only builds the tests, but doesn't run them |
Andrzej Kurek | 232e8f9 | 2019-10-03 03:18:01 -0400 | [diff] [blame] | 5011 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 tests |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5012 | make WINDOWS_BUILD=1 clean |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 5013 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5014 | msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s |
Andrzej Kurek | 232e8f9 | 2019-10-03 03:18:01 -0400 | [diff] [blame] | 5015 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 lib programs |
| 5016 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 tests |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5017 | make WINDOWS_BUILD=1 clean |
| 5018 | } |
Jaeden Amero | 117b8a4 | 2019-04-17 15:19:26 +0100 | [diff] [blame] | 5019 | support_build_mingw() { |
Pengyu Lv | 51b5f00 | 2023-02-24 15:38:52 +0800 | [diff] [blame] | 5020 | case $(i686-w64-mingw32-gcc -dumpversion 2>/dev/null) in |
| 5021 | [0-5]*|"") false;; |
Jaeden Amero | 117b8a4 | 2019-04-17 15:19:26 +0100 | [diff] [blame] | 5022 | *) true;; |
| 5023 | esac |
| 5024 | } |
Simon Butcher | 91aef33 | 2016-11-17 09:20:50 +0000 | [diff] [blame] | 5025 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5026 | component_test_memsan () { |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5027 | msg "build: MSan (clang)" # ~ 1 min 20s |
Gilles Peskine | 5d46f6a | 2019-07-27 23:52:53 +0200 | [diff] [blame] | 5028 | scripts/config.py unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5029 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 5030 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 5031 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5032 | msg "test: main suites (MSan)" # ~ 10s |
| 5033 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 5034 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5035 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5036 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 5037 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5038 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 5039 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5040 | if [ "$MEMORY" -gt 0 ]; then |
| 5041 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5042 | tests/compat.sh |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5043 | fi |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5044 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 5045 | |
Gilles Peskine | 69f190e | 2019-01-10 00:11:42 +0100 | [diff] [blame] | 5046 | component_test_valgrind () { |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5047 | msg "build: Release (clang)" |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5048 | # default config, in particular without MBEDTLS_USE_PSA_CRYPTO |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5049 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 5050 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 5051 | |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5052 | msg "test: main suites, Valgrind (default config)" |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5053 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 5054 | |
Gilles Peskine | 636c26a | 2020-03-04 20:46:15 +0100 | [diff] [blame] | 5055 | # Optional parts (slow; currently broken on OS X because programs don't |
| 5056 | # seem to receive signals under valgrind on OS X). |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5057 | # These optional parts don't run on the CI. |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5058 | if [ "$MEMORY" -gt 0 ]; then |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5059 | msg "test: ssl-opt.sh --memcheck (default config)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5060 | tests/ssl-opt.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5061 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 5062 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5063 | if [ "$MEMORY" -gt 1 ]; then |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5064 | msg "test: compat.sh --memcheck (default config)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5065 | tests/compat.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 5066 | fi |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 5067 | |
| 5068 | if [ "$MEMORY" -gt 0 ]; then |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5069 | msg "test: context-info.sh --memcheck (default config)" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5070 | tests/context-info.sh --memcheck |
Piotr Nowicki | 9978e6e | 2020-04-07 16:07:05 +0200 | [diff] [blame] | 5071 | fi |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5072 | } |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 5073 | |
Gilles Peskine | df3dd4c | 2022-11-29 16:45:30 +0100 | [diff] [blame] | 5074 | component_test_valgrind_psa () { |
| 5075 | msg "build: Release, full (clang)" |
| 5076 | # full config, in particular with MBEDTLS_USE_PSA_CRYPTO |
| 5077 | scripts/config.py full |
| 5078 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 5079 | make |
| 5080 | |
| 5081 | msg "test: main suites, Valgrind (full config)" |
| 5082 | make memcheck |
| 5083 | } |
| 5084 | |
Paul Elliott | 62dc392 | 2021-11-25 17:29:40 +0000 | [diff] [blame] | 5085 | support_test_cmake_out_of_source () { |
| 5086 | distrib_id="" |
| 5087 | distrib_ver="" |
| 5088 | distrib_ver_minor="" |
| 5089 | distrib_ver_major="" |
| 5090 | |
| 5091 | # Attempt to parse lsb-release to find out distribution and version. If not |
| 5092 | # found this should fail safe (test is supported). |
| 5093 | if [[ -f /etc/lsb-release ]]; then |
| 5094 | |
| 5095 | while read -r lsb_line; do |
| 5096 | case "$lsb_line" in |
| 5097 | "DISTRIB_ID"*) distrib_id=${lsb_line/#DISTRIB_ID=};; |
| 5098 | "DISTRIB_RELEASE"*) distrib_ver=${lsb_line/#DISTRIB_RELEASE=};; |
| 5099 | esac |
| 5100 | done < /etc/lsb-release |
| 5101 | |
| 5102 | distrib_ver_major="${distrib_ver%%.*}" |
| 5103 | distrib_ver="${distrib_ver#*.}" |
| 5104 | distrib_ver_minor="${distrib_ver%%.*}" |
| 5105 | fi |
| 5106 | |
| 5107 | # Running the out of source CMake test on Ubuntu 16.04 using more than one |
| 5108 | # processor (as the CI does) can create a race condition whereby the build |
| 5109 | # fails to see a generated file, despite that file actually having been |
| 5110 | # generated. This problem appears to go away with 18.04 or newer, so make |
| 5111 | # the out of source tests unsupported on Ubuntu 16.04. |
| 5112 | [ "$distrib_id" != "Ubuntu" ] || [ "$distrib_ver_major" -gt 16 ] |
| 5113 | } |
| 5114 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5115 | component_test_cmake_out_of_source () { |
| 5116 | msg "build: cmake 'out-of-source' build" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5117 | MBEDTLS_ROOT_DIR="$PWD" |
| 5118 | mkdir "$OUT_OF_SOURCE_DIR" |
| 5119 | cd "$OUT_OF_SOURCE_DIR" |
Gilles Peskine | dbf7b7e | 2021-10-07 19:34:57 +0200 | [diff] [blame] | 5120 | cmake -D CMAKE_BUILD_TYPE:String=Check "$MBEDTLS_ROOT_DIR" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5121 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 5122 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5123 | msg "test: cmake 'out-of-source' build" |
| 5124 | make test |
Gilles Peskine | a841c2a | 2022-04-16 11:31:25 +0200 | [diff] [blame] | 5125 | # Check that ssl-opt.sh can find the test programs. |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5126 | # Also ensure that there are no error messages such as |
| 5127 | # "No such file or directory", which would indicate that some required |
| 5128 | # file is missing (ssl-opt.sh tolerates the absence of some files so |
| 5129 | # may exit with status 0 but emit errors). |
Gilles Peskine | a841c2a | 2022-04-16 11:31:25 +0200 | [diff] [blame] | 5130 | ./tests/ssl-opt.sh -f 'Default' >ssl-opt.out 2>ssl-opt.err |
Gilles Peskine | 7393ec5 | 2022-04-15 22:43:38 +0200 | [diff] [blame] | 5131 | grep PASS ssl-opt.out |
Gilles Peskine | f7e956c | 2020-03-28 18:56:09 +0100 | [diff] [blame] | 5132 | cat ssl-opt.err >&2 |
| 5133 | # If ssl-opt.err is non-empty, record an error and keep going. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5134 | [ ! -s ssl-opt.err ] |
Gilles Peskine | 7393ec5 | 2022-04-15 22:43:38 +0200 | [diff] [blame] | 5135 | rm ssl-opt.out ssl-opt.err |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5136 | cd "$MBEDTLS_ROOT_DIR" |
| 5137 | rm -rf "$OUT_OF_SOURCE_DIR" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5138 | } |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 5139 | |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 5140 | component_test_cmake_as_subdirectory () { |
| 5141 | msg "build: cmake 'as-subdirectory' build" |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 5142 | cd programs/test/cmake_subproject |
| 5143 | cmake . |
| 5144 | make |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5145 | ./cmake_subproject |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 5146 | } |
Gilles Peskine | a300099 | 2022-02-04 00:21:12 +0100 | [diff] [blame] | 5147 | support_test_cmake_as_subdirectory () { |
| 5148 | support_test_cmake_out_of_source |
Jaeden Amero | ab83fdf | 2019-06-20 17:38:22 +0100 | [diff] [blame] | 5149 | } |
| 5150 | |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5151 | component_test_cmake_as_package () { |
| 5152 | msg "build: cmake 'as-package' build" |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5153 | cd programs/test/cmake_package |
| 5154 | cmake . |
| 5155 | make |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5156 | ./cmake_package |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5157 | } |
Gilles Peskine | a300099 | 2022-02-04 00:21:12 +0100 | [diff] [blame] | 5158 | support_test_cmake_as_package () { |
| 5159 | support_test_cmake_out_of_source |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5160 | } |
| 5161 | |
| 5162 | component_test_cmake_as_package_install () { |
| 5163 | msg "build: cmake 'as-installed-package' build" |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5164 | cd programs/test/cmake_package_install |
| 5165 | cmake . |
| 5166 | make |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5167 | ./cmake_package_install |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5168 | } |
Gilles Peskine | a300099 | 2022-02-04 00:21:12 +0100 | [diff] [blame] | 5169 | support_test_cmake_as_package_install () { |
| 5170 | support_test_cmake_out_of_source |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 5171 | } |
| 5172 | |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5173 | component_build_cmake_custom_config_file () { |
David Horstmann | 969c145 | 2023-01-31 10:34:44 +0000 | [diff] [blame] | 5174 | # Make a copy of config file to use for the in-tree test |
| 5175 | cp "$CONFIG_H" include/mbedtls_config_in_tree_copy.h |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5176 | |
| 5177 | MBEDTLS_ROOT_DIR="$PWD" |
| 5178 | mkdir "$OUT_OF_SOURCE_DIR" |
| 5179 | cd "$OUT_OF_SOURCE_DIR" |
| 5180 | |
David Horstmann | 969c145 | 2023-01-31 10:34:44 +0000 | [diff] [blame] | 5181 | # Build once to get the generated files (which need an intact config file) |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5182 | cmake "$MBEDTLS_ROOT_DIR" |
| 5183 | make |
| 5184 | |
| 5185 | msg "build: cmake with -DMBEDTLS_CONFIG_FILE" |
| 5186 | scripts/config.py -w full_config.h full |
David Horstmann | 969c145 | 2023-01-31 10:34:44 +0000 | [diff] [blame] | 5187 | echo '#error "cmake -DMBEDTLS_CONFIG_FILE is not working."' > "$MBEDTLS_ROOT_DIR/$CONFIG_H" |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5188 | cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h "$MBEDTLS_ROOT_DIR" |
| 5189 | make |
| 5190 | |
| 5191 | msg "build: cmake with -DMBEDTLS_CONFIG_FILE + -DMBEDTLS_USER_CONFIG_FILE" |
| 5192 | # In the user config, disable one feature (for simplicity, pick a feature |
| 5193 | # that nothing else depends on). |
| 5194 | echo '#undef MBEDTLS_NIST_KW_C' >user_config.h |
| 5195 | |
| 5196 | cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h -DMBEDTLS_USER_CONFIG_FILE=user_config.h "$MBEDTLS_ROOT_DIR" |
| 5197 | make |
| 5198 | not programs/test/query_compile_time_config MBEDTLS_NIST_KW_C |
| 5199 | |
| 5200 | rm -f user_config.h full_config.h |
| 5201 | |
| 5202 | cd "$MBEDTLS_ROOT_DIR" |
| 5203 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 5204 | |
| 5205 | # Now repeat the test for an in-tree build: |
| 5206 | |
David Horstmann | 969c145 | 2023-01-31 10:34:44 +0000 | [diff] [blame] | 5207 | # Restore config for the in-tree test |
| 5208 | mv include/mbedtls_config_in_tree_copy.h "$CONFIG_H" |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5209 | |
David Horstmann | 969c145 | 2023-01-31 10:34:44 +0000 | [diff] [blame] | 5210 | # Build once to get the generated files (which need an intact config) |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5211 | cmake . |
| 5212 | make |
| 5213 | |
| 5214 | msg "build: cmake (in-tree) with -DMBEDTLS_CONFIG_FILE" |
| 5215 | scripts/config.py -w full_config.h full |
David Horstmann | 969c145 | 2023-01-31 10:34:44 +0000 | [diff] [blame] | 5216 | echo '#error "cmake -DMBEDTLS_CONFIG_FILE is not working."' > "$MBEDTLS_ROOT_DIR/$CONFIG_H" |
David Horstmann | 20550e3 | 2023-01-12 14:17:01 +0000 | [diff] [blame] | 5217 | cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h . |
| 5218 | make |
| 5219 | |
| 5220 | msg "build: cmake (in-tree) with -DMBEDTLS_CONFIG_FILE + -DMBEDTLS_USER_CONFIG_FILE" |
| 5221 | # In the user config, disable one feature (for simplicity, pick a feature |
| 5222 | # that nothing else depends on). |
| 5223 | echo '#undef MBEDTLS_NIST_KW_C' >user_config.h |
| 5224 | |
| 5225 | cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h -DMBEDTLS_USER_CONFIG_FILE=user_config.h . |
| 5226 | make |
| 5227 | not programs/test/query_compile_time_config MBEDTLS_NIST_KW_C |
| 5228 | |
| 5229 | rm -f user_config.h full_config.h |
| 5230 | } |
| 5231 | support_build_cmake_custom_config_file () { |
| 5232 | support_test_cmake_out_of_source |
| 5233 | } |
| 5234 | |
| 5235 | |
Tom Cosgrove | daddf11 | 2023-09-01 10:40:15 +0100 | [diff] [blame] | 5236 | component_build_zeroize_checks () { |
| 5237 | msg "build: check for obviously wrong calls to mbedtls_platform_zeroize()" |
| 5238 | |
| 5239 | scripts/config.py full |
| 5240 | |
| 5241 | # Only compile - we're looking for sizeof-pointer-memaccess warnings |
Tom Cosgrove | b2fafa5 | 2023-09-01 14:40:21 +0100 | [diff] [blame] | 5242 | make CC=gcc CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-zeroize-memset.h\"' -DMBEDTLS_TEST_DEFINES_ZEROIZE -Werror -Wsizeof-pointer-memaccess" |
Tom Cosgrove | daddf11 | 2023-09-01 10:40:15 +0100 | [diff] [blame] | 5243 | } |
| 5244 | |
| 5245 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5246 | component_test_zeroize () { |
| 5247 | # Test that the function mbedtls_platform_zeroize() is not optimized away by |
| 5248 | # different combinations of compilers and optimization flags by using an |
| 5249 | # auxiliary GDB script. Unfortunately, GDB does not return error values to the |
| 5250 | # system in all cases that the script fails, so we must manually search the |
| 5251 | # output to check whether the pass string is present and no failure strings |
| 5252 | # were printed. |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 5253 | |
Gilles Peskine | 4976e82 | 2019-01-06 19:52:22 +0000 | [diff] [blame] | 5254 | # Don't try to disable ASLR. We don't care about ASLR here. We do care |
| 5255 | # about a spurious message if Gdb tries and fails, so suppress that. |
| 5256 | gdb_disable_aslr= |
| 5257 | if [ -z "$(gdb -batch -nw -ex 'set disable-randomization off' 2>&1)" ]; then |
| 5258 | gdb_disable_aslr='set disable-randomization off' |
| 5259 | fi |
| 5260 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5261 | for optimization_flag in -O2 -O3 -Ofast -Os; do |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 5262 | for compiler in clang gcc; do |
| 5263 | msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()" |
| 5264 | make programs CC="$compiler" DEBUG=1 CFLAGS="$optimization_flag" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5265 | gdb -ex "$gdb_disable_aslr" -x tests/scripts/test_zeroize.gdb -nw -batch -nx 2>&1 | tee test_zeroize.log |
| 5266 | grep "The buffer was correctly zeroized" test_zeroize.log |
| 5267 | not grep -i "error" test_zeroize.log |
Gilles Peskine | 55f7c94 | 2019-01-09 22:28:21 +0100 | [diff] [blame] | 5268 | rm -f test_zeroize.log |
| 5269 | make clean |
| 5270 | done |
Andres Amaya Garcia | 2967381 | 2017-10-25 10:35:51 +0100 | [diff] [blame] | 5271 | done |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5272 | } |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 5273 | |
Bence Szépkúti | 80b31c5 | 2021-10-19 15:05:36 +0200 | [diff] [blame] | 5274 | component_test_psa_compliance () { |
| 5275 | msg "build: make, default config (out-of-box), libmbedcrypto.a only" |
Bence Szépkúti | ca9236b | 2021-10-25 19:29:07 +0200 | [diff] [blame] | 5276 | make -C library libmbedcrypto.a |
Bence Szépkúti | 80b31c5 | 2021-10-19 15:05:36 +0200 | [diff] [blame] | 5277 | |
| 5278 | msg "unit test: test_psa_compliance.py" |
| 5279 | ./tests/scripts/test_psa_compliance.py |
| 5280 | } |
| 5281 | |
| 5282 | support_test_psa_compliance () { |
Bence Szépkúti | ef0d02e | 2021-11-03 11:36:09 +0100 | [diff] [blame] | 5283 | # psa-compliance-tests only supports CMake >= 3.10.0 |
Bence Szépkúti | ca9236b | 2021-10-25 19:29:07 +0200 | [diff] [blame] | 5284 | ver="$(cmake --version)" |
| 5285 | ver="${ver#cmake version }" |
| 5286 | ver_major="${ver%%.*}" |
| 5287 | |
| 5288 | ver="${ver#*.}" |
| 5289 | ver_minor="${ver%%.*}" |
| 5290 | |
| 5291 | [ "$ver_major" -eq 3 ] && [ "$ver_minor" -ge 10 ] |
Bence Szépkúti | 80b31c5 | 2021-10-19 15:05:36 +0200 | [diff] [blame] | 5292 | } |
| 5293 | |
Gilles Peskine | c848d22 | 2022-12-09 12:23:35 +0100 | [diff] [blame] | 5294 | component_check_code_style () { |
| 5295 | msg "Check C code style" |
| 5296 | ./scripts/code_style.py |
David Horstmann | 92b5ac1 | 2022-11-10 18:30:52 +0000 | [diff] [blame] | 5297 | } |
| 5298 | |
Gilles Peskine | c848d22 | 2022-12-09 12:23:35 +0100 | [diff] [blame] | 5299 | support_check_code_style() { |
David Horstmann | 92b5ac1 | 2022-11-10 18:30:52 +0000 | [diff] [blame] | 5300 | case $(uncrustify --version) in |
| 5301 | *0.75.1*) true;; |
| 5302 | *) false;; |
| 5303 | esac |
| 5304 | } |
| 5305 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5306 | component_check_python_files () { |
| 5307 | msg "Lint: Python scripts" |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5308 | tests/scripts/check-python-files.sh |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5309 | } |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 5310 | |
Joe Subbiani | d614c0b | 2021-07-29 11:18:29 +0100 | [diff] [blame] | 5311 | component_check_test_helpers () { |
| 5312 | msg "unit test: generate_test_code.py" |
Manuel Pégourié-Gonnard | dfb114a | 2020-06-02 11:40:08 +0200 | [diff] [blame] | 5313 | # unittest writes out mundane stuff like number or tests run on stderr. |
| 5314 | # Our convention is to reserve stderr for actual errors, and write |
| 5315 | # harmless info on stdout so it can be suppress with --quiet. |
Gilles Peskine | 1f0cdaf | 2021-07-08 18:41:16 +0200 | [diff] [blame] | 5316 | ./tests/scripts/test_generate_test_code.py 2>&1 |
Joe Subbiani | d614c0b | 2021-07-29 11:18:29 +0100 | [diff] [blame] | 5317 | |
Joe Subbiani | a25ffab | 2021-08-06 09:41:27 +0100 | [diff] [blame] | 5318 | msg "unit test: translate_ciphers.py" |
| 5319 | python3 -m unittest tests/scripts/translate_ciphers.py 2>&1 |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5320 | } |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 5321 | |
Jerry Yu | d767cc4 | 2023-03-31 15:03:55 +0800 | [diff] [blame] | 5322 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 5323 | ################################################################ |
| 5324 | #### Termination |
| 5325 | ################################################################ |
| 5326 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5327 | post_report () { |
| 5328 | msg "Done, cleaning up" |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 5329 | final_cleanup |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 5330 | |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5331 | final_report |
| 5332 | } |
| 5333 | |
| 5334 | |
| 5335 | |
| 5336 | ################################################################ |
| 5337 | #### Run all the things |
| 5338 | ################################################################ |
| 5339 | |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5340 | # Function invoked by --error-test to test error reporting. |
| 5341 | pseudo_component_error_test () { |
Gilles Peskine | 88a7c2b | 2021-08-02 23:28:00 +0200 | [diff] [blame] | 5342 | msg "Testing error reporting $error_test_i" |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5343 | if [ $KEEP_GOING -ne 0 ]; then |
| 5344 | echo "Expect three failing commands." |
| 5345 | fi |
Gilles Peskine | 88a7c2b | 2021-08-02 23:28:00 +0200 | [diff] [blame] | 5346 | # If the component doesn't run in a subshell, changing error_test_i to an |
| 5347 | # invalid integer will cause an error in the loop that runs this function. |
| 5348 | error_test_i=this_should_not_be_used_since_the_component_runs_in_a_subshell |
Gilles Peskine | ec13554 | 2021-08-02 23:14:03 +0200 | [diff] [blame] | 5349 | # Expected error: 'grep non_existent /dev/null -> 1' |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5350 | grep non_existent /dev/null |
Gilles Peskine | ec13554 | 2021-08-02 23:14:03 +0200 | [diff] [blame] | 5351 | # Expected error: '! grep -q . tests/scripts/all.sh -> 1' |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5352 | not grep -q . "$0" |
Gilles Peskine | ec13554 | 2021-08-02 23:14:03 +0200 | [diff] [blame] | 5353 | # Expected error: 'make unknown_target -> 2' |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5354 | make unknown_target |
| 5355 | false "this should not be executed" |
| 5356 | } |
| 5357 | |
Gilles Peskine | e48351a | 2018-11-27 16:06:30 +0100 | [diff] [blame] | 5358 | # Run one component and clean up afterwards. |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5359 | run_component () { |
Gilles Peskine | ffcdeff | 2018-12-04 12:49:28 +0100 | [diff] [blame] | 5360 | current_component="$1" |
Gilles Peskine | 9004a17 | 2019-09-16 15:20:36 +0200 | [diff] [blame] | 5361 | export MBEDTLS_TEST_CONFIGURATION="$current_component" |
Gilles Peskine | 2ef377d | 2019-10-07 18:44:21 +0200 | [diff] [blame] | 5362 | |
| 5363 | # Unconditionally create a seedfile that's sufficiently long. |
| 5364 | # Do this before each component, because a previous component may |
| 5365 | # have messed it up or shortened it. |
Gilles Peskine | 88a0745 | 2021-07-08 19:03:50 +0200 | [diff] [blame] | 5366 | local dd_cmd |
| 5367 | dd_cmd=(dd if=/dev/urandom of=./tests/seedfile bs=64 count=1) |
| 5368 | case $OSTYPE in |
Tom Cosgrove | 226aca1 | 2022-03-16 14:11:07 +0000 | [diff] [blame] | 5369 | linux*|freebsd*|openbsd*) dd_cmd+=(status=none) |
Gilles Peskine | 88a0745 | 2021-07-08 19:03:50 +0200 | [diff] [blame] | 5370 | esac |
| 5371 | "${dd_cmd[@]}" |
Gilles Peskine | 2ef377d | 2019-10-07 18:44:21 +0200 | [diff] [blame] | 5372 | |
Gilles Peskine | ec13554 | 2021-08-02 23:14:03 +0200 | [diff] [blame] | 5373 | # Run the component in a subshell, with error trapping and output |
| 5374 | # redirection set up based on the relevant options. |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 5375 | if [ $KEEP_GOING -eq 1 ]; then |
Gilles Peskine | ec13554 | 2021-08-02 23:14:03 +0200 | [diff] [blame] | 5376 | # We want to keep running if the subshell fails, so 'set -e' must |
| 5377 | # be off when the subshell runs. |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 5378 | set +e |
Manuel Pégourié-Gonnard | 2b2bdaa | 2020-06-02 11:28:07 +0200 | [diff] [blame] | 5379 | fi |
Gilles Peskine | ce266c4 | 2020-03-28 18:50:43 +0100 | [diff] [blame] | 5380 | ( |
| 5381 | if [ $QUIET -eq 1 ]; then |
| 5382 | # msg() will be silenced, so just print the component name here. |
| 5383 | echo "${current_component#component_}" |
| 5384 | exec >/dev/null |
| 5385 | fi |
| 5386 | if [ $KEEP_GOING -eq 1 ]; then |
| 5387 | # Keep "set -e" off, and run an ERR trap instead to record failures. |
| 5388 | set -E |
| 5389 | trap err_trap ERR |
| 5390 | fi |
| 5391 | # The next line is what runs the component |
| 5392 | "$@" |
| 5393 | if [ $KEEP_GOING -eq 1 ]; then |
| 5394 | trap - ERR |
| 5395 | exit $last_failure_status |
| 5396 | fi |
| 5397 | ) |
| 5398 | component_status=$? |
| 5399 | if [ $KEEP_GOING -eq 1 ]; then |
| 5400 | set -e |
| 5401 | if [ $component_status -ne 0 ]; then |
| 5402 | failure_count=$((failure_count + 1)) |
| 5403 | fi |
| 5404 | fi |
Gilles Peskine | 2ef377d | 2019-10-07 18:44:21 +0200 | [diff] [blame] | 5405 | |
| 5406 | # Restore the build tree to a clean state. |
Gilles Peskine | e48351a | 2018-11-27 16:06:30 +0100 | [diff] [blame] | 5407 | cleanup |
Manuel Pégourié-Gonnard | 304b099 | 2020-06-08 10:59:41 +0200 | [diff] [blame] | 5408 | unset current_component |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5409 | } |
| 5410 | |
| 5411 | # Preliminary setup |
| 5412 | pre_check_environment |
Tom Cosgrove | 730addc | 2023-06-09 14:20:18 +0100 | [diff] [blame] | 5413 | pre_parse_command_line_for_dirs "$@" |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5414 | pre_initialize_variables |
| 5415 | pre_parse_command_line "$@" |
Gilles Peskine | 348fb9a | 2018-11-27 17:04:29 +0100 | [diff] [blame] | 5416 | |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 5417 | pre_check_git |
Gilles Peskine | 568f53a | 2021-07-12 18:16:01 +0200 | [diff] [blame] | 5418 | pre_restore_files |
Gilles Peskine | f83eb82 | 2020-03-30 20:11:39 +0200 | [diff] [blame] | 5419 | pre_back_up |
Andrzej Kurek | eb50871 | 2019-02-14 07:18:59 -0500 | [diff] [blame] | 5420 | |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 5421 | build_status=0 |
| 5422 | if [ $KEEP_GOING -eq 1 ]; then |
| 5423 | pre_setup_keep_going |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5424 | fi |
Gilles Peskine | 67ffdaf | 2019-09-16 15:55:46 +0200 | [diff] [blame] | 5425 | pre_prepare_outcome_file |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 5426 | pre_print_configuration |
| 5427 | pre_check_tools |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 5428 | cleanup |
David Horstmann | 76a7738 | 2023-08-17 17:32:26 +0100 | [diff] [blame] | 5429 | if in_mbedtls_repo; then |
David Horstmann | 9a6c45b | 2023-07-14 12:30:00 +0100 | [diff] [blame] | 5430 | pre_generate_files |
| 5431 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 5432 | |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 5433 | # Run the requested tests. |
Gilles Peskine | 88a7c2b | 2021-08-02 23:28:00 +0200 | [diff] [blame] | 5434 | for ((error_test_i=1; error_test_i <= error_test; error_test_i++)); do |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5435 | run_component pseudo_component_error_test |
Gilles Peskine | 5d99682 | 2020-03-28 21:09:21 +0100 | [diff] [blame] | 5436 | done |
Gilles Peskine | 88a7c2b | 2021-08-02 23:28:00 +0200 | [diff] [blame] | 5437 | unset error_test_i |
Gilles Peskine | beb3a81 | 2019-01-06 22:11:25 +0000 | [diff] [blame] | 5438 | for component in $RUN_COMPONENTS; do |
| 5439 | run_component "component_$component" |
| 5440 | done |
Gilles Peskine | 8f07312 | 2018-11-27 15:58:47 +0100 | [diff] [blame] | 5441 | |
| 5442 | # We're done. |
Gilles Peskine | 878cf60 | 2019-01-06 20:50:38 +0000 | [diff] [blame] | 5443 | post_report |