Commit Graph

12753 Commits

Author SHA1 Message Date
Gilles Peskine
7f4fe3943d Merge pull request #10624 from gilles-peskine-arm/audit_validity_dates-move-to-framework
Move some scripts to the framework
2026-03-19 12:19:00 +00:00
Ronald Cron
cb0b594a9d Merge pull request #10442 from davidhorstmann-arm/verify-result-default-failure
Hardening: Make `mbedtls_ssl_get_verify_result()` default to failure
2026-03-17 10:36:38 +00:00
Valerio Setti
e4d2126ad8 tests: ssl: replace dependency from RSA PSS to PKCS v1.5 in one handshake test
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 21:31:14 +01:00
Valerio Setti
2258cb7b5a tests: pkcs7: ease requirements for parse tests
replace PSA_HAVE_ALG_SOME_RSA_VERIFY with PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
0dfc52e740 tests: ssl: replace remaining occurrences of legacy RSA algorithms
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
ed0aebd2c5 tests: bulk replace MBEDTLS_RSA_C with PSA_HAVE_ALG_SOME_RSA_SIGN
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
2fab51329b tests: bulk replace MBEDTLS_RSA_C with PSA_HAVE_ALG_SOME_RSA_VERIFY
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
ff2630664a tests: bulk replace MBEDTLS_RSA_C with PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
David Horstmann
937c70ac90 Do not check fail cases for verify skipped
In testcases where we are expecting handshake failure the message
"Certificate verification was skipped" is not printed, so do not check
for it.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-13 18:04:16 +00:00
David Horstmann
868bea42a1 Only check for verify skipped if we have certs
Check for the 'Certificate verification was skipped' message only when
the testcase depends on
MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED since in other
cases certificates may not be enabled at all and this message will not
be printed in the output.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-13 14:39:43 +00:00
Gilles Peskine
f840cb16e5 Update paths after moving some scripts to the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-12 10:18:52 +01:00
Gilles Peskine
326fb18585 Move some scripts from mbedtls into the framework
Move a bunch of files from `scripts` and `mbedtls/scripts` to the framework.
Most are not called from any scripts invoked by the CI, but a couple are.
A subsequent commit will adapt the scripts. None of these scripts are
referenced from other repositories except in documentation.

The following files will be removed, and added to `mbedtls-framework`:

* `scripts/ecp_comb_table.py`
* `scripts/massif_max.pl`
* `tests/scripts/audit-validity-dates.py` (moved to `scripts/`)
* `tests/scripts/gen_ctr_drbg.pl` (moved to `scripts/`)
* `tests/scripts/gen_gcm_decrypt.pl` (moved to `scripts/`)
* `tests/scripts/gen_gcm_encrypt.pl` (moved to `scripts/`)
* `tests/scripts/gen_pkcs1_v21_sign_verify.pl` (moved to `scripts/`)
* `tests/scripts/generate-afl-tests.sh` (moved to `scripts/`)
* `tests/scripts/generate_server9_bad_saltlen.py` (moved to `scripts/`)
* `tests/scripts/run-metatests.sh` (moved to `scripts/`)
* `tests/scripts/run_demos.py` (moved to `scripts/`)
* `tests/scripts/test_config_script.py` (moved to `scripts/`)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-12 10:18:33 +01:00
Gilles Peskine
23318bde24 Remove PSA status coverage log test
We haven't used this in years. It's obsolete because this functionality
should now be provided by the more general PSA function
wrappers (`PSALoggingWrapper` generator), although that work is unfinished.
It belongs in TF-PSA-Crypto anyway. So remove it, it's one less little
amount of baggage.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-12 10:18:33 +01:00
David Horstmann
708b401697 ssl-opt.sh Check for cert verify skipped
In testcases in opt-testcases/tls13kex-modes.sh, check for the setting
of the failure flag MBEDTLS_X509_BADCERT_SKIP_VERIFY by looking for the
string "! Certificate verification was skipped" in the output in cases
where the key exchange is negotiated to use PSK.

