Minos Galanakis | 6aab5b7 | 2024-07-25 14:24:37 +0100 | [diff] [blame] | 1 | # components-configuration-tls.sh |
| 2 | # |
| 3 | # Copyright The Mbed TLS Contributors |
| 4 | # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 5 | |
Minos Galanakis | 609f749 | 2024-07-31 16:39:28 +0100 | [diff] [blame] | 6 | # This file contains test components that are executed by all.sh |
Minos Galanakis | 6aab5b7 | 2024-07-25 14:24:37 +0100 | [diff] [blame] | 7 | |
| 8 | ################################################################ |
| 9 | #### Configuration Testing - TLS |
| 10 | ################################################################ |
| 11 | |
Gilles Peskine | b6d4913 | 2024-09-14 11:21:29 +0200 | [diff] [blame] | 12 | component_test_config_suite_b_legacy () { |
| 13 | msg "build: configs/config-suite-b.h" |
| 14 | cp configs/config-suite-b.h "$CONFIG_H" |
| 15 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 16 | # want to re-generate generated files that depend on it, quite correctly. |
| 17 | # However this doesn't work as the generation script expects a specific |
| 18 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 19 | # cmake can't know this, but re-generation is actually not necessary as |
| 20 | # the generated files only depend on the list of available options, not |
| 21 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 22 | # dependency resolution for generated files and just rely on them being |
| 23 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 24 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 25 | make |
| 26 | |
| 27 | msg "test: configs/config-suite-b.h - unit tests" |
| 28 | make test |
| 29 | |
| 30 | msg "test: configs/config-suite-b.h - compat.sh" |
| 31 | tests/compat.sh -m tls12 -f 'ECDHE_ECDSA.*AES.*GCM' -p mbedTLS |
| 32 | |
| 33 | msg "build: configs/config-suite-b.h + DEBUG" |
| 34 | MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG" |
| 35 | make clean |
| 36 | scripts/config.py set MBEDTLS_DEBUG_C |
| 37 | scripts/config.py set MBEDTLS_ERROR_C |
| 38 | make ssl-opt |
| 39 | |
| 40 | msg "test: configs/config-suite-b.h + DEBUG - ssl-opt.sh" |
| 41 | tests/ssl-opt.sh |
| 42 | } |
| 43 | |
| 44 | component_test_config_suite_b_psa () { |
| 45 | msg "build: configs/config-suite-b.h + USE_PSA_CRYPTO" |
| 46 | cp configs/config-suite-b.h "$CONFIG_H" |
| 47 | scripts/config.py set MBEDTLS_PSA_CRYPTO_C |
| 48 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 49 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 50 | # want to re-generate generated files that depend on it, quite correctly. |
| 51 | # However this doesn't work as the generation script expects a specific |
| 52 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 53 | # cmake can't know this, but re-generation is actually not necessary as |
| 54 | # the generated files only depend on the list of available options, not |
| 55 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 56 | # dependency resolution for generated files and just rely on them being |
| 57 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 58 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 59 | make |
| 60 | |
| 61 | msg "test: configs/config-suite-b.h + USE_PSA_CRYPTO - unit tests" |
| 62 | make test |
| 63 | |
| 64 | msg "test: configs/config-suite-b.h + USE_PSA_CRYPTO - compat.sh" |
| 65 | tests/compat.sh -m tls12 -f 'ECDHE_ECDSA.*AES.*GCM' -p mbedTLS |
| 66 | |
| 67 | msg "build: configs/config-suite-b.h + USE_PSA_CRYPTO + DEBUG" |
| 68 | MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG" |
| 69 | make clean |
| 70 | scripts/config.py set MBEDTLS_DEBUG_C |
| 71 | scripts/config.py set MBEDTLS_ERROR_C |
| 72 | make ssl-opt |
| 73 | |
| 74 | msg "test: configs/config-suite-b.h + USE_PSA_CRYPTO + DEBUG - ssl-opt.sh" |
| 75 | tests/ssl-opt.sh |
| 76 | } |
| 77 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 78 | component_test_no_renegotiation () { |
| 79 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
| 80 | scripts/config.py unset MBEDTLS_SSL_RENEGOTIATION |
| 81 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 82 | make |
| 83 | |
| 84 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 85 | make test |
| 86 | |
| 87 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
| 88 | tests/ssl-opt.sh |
| 89 | } |
| 90 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 91 | component_test_tls1_2_default_stream_cipher_only () { |
| 92 | msg "build: default with only stream cipher use psa" |
| 93 | |
| 94 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 95 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 96 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
| 97 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CCM |
| 98 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CCM_STAR_NO_TAG |
| 99 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_GCM |
| 100 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CHACHA20_POLY1305 |
| 101 | # Note: The three unsets below are to be removed for Mbed TLS 4.0 |
| 102 | scripts/config.py unset MBEDTLS_GCM_C |
| 103 | scripts/config.py unset MBEDTLS_CCM_C |
| 104 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
| 105 | #Disable TLS 1.3 (as no AEAD) |
| 106 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 107 | # Disable CBC. Note: When implemented, PSA_WANT_ALG_CBC_MAC will also need to be unset here to fully disable CBC |
| 108 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CBC_NO_PADDING |
| 109 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CBC_PKCS7 |
| 110 | # Disable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 111 | # Note: The unset below is to be removed for 4.0 |
| 112 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC |
| 113 | # Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
| 114 | scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 115 | # Enable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
| 116 | scripts/config.py set MBEDTLS_CIPHER_NULL_CIPHER |
| 117 | # Modules that depend on AEAD |
| 118 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| 119 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
| 120 | |
| 121 | make |
| 122 | |
| 123 | msg "test: default with only stream cipher use psa" |
| 124 | make test |
| 125 | |
| 126 | # Not running ssl-opt.sh because most tests require a non-NULL ciphersuite. |
| 127 | } |
| 128 | |
| 129 | component_test_tls1_2_default_cbc_legacy_cipher_only () { |
| 130 | msg "build: default with only CBC-legacy cipher use psa" |
| 131 | |
| 132 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 133 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 134 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
| 135 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CCM |
| 136 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CCM_STAR_NO_TAG |
| 137 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_GCM |
| 138 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CHACHA20_POLY1305 |
| 139 | # Note: The three unsets below are to be removed for Mbed TLS 4.0 |
| 140 | scripts/config.py unset MBEDTLS_GCM_C |
| 141 | scripts/config.py unset MBEDTLS_CCM_C |
| 142 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
| 143 | #Disable TLS 1.3 (as no AEAD) |
| 144 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 145 | # Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 146 | scripts/config.py -f $CRYPTO_CONFIG_H set PSA_WANT_ALG_CBC_NO_PADDING |
| 147 | # Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
| 148 | scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 149 | # Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
| 150 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
| 151 | # Modules that depend on AEAD |
| 152 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| 153 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
| 154 | |
| 155 | make |
| 156 | |
| 157 | msg "test: default with only CBC-legacy cipher use psa" |
| 158 | make test |
| 159 | |
| 160 | msg "test: default with only CBC-legacy cipher use psa - ssl-opt.sh (subset)" |
| 161 | tests/ssl-opt.sh -f "TLS 1.2" |
| 162 | } |
| 163 | |
| 164 | component_test_tls1_2_default_cbc_legacy_cbc_etm_cipher_only () { |
| 165 | msg "build: default with only CBC-legacy and CBC-EtM ciphers use psa" |
| 166 | |
| 167 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 168 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 169 | # Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C) |
| 170 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CCM |
| 171 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CCM_STAR_NO_TAG |
| 172 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_GCM |
| 173 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_CHACHA20_POLY1305 |
| 174 | # Note: The three unsets below are to be removed for Mbed TLS 4.0 |
| 175 | scripts/config.py unset MBEDTLS_GCM_C |
| 176 | scripts/config.py unset MBEDTLS_CCM_C |
| 177 | scripts/config.py unset MBEDTLS_CHACHAPOLY_C |
| 178 | #Disable TLS 1.3 (as no AEAD) |
| 179 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 180 | # Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES)) |
| 181 | scripts/config.py -f $CRYPTO_CONFIG_H set PSA_WANT_ALG_CBC_NO_PADDING |
| 182 | # Enable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC) |
| 183 | scripts/config.py set MBEDTLS_SSL_ENCRYPT_THEN_MAC |
| 184 | # Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER)) |
| 185 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
| 186 | # Modules that depend on AEAD |
| 187 | scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION |
| 188 | scripts/config.py unset MBEDTLS_SSL_TICKET_C |
| 189 | |
| 190 | make |
| 191 | |
| 192 | msg "test: default with only CBC-legacy and CBC-EtM ciphers use psa" |
| 193 | make test |
| 194 | |
| 195 | msg "test: default with only CBC-legacy and CBC-EtM ciphers use psa - ssl-opt.sh (subset)" |
| 196 | tests/ssl-opt.sh -f "TLS 1.2" |
| 197 | } |
| 198 | |
Gilles Peskine | 86ceb13 | 2024-09-14 11:24:07 +0200 | [diff] [blame^] | 199 | component_test_config_thread_legacy () { |
| 200 | msg "build: configs/config-thread.h" |
| 201 | cp configs/config-thread.h "$CONFIG_H" |
| 202 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 203 | # want to re-generate generated files that depend on it, quite correctly. |
| 204 | # However this doesn't work as the generation script expects a specific |
| 205 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 206 | # cmake can't know this, but re-generation is actually not necessary as |
| 207 | # the generated files only depend on the list of available options, not |
| 208 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 209 | # dependency resolution for generated files and just rely on them being |
| 210 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 211 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 212 | make |
| 213 | |
| 214 | msg "test: configs/config-thread.h - unit tests" |
| 215 | make test |
| 216 | |
| 217 | msg "test: configs/config-thread.h - ssl-opt.sh" |
| 218 | tests/ssl-opt.sh -f 'ECJPAKE.*nolog' |
| 219 | } |
| 220 | |
| 221 | component_test_config_thread_psa () { |
| 222 | msg "build: configs/config-thread.h + USE_PSA_CRYPTO" |
| 223 | cp configs/config-thread.h "$CONFIG_H" |
| 224 | scripts/config.py set MBEDTLS_PSA_CRYPTO_C |
| 225 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 226 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 227 | # want to re-generate generated files that depend on it, quite correctly. |
| 228 | # However this doesn't work as the generation script expects a specific |
| 229 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 230 | # cmake can't know this, but re-generation is actually not necessary as |
| 231 | # the generated files only depend on the list of available options, not |
| 232 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 233 | # dependency resolution for generated files and just rely on them being |
| 234 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 235 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 236 | make |
| 237 | |
| 238 | msg "test: configs/config-thread.h + USE_PSA_CRYPTO - unit tests" |
| 239 | make test |
| 240 | |
| 241 | msg "test: configs/config-thread.h + USE_PSA_CRYPTO - ssl-opt.sh" |
| 242 | tests/ssl-opt.sh -f 'ECJPAKE.*nolog' |
| 243 | } |
| 244 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 245 | # We're not aware of any other (open source) implementation of EC J-PAKE in TLS |
| 246 | # that we could use for interop testing. However, we now have sort of two |
| 247 | # implementations ourselves: one using PSA, the other not. At least test that |
| 248 | # these two interoperate with each other. |
Minos Galanakis | f78447f | 2024-07-26 20:49:51 +0100 | [diff] [blame] | 249 | component_test_tls1_2_ecjpake_compatibility () { |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 250 | msg "build: TLS1.2 server+client w/ EC-JPAKE w/o USE_PSA" |
| 251 | scripts/config.py set MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED |
| 252 | # Explicitly make lib first to avoid a race condition: |
| 253 | # https://github.com/Mbed-TLS/mbedtls/issues/8229 |
| 254 | make lib |
| 255 | make -C programs ssl/ssl_server2 ssl/ssl_client2 |
| 256 | cp programs/ssl/ssl_server2 s2_no_use_psa |
| 257 | cp programs/ssl/ssl_client2 c2_no_use_psa |
| 258 | |
| 259 | msg "build: TLS1.2 server+client w/ EC-JPAKE w/ USE_PSA" |
| 260 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 261 | make clean |
| 262 | make lib |
| 263 | make -C programs ssl/ssl_server2 ssl/ssl_client2 |
| 264 | make -C programs test/udp_proxy test/query_compile_time_config |
| 265 | |
| 266 | msg "test: server w/o USE_PSA - client w/ USE_PSA, text password" |
| 267 | P_SRV=../s2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: working, TLS" |
| 268 | msg "test: server w/o USE_PSA - client w/ USE_PSA, opaque password" |
| 269 | P_SRV=../s2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: opaque password client only, working, TLS" |
| 270 | msg "test: client w/o USE_PSA - server w/ USE_PSA, text password" |
| 271 | P_CLI=../c2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: working, TLS" |
| 272 | msg "test: client w/o USE_PSA - server w/ USE_PSA, opaque password" |
| 273 | P_CLI=../c2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: opaque password server only, working, TLS" |
| 274 | |
| 275 | rm s2_no_use_psa c2_no_use_psa |
| 276 | } |
| 277 | |
Gilles Peskine | 063fb8c | 2024-09-14 11:10:05 +0200 | [diff] [blame] | 278 | component_test_tls1_2_ccm_psk_legacy () { |
| 279 | msg "build: configs/config-ccm-psk-tls1_2.h" |
| 280 | cp configs/config-ccm-psk-tls1_2.h "$CONFIG_H" |
| 281 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 282 | # want to re-generate generated files that depend on it, quite correctly. |
| 283 | # However this doesn't work as the generation script expects a specific |
| 284 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 285 | # cmake can't know this, but re-generation is actually not necessary as |
| 286 | # the generated files only depend on the list of available options, not |
| 287 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 288 | # dependency resolution for generated files and just rely on them being |
| 289 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 290 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 291 | make |
| 292 | |
| 293 | msg "test: configs/config-ccm-psk-tls1_2.h - unit tests" |
| 294 | make test |
| 295 | |
| 296 | msg "test: configs/config-ccm-psk-tls1_2.h - compat.sh" |
| 297 | tests/compat.sh -m tls12 -f '^TLS_PSK_WITH_AES_..._CCM_8' |
| 298 | } |
| 299 | |
| 300 | component_test_tls1_2_ccm_psk_psa () { |
| 301 | msg "build: configs/config-ccm-psk-tls1_2.h + USE_PSA_CRYPTO" |
| 302 | cp configs/config-ccm-psk-tls1_2.h "$CONFIG_H" |
| 303 | scripts/config.py set MBEDTLS_PSA_CRYPTO_C |
| 304 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 305 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 306 | # want to re-generate generated files that depend on it, quite correctly. |
| 307 | # However this doesn't work as the generation script expects a specific |
| 308 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 309 | # cmake can't know this, but re-generation is actually not necessary as |
| 310 | # the generated files only depend on the list of available options, not |
| 311 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 312 | # dependency resolution for generated files and just rely on them being |
| 313 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 314 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 315 | make |
| 316 | |
| 317 | msg "test: configs/config-ccm-psk-tls1_2.h + USE_PSA_CRYPTO - unit tests" |
| 318 | make test |
| 319 | |
| 320 | msg "test: configs/config-ccm-psk-tls1_2.h + USE_PSA_CRYPTO - compat.sh" |
| 321 | tests/compat.sh -m tls12 -f '^TLS_PSK_WITH_AES_..._CCM_8' |
| 322 | } |
| 323 | |
Gilles Peskine | 68f511e | 2024-09-14 11:19:31 +0200 | [diff] [blame] | 324 | component_test_tls1_2_ccm_psk_dtls_legacy () { |
| 325 | msg "build: configs/config-ccm-psk-dtls1_2.h" |
| 326 | cp configs/config-ccm-psk-dtls1_2.h "$CONFIG_H" |
| 327 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 328 | # want to re-generate generated files that depend on it, quite correctly. |
| 329 | # However this doesn't work as the generation script expects a specific |
| 330 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 331 | # cmake can't know this, but re-generation is actually not necessary as |
| 332 | # the generated files only depend on the list of available options, not |
| 333 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 334 | # dependency resolution for generated files and just rely on them being |
| 335 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 336 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 337 | make |
| 338 | |
| 339 | msg "test: configs/config-ccm-psk-dtls1_2.h - unit tests" |
| 340 | make test |
| 341 | |
| 342 | msg "test: configs/config-ccm-psk-dtls1_2.h - compat.sh" |
| 343 | tests/compat.sh -m dtls12 -f '^TLS_PSK_WITH_AES_..._CCM_8' |
| 344 | |
| 345 | msg "build: configs/config-ccm-psk-dtls1_2.h + DEBUG" |
| 346 | MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG" |
| 347 | make clean |
| 348 | scripts/config.py set MBEDTLS_DEBUG_C |
| 349 | scripts/config.py set MBEDTLS_ERROR_C |
| 350 | make ssl-opt |
| 351 | |
| 352 | msg "test: configs/config-ccm-psk-dtls1_2.h + DEBUG - ssl-opt.sh" |
| 353 | tests/ssl-opt.sh |
| 354 | } |
| 355 | |
| 356 | component_test_tls1_2_ccm_psk_dtls_psa () { |
| 357 | msg "build: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO" |
| 358 | cp configs/config-ccm-psk-dtls1_2.h "$CONFIG_H" |
| 359 | scripts/config.py set MBEDTLS_PSA_CRYPTO_C |
| 360 | scripts/config.py set MBEDTLS_USE_PSA_CRYPTO |
| 361 | # test-ref-configs works by overwriting mbedtls_config.h; this makes cmake |
| 362 | # want to re-generate generated files that depend on it, quite correctly. |
| 363 | # However this doesn't work as the generation script expects a specific |
| 364 | # format for mbedtls_config.h, which the other files don't follow. Also, |
| 365 | # cmake can't know this, but re-generation is actually not necessary as |
| 366 | # the generated files only depend on the list of available options, not |
| 367 | # whether they're on or off. So, disable cmake's (over-sensitive here) |
| 368 | # dependency resolution for generated files and just rely on them being |
| 369 | # present (thanks to pre_generate_files) by turning GEN_FILES off. |
| 370 | CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan . |
| 371 | make |
| 372 | |
| 373 | msg "test: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO - unit tests" |
| 374 | make test |
| 375 | |
| 376 | msg "test: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO - compat.sh" |
| 377 | tests/compat.sh -m dtls12 -f '^TLS_PSK_WITH_AES_..._CCM_8' |
| 378 | |
| 379 | msg "build: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO + DEBUG" |
| 380 | MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG" |
| 381 | make clean |
| 382 | scripts/config.py set MBEDTLS_DEBUG_C |
| 383 | scripts/config.py set MBEDTLS_ERROR_C |
| 384 | make ssl-opt |
| 385 | |
| 386 | msg "test: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO + DEBUG - ssl-opt.sh" |
| 387 | tests/ssl-opt.sh |
| 388 | } |
| 389 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 390 | component_test_small_ssl_out_content_len () { |
| 391 | msg "build: small SSL_OUT_CONTENT_LEN (ASan build)" |
| 392 | scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 16384 |
| 393 | scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 4096 |
| 394 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 395 | make |
| 396 | |
| 397 | msg "test: small SSL_OUT_CONTENT_LEN - ssl-opt.sh MFL and large packet tests" |
| 398 | tests/ssl-opt.sh -f "Max fragment\|Large packet" |
| 399 | } |
| 400 | |
| 401 | component_test_small_ssl_in_content_len () { |
| 402 | msg "build: small SSL_IN_CONTENT_LEN (ASan build)" |
| 403 | scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 4096 |
| 404 | scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 16384 |
| 405 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 406 | make |
| 407 | |
| 408 | msg "test: small SSL_IN_CONTENT_LEN - ssl-opt.sh MFL tests" |
| 409 | tests/ssl-opt.sh -f "Max fragment" |
| 410 | } |
| 411 | |
| 412 | component_test_small_ssl_dtls_max_buffering () { |
| 413 | msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0" |
| 414 | scripts/config.py set MBEDTLS_SSL_DTLS_MAX_BUFFERING 1000 |
| 415 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 416 | make |
| 417 | |
| 418 | msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0 - ssl-opt.sh specific reordering test" |
| 419 | tests/ssl-opt.sh -f "DTLS reordering: Buffer out-of-order hs msg before reassembling next, free buffered msg" |
| 420 | } |
| 421 | |
| 422 | component_test_small_mbedtls_ssl_dtls_max_buffering () { |
| 423 | msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1" |
| 424 | scripts/config.py set MBEDTLS_SSL_DTLS_MAX_BUFFERING 190 |
| 425 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 426 | make |
| 427 | |
| 428 | msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1 - ssl-opt.sh specific reordering test" |
| 429 | tests/ssl-opt.sh -f "DTLS reordering: Buffer encrypted Finished message, drop for fragmented NewSessionTicket" |
| 430 | } |
| 431 | |
| 432 | # Common helper for component_full_without_ecdhe_ecdsa() and |
| 433 | # component_full_without_ecdhe_ecdsa_and_tls13() which: |
| 434 | # - starts from the "full" configuration minus the list of symbols passed in |
| 435 | # as 1st parameter |
| 436 | # - build |
| 437 | # - test only TLS (i.e. test_suite_tls and ssl-opt) |
| 438 | build_full_minus_something_and_test_tls () { |
| 439 | symbols_to_disable="$1" |
| 440 | |
| 441 | msg "build: full minus something, test TLS" |
| 442 | |
| 443 | scripts/config.py full |
| 444 | for sym in $symbols_to_disable; do |
| 445 | echo "Disabling $sym" |
| 446 | scripts/config.py unset $sym |
| 447 | done |
| 448 | |
| 449 | make |
| 450 | |
| 451 | msg "test: full minus something, test TLS" |
| 452 | ( cd tests; ./test_suite_ssl ) |
| 453 | |
| 454 | msg "ssl-opt: full minus something, test TLS" |
| 455 | tests/ssl-opt.sh |
| 456 | } |
| 457 | |
| 458 | component_full_without_ecdhe_ecdsa () { |
| 459 | build_full_minus_something_and_test_tls "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED" |
| 460 | } |
| 461 | |
| 462 | component_full_without_ecdhe_ecdsa_and_tls13 () { |
| 463 | build_full_minus_something_and_test_tls "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 464 | MBEDTLS_SSL_PROTO_TLS1_3" |
| 465 | } |
| 466 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 467 | component_build_no_ssl_srv () { |
| 468 | msg "build: full config except SSL server, make, gcc" # ~ 30s |
| 469 | scripts/config.py full |
| 470 | scripts/config.py unset MBEDTLS_SSL_SRV_C |
Minos Galanakis | a368c8a | 2024-08-06 12:06:51 +0100 | [diff] [blame] | 471 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -Wmissing-prototypes' |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | component_build_no_ssl_cli () { |
| 475 | msg "build: full config except SSL client, make, gcc" # ~ 30s |
| 476 | scripts/config.py full |
| 477 | scripts/config.py unset MBEDTLS_SSL_CLI_C |
Minos Galanakis | a368c8a | 2024-08-06 12:06:51 +0100 | [diff] [blame] | 478 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -Wmissing-prototypes' |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 479 | } |
| 480 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 481 | component_test_no_max_fragment_length () { |
| 482 | # Run max fragment length tests with MFL disabled |
| 483 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
| 484 | scripts/config.py unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 485 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 486 | make |
| 487 | |
| 488 | msg "test: ssl-opt.sh, MFL-related tests" |
| 489 | tests/ssl-opt.sh -f "Max fragment length" |
| 490 | } |
| 491 | |
| 492 | component_test_asan_remove_peer_certificate () { |
| 493 | msg "build: default config with MBEDTLS_SSL_KEEP_PEER_CERTIFICATE disabled (ASan build)" |
| 494 | scripts/config.py unset MBEDTLS_SSL_KEEP_PEER_CERTIFICATE |
| 495 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 496 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 497 | make |
| 498 | |
| 499 | msg "test: !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
| 500 | make test |
| 501 | |
| 502 | msg "test: ssl-opt.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
| 503 | tests/ssl-opt.sh |
| 504 | |
| 505 | msg "test: compat.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
| 506 | tests/compat.sh |
| 507 | |
| 508 | msg "test: context-info.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE" |
| 509 | tests/context-info.sh |
| 510 | } |
| 511 | |
| 512 | component_test_no_max_fragment_length_small_ssl_out_content_len () { |
| 513 | msg "build: no MFL extension, small SSL_OUT_CONTENT_LEN (ASan build)" |
| 514 | scripts/config.py unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 515 | scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 16384 |
| 516 | scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 4096 |
| 517 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 518 | make |
| 519 | |
| 520 | msg "test: MFL tests (disabled MFL extension case) & large packet tests" |
| 521 | tests/ssl-opt.sh -f "Max fragment length\|Large buffer" |
| 522 | |
| 523 | msg "test: context-info.sh (disabled MFL extension case)" |
| 524 | tests/context-info.sh |
| 525 | } |
| 526 | |
| 527 | component_test_variable_ssl_in_out_buffer_len () { |
| 528 | msg "build: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled (ASan build)" |
| 529 | scripts/config.py set MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH |
| 530 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 531 | make |
| 532 | |
| 533 | msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled" |
| 534 | make test |
| 535 | |
| 536 | msg "test: ssl-opt.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled" |
| 537 | tests/ssl-opt.sh |
| 538 | |
| 539 | msg "test: compat.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled" |
| 540 | tests/compat.sh |
| 541 | } |
| 542 | |
| 543 | component_test_dtls_cid_legacy () { |
| 544 | msg "build: MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled (ASan build)" |
| 545 | scripts/config.py set MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT 1 |
| 546 | |
| 547 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 548 | make |
| 549 | |
| 550 | msg "test: MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy)" |
| 551 | make test |
| 552 | |
| 553 | msg "test: ssl-opt.sh, MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled" |
| 554 | tests/ssl-opt.sh |
| 555 | |
| 556 | msg "test: compat.sh, MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled" |
| 557 | tests/compat.sh |
| 558 | } |
| 559 | |
| 560 | component_test_ssl_alloc_buffer_and_mfl () { |
| 561 | msg "build: default config with memory buffer allocator and MFL extension" |
| 562 | scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 563 | scripts/config.py set MBEDTLS_PLATFORM_MEMORY |
| 564 | scripts/config.py set MBEDTLS_MEMORY_DEBUG |
| 565 | scripts/config.py set MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 566 | scripts/config.py set MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH |
| 567 | cmake -DCMAKE_BUILD_TYPE:String=Release . |
| 568 | make |
| 569 | |
| 570 | msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG and MBEDTLS_SSL_MAX_FRAGMENT_LENGTH" |
| 571 | make test |
| 572 | |
| 573 | msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG and MBEDTLS_SSL_MAX_FRAGMENT_LENGTH" |
| 574 | tests/ssl-opt.sh -f "Handshake memory usage" |
| 575 | } |
| 576 | |
| 577 | component_test_when_no_ciphersuites_have_mac () { |
| 578 | msg "build: when no ciphersuites have MAC" |
| 579 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 580 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CBC_NO_PADDING |
| 581 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CBC_PKCS7 |
| 582 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_CMAC |
| 583 | scripts/config.py -f "$CRYPTO_CONFIG_H" unset PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 |
| 584 | |
| 585 | scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER |
| 586 | scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC |
| 587 | scripts/config.py unset MBEDTLS_CMAC_C |
| 588 | |
| 589 | make |
| 590 | |
| 591 | msg "test: !MBEDTLS_SSL_SOME_SUITES_USE_MAC" |
| 592 | make test |
| 593 | |
| 594 | msg "test ssl-opt.sh: !MBEDTLS_SSL_SOME_SUITES_USE_MAC" |
| 595 | tests/ssl-opt.sh -f 'Default\|EtM' -e 'without EtM' |
| 596 | } |
| 597 | |
| 598 | component_test_tls12_only () { |
| 599 | msg "build: default config without MBEDTLS_SSL_PROTO_TLS1_3, cmake, gcc, ASan" |
| 600 | scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3 |
| 601 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 602 | make |
| 603 | |
| 604 | msg "test: main suites (inc. selftests) (ASan build)" |
| 605 | make test |
| 606 | |
| 607 | msg "test: ssl-opt.sh (ASan build)" |
| 608 | tests/ssl-opt.sh |
| 609 | |
| 610 | msg "test: compat.sh (ASan build)" |
| 611 | tests/compat.sh |
| 612 | } |
| 613 | |
| 614 | component_test_tls13_only () { |
| 615 | msg "build: default config without MBEDTLS_SSL_PROTO_TLS1_2" |
| 616 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
| 617 | scripts/config.py set MBEDTLS_SSL_RECORD_SIZE_LIMIT |
| 618 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 619 | |
| 620 | msg "test: TLS 1.3 only, all key exchange modes enabled" |
| 621 | make test |
| 622 | |
| 623 | msg "ssl-opt.sh: TLS 1.3 only, all key exchange modes enabled" |
| 624 | tests/ssl-opt.sh |
| 625 | } |
| 626 | |
| 627 | component_test_tls13_only_psk () { |
| 628 | msg "build: TLS 1.3 only from default, only PSK key exchange mode" |
| 629 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 630 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 631 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 632 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 633 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 634 | scripts/config.py unset MBEDTLS_PKCS7_C |
| 635 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 636 | |
| 637 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 638 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDH |
| 639 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDSA |
| 640 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_DETERMINISTIC_ECDSA |
| 641 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_OAEP |
| 642 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_PSS |
| 643 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_FFDH |
| 644 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY |
| 645 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC |
| 646 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT |
| 647 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT |
| 648 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE |
| 649 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_DH_RFC7919_2048 |
| 650 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_DH_RFC7919_3072 |
| 651 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_DH_RFC7919_4096 |
| 652 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_DH_RFC7919_6144 |
| 653 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_DH_RFC7919_8192 |
Ronald Cron | 4153ebb | 2024-09-11 15:32:48 +0200 | [diff] [blame] | 654 | # Note: The four unsets below are to be removed for Mbed TLS 4.0 |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 655 | scripts/config.py unset MBEDTLS_ECDH_C |
| 656 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 657 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 658 | scripts/config.py unset MBEDTLS_DHM_C |
| 659 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 660 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 661 | |
| 662 | msg "test_suite_ssl: TLS 1.3 only, only PSK key exchange mode enabled" |
| 663 | cd tests; ./test_suite_ssl; cd .. |
| 664 | |
| 665 | msg "ssl-opt.sh: TLS 1.3 only, only PSK key exchange mode enabled" |
| 666 | tests/ssl-opt.sh |
| 667 | } |
| 668 | |
| 669 | component_test_tls13_only_ephemeral () { |
| 670 | msg "build: TLS 1.3 only from default, only ephemeral key exchange mode" |
| 671 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 672 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
| 673 | scripts/config.py unset MBEDTLS_SSL_EARLY_DATA |
| 674 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 675 | |
| 676 | msg "test_suite_ssl: TLS 1.3 only, only ephemeral key exchange mode" |
| 677 | cd tests; ./test_suite_ssl; cd .. |
| 678 | |
| 679 | msg "ssl-opt.sh: TLS 1.3 only, only ephemeral key exchange mode" |
| 680 | tests/ssl-opt.sh |
| 681 | } |
| 682 | |
| 683 | component_test_tls13_only_ephemeral_ffdh () { |
| 684 | msg "build: TLS 1.3 only from default, only ephemeral ffdh key exchange mode" |
| 685 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 686 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED |
| 687 | scripts/config.py unset MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 688 | |
| 689 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 690 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDH |
Ronald Cron | 4153ebb | 2024-09-11 15:32:48 +0200 | [diff] [blame] | 691 | # Note: The unset below is to be removed for Mbed TLS 4.0 |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 692 | scripts/config.py unset MBEDTLS_ECDH_C |
| 693 | |
| 694 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 695 | |
| 696 | msg "test_suite_ssl: TLS 1.3 only, only ephemeral ffdh key exchange mode" |
| 697 | cd tests; ./test_suite_ssl; cd .. |
| 698 | |
| 699 | msg "ssl-opt.sh: TLS 1.3 only, only ephemeral ffdh key exchange mode" |
| 700 | tests/ssl-opt.sh |
| 701 | } |
| 702 | |
| 703 | component_test_tls13_only_psk_ephemeral () { |
| 704 | msg "build: TLS 1.3 only from default, only PSK ephemeral key exchange mode" |
| 705 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 706 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 707 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 708 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 709 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 710 | scripts/config.py unset MBEDTLS_PKCS7_C |
| 711 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 712 | |
| 713 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 714 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDSA |
| 715 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_DETERMINISTIC_ECDSA |
| 716 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_OAEP |
| 717 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_PSS |
Ronald Cron | 4153ebb | 2024-09-11 15:32:48 +0200 | [diff] [blame] | 718 | # Note: The two unsets below are to be removed for Mbed TLS 4.0 |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 719 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 720 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 721 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 722 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 723 | |
| 724 | msg "test_suite_ssl: TLS 1.3 only, only PSK ephemeral key exchange mode" |
| 725 | cd tests; ./test_suite_ssl; cd .. |
| 726 | |
| 727 | msg "ssl-opt.sh: TLS 1.3 only, only PSK ephemeral key exchange mode" |
| 728 | tests/ssl-opt.sh |
| 729 | } |
| 730 | |
| 731 | component_test_tls13_only_psk_ephemeral_ffdh () { |
| 732 | msg "build: TLS 1.3 only from default, only PSK ephemeral ffdh key exchange mode" |
| 733 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 734 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 735 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 736 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 737 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 738 | scripts/config.py unset MBEDTLS_PKCS7_C |
| 739 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 740 | |
| 741 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 742 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDH |
| 743 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDSA |
| 744 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_DETERMINISTIC_ECDSA |
| 745 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_OAEP |
| 746 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_PSS |
| 747 | # Note: The three unsets below are to be removed for Mbed TLS 4.0 |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 748 | scripts/config.py unset MBEDTLS_ECDH_C |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 749 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 750 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 751 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 752 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 753 | |
| 754 | msg "test_suite_ssl: TLS 1.3 only, only PSK ephemeral ffdh key exchange mode" |
| 755 | cd tests; ./test_suite_ssl; cd .. |
| 756 | |
| 757 | msg "ssl-opt.sh: TLS 1.3 only, only PSK ephemeral ffdh key exchange mode" |
| 758 | tests/ssl-opt.sh |
| 759 | } |
| 760 | |
| 761 | component_test_tls13_only_psk_all () { |
| 762 | msg "build: TLS 1.3 only from default, without ephemeral key exchange mode" |
| 763 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED |
| 764 | scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C |
| 765 | scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT |
| 766 | scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 767 | scripts/config.py unset MBEDTLS_PKCS7_C |
| 768 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 769 | |
| 770 | scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG |
| 771 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_ECDSA |
| 772 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_DETERMINISTIC_ECDSA |
| 773 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_OAEP |
| 774 | scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_RSA_PSS |
Ronald Cron | 4153ebb | 2024-09-11 15:32:48 +0200 | [diff] [blame] | 775 | # Note: The two unsets below are to be removed for Mbed TLS 4.0 |
Ronald Cron | a9511bc | 2024-09-06 09:21:10 +0200 | [diff] [blame] | 776 | scripts/config.py unset MBEDTLS_ECDSA_C |
| 777 | scripts/config.py unset MBEDTLS_PKCS1_V21 |
| 778 | |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 779 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 780 | |
| 781 | msg "test_suite_ssl: TLS 1.3 only, PSK and PSK ephemeral key exchange modes" |
| 782 | cd tests; ./test_suite_ssl; cd .. |
| 783 | |
| 784 | msg "ssl-opt.sh: TLS 1.3 only, PSK and PSK ephemeral key exchange modes" |
| 785 | tests/ssl-opt.sh |
| 786 | } |
| 787 | |
| 788 | component_test_tls13_only_ephemeral_all () { |
| 789 | msg "build: TLS 1.3 only from default, without PSK key exchange mode" |
| 790 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED |
| 791 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
| 792 | make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'" |
| 793 | |
| 794 | msg "test_suite_ssl: TLS 1.3 only, ephemeral and PSK ephemeral key exchange modes" |
| 795 | cd tests; ./test_suite_ssl; cd .. |
| 796 | |
| 797 | msg "ssl-opt.sh: TLS 1.3 only, ephemeral and PSK ephemeral key exchange modes" |
| 798 | tests/ssl-opt.sh |
| 799 | } |
| 800 | |
| 801 | component_test_tls13_no_padding () { |
| 802 | msg "build: default config plus early data minus padding" |
| 803 | scripts/config.py set MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 1 |
| 804 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
| 805 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 806 | make |
| 807 | msg "test: default config plus early data minus padding" |
| 808 | make test |
| 809 | msg "ssl-opt.sh (TLS 1.3 no padding)" |
| 810 | tests/ssl-opt.sh |
| 811 | } |
| 812 | |
| 813 | component_test_tls13_no_compatibility_mode () { |
| 814 | msg "build: default config plus early data minus middlebox compatibility mode" |
| 815 | scripts/config.py unset MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE |
| 816 | scripts/config.py set MBEDTLS_SSL_EARLY_DATA |
| 817 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 818 | make |
| 819 | msg "test: default config plus early data minus middlebox compatibility mode" |
| 820 | make test |
| 821 | msg "ssl-opt.sh (TLS 1.3 no compatibility mode)" |
| 822 | tests/ssl-opt.sh |
| 823 | } |
| 824 | |
Minos Galanakis | f78447f | 2024-07-26 20:49:51 +0100 | [diff] [blame] | 825 | component_test_full_minus_session_tickets () { |
Minos Galanakis | 7665a93 | 2024-07-26 15:45:11 +0100 | [diff] [blame] | 826 | msg "build: full config without session tickets" |
| 827 | scripts/config.py full |
| 828 | scripts/config.py unset MBEDTLS_SSL_SESSION_TICKETS |
| 829 | scripts/config.py unset MBEDTLS_SSL_EARLY_DATA |
| 830 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 831 | make |
| 832 | msg "test: full config without session tickets" |
| 833 | make test |
| 834 | msg "ssl-opt.sh (full config without session tickets)" |
| 835 | tests/ssl-opt.sh |
| 836 | } |
| 837 | |
Minos Galanakis | 4b6ee64 | 2024-08-01 11:20:02 +0100 | [diff] [blame] | 838 | component_test_depends_py_kex () { |
| 839 | msg "test/build: depends.py kex (gcc)" |
| 840 | tests/scripts/depends.py kex --unset-use-psa |
| 841 | } |
| 842 | |
| 843 | component_test_depends_py_kex_psa () { |
| 844 | msg "test/build: depends.py kex (gcc) with MBEDTLS_USE_PSA_CRYPTO defined" |
| 845 | tests/scripts/depends.py kex |
| 846 | } |
| 847 | |
Minos Galanakis | 6aab5b7 | 2024-07-25 14:24:37 +0100 | [diff] [blame] | 848 | |