Skip to content

Commit 7dc9704

Browse files
gilles-peskine-armronald-cron-arm
authored andcommitted
Revert "Remove tests that depend on TLS or X.509"
This reverts commit 9afb2e9. Conflicts: * include/CMakeLists.txt * "Make config.h available" comment: there has been a change adjacent to where it was removed. Just re-add what was removed. * tests/CMakeLists.txt: * compat.sh: there has been a change immediately before where it was removed. Just re-add what was removed.
1 parent 1a9c624 commit 7dc9704

24 files changed

+13166
-4
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ script:
1616
- make
1717
- make test
1818
- programs/test/selftest
19+
- OSSL_NO_DTLS=1 tests/compat.sh
20+
- tests/ssl-opt.sh -e '\(DTLS\|SCSV\).*openssl' --seed 4
1921
- tests/scripts/test-ref-configs.pl
2022
- tests/scripts/curves.pl
23+
- tests/scripts/key-exchanges.pl
24+
after_failure:
25+
- tests/scripts/travis-log-failure.sh
2126
env:
2227
global:
2328
- SEED=1

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ if(ENABLE_TESTING)
218218
ADD_CUSTOM_TARGET(covtest
219219
COMMAND make test
220220
COMMAND programs/test/selftest
221+
COMMAND tests/compat.sh
222+
COMMAND tests/ssl-opt.sh
221223
)
222224

223225
ADD_CUSTOM_TARGET(lcov

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ ifndef WINDOWS
101101
covtest:
102102
$(MAKE) check
103103
programs/test/selftest
104+
tests/compat.sh
105+
tests/ssl-opt.sh
104106

105107
lcov:
106108
rm -rf Coverage

configs/config-mini-tls1_1.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
#define MBEDTLS_CERTS_C
7171
#define MBEDTLS_PEM_PARSE_C
7272

73+
/* For testing with compat.sh */
74+
#define MBEDTLS_FS_IO
75+
7376
#include "mbedtls/check_config.h"
7477

7578
#endif /* MBEDTLS_CONFIG_H */

configs/config-thread.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
#define MBEDTLS_SSL_SRV_C
7676
#define MBEDTLS_SSL_TLS_C
7777

78+
/* For tests using ssl-opt.sh */
79+
#define MBEDTLS_NET_C
80+
#define MBEDTLS_TIMING_C
81+
7882
/* Save RAM at the expense of ROM */
7983
#define MBEDTLS_AES_ROM_TABLES
8084

include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(INSTALL_MBEDTLS_HEADERS)
1515

1616
endif(INSTALL_MBEDTLS_HEADERS)
1717

18-
# Make config.h available in an out-of-source build.
18+
# Make config.h available in an out-of-source build. ssl-opt.sh requires it.
1919
if (ENABLE_TESTING AND NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
2020
link_to_source(mbedtls)
2121
link_to_source(psa)

scripts/output_env.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# - type and version of the operating system
1616
# - version of armcc, clang, gcc-arm and gcc compilers
1717
# - version of libc, clang, asan and valgrind if installed
18+
# - version of gnuTLS and OpenSSL
1819

1920
print_version()
2021
{
@@ -73,6 +74,42 @@ echo
7374
print_version "valgrind" "--version" "valgrind not found!"
7475
echo
7576

77+
: ${OPENSSL:=openssl}
78+
print_version "$OPENSSL" "version" "openssl not found!"
79+
echo
80+
81+
if [ -n "${OPENSSL_LEGACY+set}" ]; then
82+
print_version "$OPENSSL_LEGACY" "version" "openssl legacy version not found!"
83+
echo
84+
fi
85+
86+
if [ -n "${OPENSSL_NEXT+set}" ]; then
87+
print_version "$OPENSSL_NEXT" "version" "openssl next version not found!"
88+
echo
89+
fi
90+
91+
: ${GNUTLS_CLI:=gnutls-cli}
92+
print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
93+
echo
94+
95+
: ${GNUTLS_SERV:=gnutls-serv}
96+
print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
97+
echo
98+
99+
if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
100+
print_version "$GNUTLS_LEGACY_CLI" "--version" \
101+
"gnuTLS client legacy version not found!" \
102+
"head -n 1"
103+
echo
104+
fi
105+
106+
if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
107+
print_version "$GNUTLS_LEGACY_SERV" "--version" \
108+
"gnuTLS server legacy version not found!" \
109+
"head -n 1"
110+
echo
111+
fi
112+
76113
if `hash dpkg > /dev/null 2>&1`; then
77114
echo "* asan:"
78115
dpkg -s libasan2 2> /dev/null | grep -i version

tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ add_test_suite(cipher cipher.null)
9999
add_test_suite(cipher cipher.padding)
100100
add_test_suite(cmac)
101101
add_test_suite(ctr_drbg)
102+
add_test_suite(debug)
102103
add_test_suite(des)
103104
add_test_suite(dhm)
104105
add_test_suite(ecdh)
@@ -145,18 +146,23 @@ add_test_suite(psa_crypto_se_driver_hal_mocks)
145146
add_test_suite(psa_crypto_slot_management)
146147
add_test_suite(psa_its)
147148
add_test_suite(shax)
149+
add_test_suite(ssl)
148150
add_test_suite(timing)
149151
add_test_suite(rsa)
150152
add_test_suite(version)
151153
add_test_suite(xtea)
154+
add_test_suite(x509parse)
155+
add_test_suite(x509write)
152156

153157
# Make scripts and data files needed for testing available in an
154158
# out-of-source build.
155159
if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
156160
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/seedfile")
157161
link_to_source(seedfile)
158162
endif()
163+
link_to_source(compat.sh)
159164
link_to_source(data_files)
160165
link_to_source(scripts)
166+
link_to_source(ssl-opt.sh)
161167
link_to_source(suites)
162168
endif()

tests/Descriptions.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@ test_suites
22
The various 'test_suite_XXX' programs from the 'tests' directory, executed
33
using 'make check' (Unix make) or 'make test' (Cmake), include test cases
44
(reference test vectors, sanity checks, malformed input for parsing
5-
functions, etc.) for all modules.
5+
functions, etc.) for all modules except the SSL modules.
66

77
selftests
88
The 'programs/test/selftest' program runs the 'XXX_self_test()' functions
99
of each individual module. Most of them are included in the respective
1010
test suite, but some slower ones are only included here.
11+
12+
compat
13+
The 'tests/compat.sh' script checks interoperability with OpenSSL and
14+
GnuTLS (and ourselves!) for every common ciphersuite, in every TLS
15+
version, both ways (client/server), using client authentication or not.
16+
For each ciphersuite/version/side/authmode it performs a full handshake
17+
and a small data exchange.
18+
19+
ssl_opt
20+
The 'tests/ssl-opt.sh' script checks various options and/or operations not
21+
covered by compat.sh: session resumption (using session cache or tickets),
22+
renegotiation, SNI, other extensions, etc.

0 commit comments

Comments
 (0)