Note that this check for output is only added to the success cases since
the negative tests fail before this string is printed.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-11 11:39:35 +00:00
David Horstmann
c6e1d67b1b ssl-opt.sh: Check for cert verify skipped
Check that the message "! Certificate verification was skipped" is
present in the output when auth_mode=none. This indicates that the
certificate verify flag MBEDTLS_X509_BADCERT_SKIP_VERIFY was
correctly set.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-11 10:36:11 +00:00
Ronald Cron
b5749b88f6 Merge pull request #10576 from ronald-cron-arm/dtls-client-hello-defragmentation
Add support for (D)TLS 1.2 client hello defragmentation
2026-03-10 14:46:07 +00:00
Ronald Cron
269b390bb4 components-platform.sh: Fix path of compiler directory
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
aa024253d6 tests: make: Fix spaces instead of tab
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
32479c6a72 cmake: Introduce TF_PSA_CRYPTO_PRIVATE_INCLUDE_DIRS
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
a400a3bb8a Adapt list_internal_identifiers.py for upcoming directory changes
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
f3a20d25d6 Prepare libtestdriver1 build for upcoming directory changes
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
24bf98156a components*.sh: Handle current and upcoming object paths
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
03ee085e10 Remove duplicated recursion tests
The recursion tests for the crypto code
are run in a TF-PSA-Crypto component.
No need to run them in an Mbed TLS
component as well.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Gilles Peskine
3c67824964 test_suite_debug: test the printf used by debug.c
In `test_suite_debug`, test `mbedtls_debug_snprintf()`, which uses
`mbedtls_vsnprintf()` like `mbedtls_debug_print_msg()`. Do this instead of
testing `mbedtls_snprintf()`, which might be subtly different (older
Windows runtimes had slightly different behavior for vsnprintf() vs
snprintf(); TF-PSA-Crypto might pick up a different function if the
platform configuration is different in TF-PSA-Crypto and Mbed TLS).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 20:56:03 +01:00
Gilles Peskine
7af09b4f21 Add a few more test cases for printf formats
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 19:54:59 +00:00
Bence Szépkúti
c2cb8565a5 Merge pull request #10607 from gilles-peskine-arm/timing-use-mstime
Simplify MBEDTLS_TIMING_C to use mbedtls_ms_time()
2026-02-26 14:38:50 +00:00
Ronald Cron
814f5da61a ssl-opt.sh: Use more diverse MTUs
Do not use only power of 2 MTUs.
Use diverse MTUs in DTLS reassembly/
fragmenting/proxy tests.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
3ddc63d74e ssl-opt.sh: DTLS reassembly: Improve max_content_len requirements
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
e436f74576 ssl-opt.sh: Fix/improve comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
6e270c0465 ssl-opt.sh: Add tests with CH fragmented with DTLS in default config
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
c1cbfdd072 ssl-opt.sh: Add interop test of DTLS defragmentation on server side
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
2e9b9681e6 ssl_server2.c: DTLS: Attempt to read the response to the close notification
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
fa5e75d6f6 ssl-opt.sh: Relax deps of handshake defrag tests
Relax the dependencies of the tests about handshake
message defragmentation/reassembly on server side.

TLS 1.3 does not need to be enable anymore for this
to work for TLS 1.2 handshake messages.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Valerio Setti
b41c8f6e04 Merge pull request #10608 from bjwtaylor/DriverVsReference_removal
Remove DriverVsReference tasks from analyze_outcomes.py
2026-02-23 09:01:25 +00:00
Gilles Peskine
99c4159681 Disable Unix-like integration code in baremetal builds in all.sh
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-21 21:20:36 +01:00
Ben Taylor
d507b46684 Remove DriverVsReference tasks from analyze_outcomes.py
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-02-20 15:08:33 +00:00
Ronald Cron
73be048c8a ssl-opt.sh: Revert leftover debug level increase
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
076ddc3ac7 tests: cmake: Fix dependency on generate_tls_handshake_tests.py
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
4f0741498c ssl_msg.c: Improve handshake message fragmenting message
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
b952ba09d6 ssl-opt.sh: Improve DTLS proxy 3d tests
Improve DTLS proxy 3d tests with OpenSSL and
GnuTLS servers. Have a better control of which
message is fragmented and verify it is the
case.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
addf640a3b ssl-opt.sh: Improve DTLS reassembly tests
Improve DTLS reassembly tests with OpenSSL
and GnuTLS server. Check that some messages
have been reassembled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
cad9c8ae71 ssl-opt.sh: Remove DTLS reassembly redundant test
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
8f0240c350 ssl-opt.sh: Remove CH reassembly unsupported test
We are about to have full support for TLS 1.2
CH reassembly on server side. The equivalent
positive test would be a duplicate of one of
the tests generated by generate_tls_handshake_tests.py.
Thus just removing the negative test.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
7fe38dd934 ssl_msg.c: Improve HS message reassembly completed message
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron
1b5a0b1877 Add branch specific generate_tls_handshake_tests.py file
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 13:02:26 +01:00
Ronald Cron
57b29c2fe5 Introduce branch specific make_generated_files.py
Introduce branch specific make_generated_files.py
and use it in the development branch.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 13:02:26 +01:00
Gilles Peskine
d3a8582606 Actually check committed generated files
We were accidentally running the check in TF-PSA-Crypto instead of in Mbed TLS.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-12 13:16:18 +01:00
David Horstmann
ff51a1a176 Initialize verify_result in session free
Initialize the verify_result field in mbedtls_ssl_session_free().
Previously we were just zeroising the entire session object, which would
yield a default 'success' value if the same object were reused.

Test that this initialisation is actually happening by setting
verify_result manually to zero and calling mbedtls_ssl_session_free() on
the session before checking its value.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-02-05 14:31:46 +00:00
David Horstmann
687a1ba907 Switch to a default value of -1u
Since we explicitly document the value 0xFFFFFFFF or -1u as representing
'result not available', we can use it as a sensible default value
without creating an API change. Use this value instead of introducing a
new verification result value.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-02-05 14:31:46 +00:00
David Horstmann
0ecde06ce9 Add non-regression test for verify_result init
Write a testcase to get verify_result before we have performed a
handshake and make sure that it is initialised to a failure value.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-02-05 14:31:43 +00:00