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