31329 Commits

Author SHA1 Message Date
Gilles Peskine
e9603cb00f Don't use the "allow list" terminology any longer
What was formerly called an allow list is now an ignore table.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
7960b7661a Switch coverage analysis to IGNORE_TESTS for its allowlist
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
5ef96c6809 Simplify sub-test-suite handling in is_test_case_ignored
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
9b7cdd91dc Move test case ignore list to the master Task class
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0a7d96d266 Remove now-useless level of method call indirection
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
95b2b0c160 Move analysis functions into their respective classes
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0e5e57b34c Remove dead code that was handling stringly typed data
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
92cc8dba27 Replace stringly typed data by class: driver vs reference (data)
Work on the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates the data for driver-vs-reference analysis and gets rid
of the transitional code that was using the old form of the data.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
17e071b0ab Replace stringly typed data by class: driver vs reference (code)
Work on the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates the code for driver-vs-reference analysis. To
facilitate review, this commit preserves the layout of the data that
parametrizes each task. The next commit will migrate the data.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0316f1006c Replace stringly typed data by class: coverage
Work on replacing the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates test coverage analysis.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
00ed057738 Replace stringly typed data by class: prepare
Start replacing the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit introduces some transition code.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
188325f152 Allow running pylint and mypy on a single file
Fix `mypy scripts/xxx.py`, `mypy tests/scripts/xxx.py`,
`pylint scripts/xxx.py`, `pylint tests/scripts/xxx.py`
failing to find `mbedtls_framework`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
David Horstmann
55b43e5cfb
Merge pull request #9541 from gilles-peskine-arm/ssl-opt-sample-programs-3.6
Backport 3.6: test sample programs in ssl-opt.sh
2024-09-26 14:33:13 +00:00
Manuel Pégourié-Gonnard
d93161f366
Merge pull request #9637 from gilles-peskine-arm/config-full-booleans-only-3.6
Backport 3.6: config.py: don't rely on section names
2024-09-26 10:04:06 +00:00
Gilles Peskine
fa1d84e102 Update framework to the main branch
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-26 10:18:36 +02:00
Gilles Peskine
5bf54ca46f Skip ssl_server in config-suite-b
When building with `configs/config-suite-b.h`, the SSL I/O buffer size is
1024 bytes. Experimentally, this isn't quite enough for the test certificate
that we use: the server aborts the handshake with
`MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL` raised from
`mbedtls_ssl_write_certificate()`. State an ad hoc minimum output buffer
size to skip testing `ssl_server` in `config-suite-b`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:53:39 +02:00
Gilles Peskine
e6fd7d57ca Use OPENSSL_NEXT for a test case that uses IPv6 when available
dtls_client connects to "localhost", which is usually IPv6 on modern
systems. On our CI, $OPENSSL is OpenSSL 1.0.2g which doesn't support IPv6.
Pitching dtls_client against $OPENSSL works on the CI at the moment, but
only because the CI runs in Docker with default network settings which has
IPv6 disabled. This would stop working if we changed the CI's Docker setup,
and the test case is likely to fail on a developer machine. So switch the
test case to using $OPENSSL_NEXT (which is a version of OpenSSL that has
IPv6 support).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
927f2f1418 Note known issue about test cases skipped in TLS 1.3-only builds
https://github.com/Mbed-TLS/mbedtls/issues/9560

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
ca730a7c13 Test SSL sample programs against each other and ssl_client2, ssl_server2
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
ff85e91914 dtls_client: don't force the use of IPv6
Default to connecting to "localhost", like ssl_client1.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
3104685cc6 ssl_server: Allow the client to close the connection first
This is necessary when testing against OpenSSL 1.0.2g.

In the server, flush more often. Otherwise, when stdout is redirected to a
file, the server gets killed before it writes important information, such as
the logs that we expect in the test cases.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
8d64fe1c56 Compatibiliy with older OpenSSL and GnuTLS
GnuTLS 3.4.x doesn't allow repeated `-p PORT` arguments.

OpenSSL 1.0.2 has different logs. For TLS 1.2 test cases, use a line that
is present in logs from OpenSSL 1.0.2g, 3.3.0 and presumably all versions
in between.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
33aa202339 Declare GnuTLS version dependency for TLS 1.3 test cases
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
6117a0cb8b Declare OpenSSL version dependency for TLS 1.3 test cases
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
9d104e9857 Test dtls_server
Test against both OpenSSL and GnuTLS.

Don't use a proxy. It's not particularly useful here, and would complicate
figuring out port numbers.

Clean up compile-time requirements dtls_server.c: any certificate-based key
exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
2a0af359f1 Test ssl_fork_server
Test ssl_fork_server with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

