Skip to content

Commit 134677d

Browse files
Merge pull request #10029 from gilles-peskine-arm/tls-defragment-generate-tests-3.6
Backport 3.6: Generate TLS handshake defragmentation tests
2 parents abb08f1 + 2e7def5 commit 134677d

File tree

8 files changed

+37
-516
lines changed

8 files changed

+37
-516
lines changed

scripts/make_generated_files.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ python framework\scripts\generate_ecp_tests.py || exit /b 1
2828
python framework\scripts\generate_psa_tests.py || exit /b 1
2929
python framework\scripts\generate_test_keys.py --output framework\tests\include\test\test_keys.h || exit /b 1
3030
python framework\scripts\generate_test_cert_macros.py --output tests\src\test_certs.h || exit /b 1
31+
python framework\scripts\generate_tls_handshake_tests.py || exit /b 1
3132
python framework\scripts\generate_tls13_compat_tests.py || exit /b 1

tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
###START_GENERATED_FILES###
2020
# Generated source files
21+
/opt-testcases/handshake-generated.sh
2122
/opt-testcases/tls13-compat.sh
2223
/suites/*.generated.data
2324
/suites/test_suite_config.mbedtls_boolean.data

tests/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,24 @@ if(GEN_FILES)
124124
# change too often in ways that don't affect the result
125125
# ((un)commenting some options).
126126
)
127+
128+
add_custom_command(
129+
OUTPUT
130+
${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/handshake-generated.sh
131+
WORKING_DIRECTORY
132+
${CMAKE_CURRENT_SOURCE_DIR}/..
133+
COMMAND
134+
"${MBEDTLS_PYTHON_EXECUTABLE}"
135+
"${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls_handshake_tests.py"
136+
DEPENDS
137+
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/tls_test_case.py
138+
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls_handshake_tests.py
139+
)
140+
add_custom_target(handshake-generated.sh
141+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/handshake-generated.sh)
142+
set_target_properties(handshake-generated.sh PROPERTIES EXCLUDE_FROM_ALL NO)
143+
add_dependencies(${ssl_opt_target} handshake-generated.sh)
144+
127145
add_custom_command(
128146
OUTPUT
129147
${ecp_generated_data_files}

tests/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ GENERATED_FILES += ../framework/tests/include/test/test_keys.h src/test_certs.h
5858
# Generated files needed to (fully) run ssl-opt.sh
5959
.PHONY: ssl-opt
6060

61+
opt-testcases/handshake-generated.sh: ../framework/scripts/mbedtls_framework/tls_test_case.py
62+
opt-testcases/handshake-generated.sh: ../framework/scripts/generate_tls_handshake_tests.py
63+
echo " Gen $@"
64+
$(PYTHON) ../framework/scripts/generate_tls_handshake_tests.py -o $@
65+
GENERATED_FILES += opt-testcases/handshake-generated.sh
66+
ssl-opt: opt-testcases/handshake-generated.sh
67+
6168
opt-testcases/tls13-compat.sh: ../framework/scripts/generate_tls13_compat_tests.py
6269
echo " Gen $@"
6370
$(PYTHON) ../framework/scripts/generate_tls13_compat_tests.py -o $@

tests/scripts/analyze_outcomes.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ def _has_word_re(words: typing.Iterable[str],
3434
re.DOTALL)
3535

3636
IGNORED_TESTS = {
37+
'handshake-generated': [
38+
# Temporary disable Handshake defragmentation tests until mbedtls
39+
# pr #10011 has been merged.
40+
'Handshake defragmentation on client: len=4, TLS 1.2',
41+
'Handshake defragmentation on client: len=5, TLS 1.2',
42+
'Handshake defragmentation on client: len=13, TLS 1.2'
43+
],
3744
'ssl-opt': [
3845
# We don't run ssl-opt.sh with Valgrind on the CI because
3946
# it's extremely slow. We don't intend to change this.
@@ -53,11 +60,6 @@ def _has_word_re(words: typing.Iterable[str],
5360
# https://github.com/Mbed-TLS/mbedtls/issues/9581
5461
'Opaque key for server authentication: invalid key: decrypt with ECC key, no async',
5562
'Opaque key for server authentication: invalid key: ecdh with RSA key, no async',
56-
# Temporary disable Handshake defragmentation tests until mbedtls
57-
# pr #10011 has been merged.
58-
'Handshake defragmentation on client: len=4, TLS 1.2',
59-
'Handshake defragmentation on client: len=5, TLS 1.2',
60-
'Handshake defragmentation on client: len=13, TLS 1.2'
6163
],
6264
'test_suite_config.mbedtls_boolean': [
6365
# We never test with CBC/PKCS5/PKCS12 enabled but

tests/scripts/check-generated-files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ if in_mbedtls_repo; then
135135
check scripts/generate_query_config.pl programs/test/query_config.c
136136
check scripts/generate_features.pl library/version_features.c
137137
check framework/scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c
138+
check framework/scripts/generate_tls_handshake_tests.py tests/opt-testcases/handshake-generated.sh
138139
check framework/scripts/generate_tls13_compat_tests.py tests/opt-testcases/tls13-compat.sh
139140
check framework/scripts/generate_test_cert_macros.py tests/src/test_certs.h
140141
# generate_visualc_files enumerates source files (library/*.c). It doesn't

0 commit comments

Comments
 (0)