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