In the server, flush more often. Otherwise, when stdout is redirected to a
file, the server gets killed before it writes important information, such as
the logs that we expect in the test cases.

In the server, only write output for 10 seconds, not 100. That's enough time
to start concurrent clients if desired. 100 seconds causes ssl-opt to take a
very long time when the client actually listens to the whole input (which
`gnutls-cli` does, but not `openssl s_client`).

Clean up compile-time requirements in ssl_fork_server.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
fab6099d4a Test ssl_pthread_server
Test ssl_pthread_server with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

In the server, flush more often. Otherwise, when stdout is redirected to a
file, the server gets killed before it writes important information, such as
the logs that we expect in the test cases.

Clean up compile-time requirements in ssl_pthread_server.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
37c374981c Test ssl_server
Test ssl_server with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

Clean up compile-time requirements in ssl_server.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
f8b373e869 Test dtls_client
Test against both OpenSSL and GnuTLS.

Don't use a proxy. It's not particularly useful here, and would complicate
figuring out port numbers.

Clean up compile-time requirements in dtls_client.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
e6b8250a94 Test ssl_client1
Test ssl_client1 with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

Clean up compile-time requirements in ssl_client1.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
6c798ef36d Allow test cases to use a specific port
This is necessary for the SSL sample programs: they hard-code port 4433.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
478f6068b5 Prepare to test SSL sample programs
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
dd51826b4e ssl_client1: Exit with an error status if the TLS connection failed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 17:52:48 +02:00
Gilles Peskine
f5f90d517f Don't pass the section name to adapters
We have finished removing the reliance of named configuration on section
names.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 14:00:07 +02:00
Gilles Peskine
e5920a4ae8 Change "realfull" to activate everything
Change "realfull" to activate everything. After investigation, it seems that
having "realfull" not activate everything was a historical oddity due to
proximity with "full", not a goal in itself.

https://github.com/Mbed-TLS/mbedtls/issues/520#issuecomment-727190862
https://github.com/Mbed-TLS/mbedtls/pull/965/files#r523409092

This changes the output of `scripts/config.py realfull`: now all non-boolean
options are uncommented.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 14:00:07 +02:00
Gilles Peskine
bfdffc33b3 Change "full" to affect boolean settings rather than use sections
To get rid on the reliance on sections, change "full" and friends to enable
settings based on whether the setting is boolean, rather than based on the
section it contains.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 14:00:07 +02:00
Gilles Peskine
0ff1d984f8 Pass the setting's value to adapters
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 14:00:07 +02:00
Ronald Cron
1dbfb4b8e2
Merge pull request #9563 from gilles-peskine-arm/tls13-middlebox-compat-disabled-3.6
Backport 3.6: Fix interoperability when MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE is disabled
2024-09-25 11:50:31 +00:00
Gilles Peskine
ae7e1c7861 Have make ssl-opt generate tls13-compat.sh (make edition)
This is necessary if you haven't run `make generated_files` first.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 10:27:47 +02:00
Gilles Peskine
278b417752 Have make ssl-opt generate tls13-compat.sh
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 09:52:28 +02:00
Gilles Peskine
02f0f9f1ff Merge remote-tracking branch 'mbedtls-3.6' into tls13-middlebox-compat-disabled-3.6 2024-09-25 09:52:14 +02:00
Gilles Peskine
c67a0ad5da Fix copypasta
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 17:33:24 +02:00
Gilles Peskine
f0d2eb5828
Merge pull request #9603 from gilles-peskine-arm/test-ref-configs-go-away-3.6
Backport 3.6: Switch from test-ref-configs.pl to separate components
2024-09-24 13:00:54 +00:00
Paul Elliott
d8c7eae2cf
Merge pull request #9596 from gilles-peskine-arm/make_generated_files-document_CC-3.6
Backport 3.6: make_generated_files.bat: document C compiler requirement
2024-09-24 12:36:28 +00:00
Tom Cosgrove
81163122e4
Merge pull request #9601 from gilles-peskine-arm/use_psa_crypto-key_id_encodes_owner-compatible-config-3.6
Fix obsolete comment about MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
2024-09-24 10:44:44 +00:00
Ronald Cron
cbacb065f3
Merge pull request #9511 from gabor-mezei-arm/9325_bp36_move_config.py_to_framework
[Backport 3.6] Move `config.py` functionalities to the framework
2024-09-20 16:07:47 +00:00
Gabor Mezei
5a2bcf6f3e
Remove PSA macros usage from adapters
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-20 12:41:24 +02:00
Gilles Peskine
94f7e409eb CMake: generate tls13-compat.sh in the default build target
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
10e58e7b05 Move generation of tls13-compat.sh to tests/CMakeLists.txt
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
8ca70ac470 Print a "Gen" line when generating a file
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00