Minos Galanakis | 7771119 | 2024-07-25 14:24:37 +0100 | [diff] [blame] | 1 | # components.sh |
| 2 | # |
| 3 | # Copyright The Mbed TLS Contributors |
| 4 | # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 5 | |
| 6 | # This file contains the test components that are executed by all.sh |
| 7 | |
| 8 | # The functions below are named as follows: |
| 9 | # * component_XXX: independent components. They can be run in any order. |
| 10 | # * component_check_XXX: quick tests that aren't worth parallelizing. |
| 11 | # * component_build_XXX: build things but don't run them. |
| 12 | # * component_test_XXX: build and test. |
| 13 | # * component_release_XXX: tests that the CI should skip during PR testing. |
| 14 | # * support_XXX: if support_XXX exists and returns false then |
| 15 | # component_XXX is not run by default. |
| 16 | |
| 17 | # Each component must start by invoking `msg` with a short informative message. |
| 18 | # |
| 19 | # Warning: due to the way bash detects errors, the failure of a command |
| 20 | # inside 'if' or '!' is not detected. Use the 'not' function instead of '!'. |
| 21 | # |
| 22 | # Each component is executed in a separate shell process. The component |
| 23 | # fails if any command in it returns a non-zero status. |
| 24 | # |
| 25 | # The framework in all.sh performs some cleanup tasks after each component. |
| 26 | # This means that components can assume that the working directory is in a |
| 27 | # cleaned-up state, and don't need to perform the cleanup themselves. |
| 28 | # * Run `make clean`. |
| 29 | # * Restore `include/mbedtls/mbedtls_config.h` from a backup made before running |
| 30 | # the component. |
| 31 | # * Check out `Makefile`, `library/Makefile`, `programs/Makefile`, |
| 32 | # `tests/Makefile` and `programs/fuzz/Makefile` from git. |
| 33 | # This cleans up after an in-tree use of CMake. |
| 34 | # |
| 35 | # The tests are roughly in order from fastest to slowest. This doesn't |
| 36 | # have to be exact, but in general you should add slower tests towards |
| 37 | # the end and fast checks near the beginning. |
| 38 | |
| 39 | |
| 40 | ################################################################ |
| 41 | #### Build and test many configurations and targets |
| 42 | ################################################################ |
Minos Galanakis | f7d1cb0 | 2024-07-30 17:25:31 +0100 | [diff] [blame] | 43 | |
| 44 | ################################################################ |
| 45 | #### Basic checks |
| 46 | ################################################################ |
| 47 | |
| 48 | # |
| 49 | # Test Suites to be executed |
| 50 | # |
| 51 | # The test ordering tries to optimize for the following criteria: |
| 52 | # 1. Catch possible problems early, by running first tests that run quickly |
| 53 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 54 | # time, so start with a GCC build). |
| 55 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 56 | # |
| 57 | # Indicative running times are given for reference. |
| 58 | |
Minos Galanakis | f7d1cb0 | 2024-07-30 17:25:31 +0100 | [diff] [blame] | 59 | ################################################################ |
| 60 | #### Build and test many configurations and targets |
| 61 | ################################################################ |
| 62 | |
Minos Galanakis | f7d1cb0 | 2024-07-30 17:25:31 +0100 | [diff] [blame] | 63 | component_test_psa_crypto_config_accel_hash_keep_builtins () { |
| 64 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated+builtin hash" |
| 65 | # This component ensures that all the test cases for |
| 66 | # md_psa_dynamic_dispatch with legacy+driver in test_suite_md are run. |
| 67 | |
| 68 | loc_accel_list="ALG_MD5 ALG_RIPEMD160 ALG_SHA_1 \ |
| 69 | ALG_SHA_224 ALG_SHA_256 ALG_SHA_384 ALG_SHA_512 \ |
| 70 | ALG_SHA3_224 ALG_SHA3_256 ALG_SHA3_384 ALG_SHA3_512" |
| 71 | |
| 72 | # Start from default config (no USE_PSA) |
| 73 | helper_libtestdriver1_adjust_config "default" |
| 74 | |
| 75 | helper_libtestdriver1_make_drivers "$loc_accel_list" |
| 76 | |
| 77 | helper_libtestdriver1_make_main "$loc_accel_list" |
| 78 | |
| 79 | msg "test: MBEDTLS_PSA_CRYPTO_CONFIG with accelerated+builtin hash" |
| 80 | make test |
| 81 | } |
| 82 | |
Minos Galanakis | f7d1cb0 | 2024-07-30 17:25:31 +0100 | [diff] [blame] | 83 | # This should be renamed to test and updated once the accelerator ECDH code is in place and ready to test. |
| 84 | component_build_psa_accel_alg_ecdh () { |
| 85 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_ECDH without MBEDTLS_ECDH_C" |
| 86 | scripts/config.py full |
| 87 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 88 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 89 | scripts/config.py unset MBEDTLS_ECDH_C |
| 90 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED |
| 91 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED |
| 92 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 93 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 94 | scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED |
| 95 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 96 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_ECDH -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 97 | } |
| 98 | |
| 99 | # This should be renamed to test and updated once the accelerator HMAC code is in place and ready to test. |
| 100 | component_build_psa_accel_alg_hmac () { |
| 101 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_HMAC" |
| 102 | scripts/config.py full |
| 103 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 104 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 105 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 106 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HMAC -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 107 | } |
| 108 | |
| 109 | # This should be renamed to test and updated once the accelerator HKDF code is in place and ready to test. |
| 110 | component_build_psa_accel_alg_hkdf () { |
| 111 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_HKDF without MBEDTLS_HKDF_C" |
| 112 | scripts/config.py full |
| 113 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 114 | scripts/config.py unset MBEDTLS_HKDF_C |
| 115 | # Make sure to unset TLS1_3 since it requires HKDF_C and will not build properly without it. |
| 116 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 117 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 118 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HKDF -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 119 | } |
| 120 | |
| 121 | # This should be renamed to test and updated once the accelerator MD5 code is in place and ready to test. |
| 122 | component_build_psa_accel_alg_md5 () { |
| 123 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_MD5 - other hashes" |
| 124 | scripts/config.py full |
| 125 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 126 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 127 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 128 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 129 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 130 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 131 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 132 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 133 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
| 134 | scripts/config.py unset MBEDTLS_LMS_C |
| 135 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
| 136 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 137 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_MD5 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 138 | } |
| 139 | |
| 140 | # This should be renamed to test and updated once the accelerator RIPEMD160 code is in place and ready to test. |
| 141 | component_build_psa_accel_alg_ripemd160 () { |
| 142 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RIPEMD160 - other hashes" |
| 143 | scripts/config.py full |
| 144 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 145 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 146 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 147 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 148 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 149 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 150 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 151 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 152 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
| 153 | scripts/config.py unset MBEDTLS_LMS_C |
| 154 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
| 155 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 156 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RIPEMD160 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 157 | } |
| 158 | |
| 159 | # This should be renamed to test and updated once the accelerator SHA1 code is in place and ready to test. |
| 160 | component_build_psa_accel_alg_sha1 () { |
| 161 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_1 - other hashes" |
| 162 | scripts/config.py full |
| 163 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 164 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 165 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 166 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 167 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 168 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 169 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 170 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 171 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
| 172 | scripts/config.py unset MBEDTLS_LMS_C |
| 173 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
| 174 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 175 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_1 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 176 | } |
| 177 | |
| 178 | # This should be renamed to test and updated once the accelerator SHA224 code is in place and ready to test. |
| 179 | component_build_psa_accel_alg_sha224 () { |
| 180 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_224 - other hashes" |
| 181 | scripts/config.py full |
| 182 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 183 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 184 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 185 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 186 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 187 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 188 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 189 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
| 190 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 191 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_224 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 192 | } |
| 193 | |
| 194 | # This should be renamed to test and updated once the accelerator SHA256 code is in place and ready to test. |
| 195 | component_build_psa_accel_alg_sha256 () { |
| 196 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_256 - other hashes" |
| 197 | scripts/config.py full |
| 198 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 199 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 200 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 201 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 202 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 203 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 204 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 205 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_512 |
| 206 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 207 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_256 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 208 | } |
| 209 | |
| 210 | # This should be renamed to test and updated once the accelerator SHA384 code is in place and ready to test. |
| 211 | component_build_psa_accel_alg_sha384 () { |
| 212 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_384 - other hashes" |
| 213 | scripts/config.py full |
| 214 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 215 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 216 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 217 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 218 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 219 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 220 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 221 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
| 222 | scripts/config.py unset MBEDTLS_LMS_C |
| 223 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
| 224 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 225 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_384 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 226 | } |
| 227 | |
| 228 | # This should be renamed to test and updated once the accelerator SHA512 code is in place and ready to test. |
| 229 | component_build_psa_accel_alg_sha512 () { |
| 230 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_SHA_512 - other hashes" |
| 231 | scripts/config.py full |
| 232 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 233 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 234 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_MD5 |
| 235 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RIPEMD160 |
| 236 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_1 |
| 237 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_224 |
| 238 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_256 |
| 239 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_SHA_384 |
| 240 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS |
| 241 | scripts/config.py unset MBEDTLS_LMS_C |
| 242 | scripts/config.py unset MBEDTLS_LMS_PRIVATE |
| 243 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 244 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_SHA_512 -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 245 | } |
| 246 | |
| 247 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
| 248 | component_build_psa_accel_alg_rsa_pkcs1v15_crypt () { |
| 249 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
| 250 | scripts/config.py full |
| 251 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 252 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 253 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1 |
| 254 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN |
| 255 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
| 256 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PSS |
| 257 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 258 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 259 | } |
| 260 | |
| 261 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
| 262 | component_build_psa_accel_alg_rsa_pkcs1v15_sign () { |
| 263 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_PKCS1V15_SIGN + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
| 264 | scripts/config.py full |
| 265 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 266 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 267 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1 |
| 268 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
| 269 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
| 270 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PSS |
| 271 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 272 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 273 | } |
| 274 | |
| 275 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
| 276 | component_build_psa_accel_alg_rsa_oaep () { |
| 277 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_OAEP + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
| 278 | scripts/config.py full |
| 279 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 280 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 281 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_OAEP 1 |
| 282 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
| 283 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN |
| 284 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PSS |
| 285 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 286 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_OAEP -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 287 | } |
| 288 | |
| 289 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
| 290 | component_build_psa_accel_alg_rsa_pss () { |
| 291 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_ALG_RSA_PSS + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY" |
| 292 | scripts/config.py full |
| 293 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 294 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 295 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PSS 1 |
| 296 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT |
| 297 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN |
| 298 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_RSA_OAEP |
| 299 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 300 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_RSA_PSS -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 301 | } |
| 302 | |
| 303 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
| 304 | component_build_psa_accel_key_type_rsa_key_pair () { |
| 305 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_xxx + PSA_WANT_ALG_RSA_PSS" |
| 306 | scripts/config.py full |
| 307 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 308 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 309 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PSS 1 |
| 310 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1 |
| 311 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1 |
| 312 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1 |
| 313 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1 |
| 314 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 315 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 316 | } |
| 317 | |
| 318 | # This should be renamed to test and updated once the accelerator RSA code is in place and ready to test. |
| 319 | component_build_psa_accel_key_type_rsa_public_key () { |
| 320 | msg "build: full - MBEDTLS_USE_PSA_CRYPTO + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + PSA_WANT_ALG_RSA_PSS" |
| 321 | scripts/config.py full |
| 322 | scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO |
| 323 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 324 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_ALG_RSA_PSS 1 |
| 325 | scripts/config.py -f "$CRYPTO_CONFIG_H" set PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1 |
| 326 | # Need to define the correct symbol and include the test driver header path in order to build with the test driver |
| 327 | make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY -I../tests/include" LDFLAGS="$ASAN_CFLAGS" |
| 328 | } |
| 329 | |
Minos Galanakis | f7d1cb0 | 2024-07-30 17:25:31 +0100 | [diff] [blame] | 330 | # For timebeing, no VIA Padlock platform available. |
| 331 | component_build_aes_via_padlock () { |
| 332 | |
| 333 | msg "AES:VIA PadLock, build with default configuration." |
| 334 | scripts/config.py unset MBEDTLS_AESNI_C |
| 335 | scripts/config.py set MBEDTLS_PADLOCK_C |
| 336 | scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY |
| 337 | make CC=gcc CFLAGS="$ASAN_CFLAGS -m32" LDFLAGS="-m32 $ASAN_CFLAGS" |
| 338 | grep -q mbedtls_padlock_has_support ./programs/test/selftest |
| 339 | |
| 340 | } |
| 341 | |
| 342 | support_build_aes_via_padlock_only () { |
| 343 | ( [ "$MBEDTLS_TEST_PLATFORM" == "Linux-x86_64" ] || \ |
| 344 | [ "$MBEDTLS_TEST_PLATFORM" == "Linux-amd64" ] ) && \ |
| 345 | [ "`dpkg --print-foreign-architectures`" == "i386" ] |
| 346 | } |
| 347 | |