Commit Graph

32554 Commits

Author SHA1 Message Date
Gilles Peskine
d5e35a376b Merge pull request #10629 from gilles-peskine-arm/audit_validity_dates-move-to-framework-3.6
Backport 3.6: Move some scripts to the framework
2026-03-19 14:39:25 +00:00
Gilles Peskine
e48926031b Update massif_max.pl location
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-19 13:20:36 +01:00
Gilles Peskine
f3c1f8dd70 Update paths after moving some scripts to the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-19 13:20:36 +01:00
Gilles Peskine
401751bd52 Move requirements to the framework for scripts in the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-19 13:20:36 +01:00
Gilles Peskine
8271269944 Update framework with moved scripts
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-19 13:20:07 +01:00
Gilles Peskine
c7d600f21f Align some scripts with development
The changes made between 3.6 and 4.0+ are useless but harmless in 3.6.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-19 13:19:31 +01:00
Ronald Cron
303504fba9 Merge pull request #10645 from minosgalanakis/mbedtls-3.6-release-sync
MbedTLS 3.6.6 release sync
2026-03-17 20:46:43 +00:00
Minos Galanakis
b19eec6495 Updated framework pointer
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-17 16:55:40 +00:00
Bence Szépkúti
444d0ac2c1 Merge pull request #10443 from davidhorstmann-arm/verify-result-default-failure-3.6
[Backport 3.6] Hardening: Make `mbedtls_ssl_get_verify_result()` default to failure
2026-03-17 12:14:48 +00:00
David Horstmann
0501209507 Move TLS 1.3 verify-result setting for PSK
When we are doing PSK, we'd like to set verify_result to
0 to indicate success. Previously this was done in
mbedtls_ssl_set_hs_psk() but this is inadequate since this function may
be called for early data (where certificate verification happens later
in the handshake).

Instead, set this value after writing / processing the encrypted
extensions on the server / client respectively, so that we know whether
we are doing certificate verification or not for sure. This change is
effective only for TLS 1.3 as TLS 1.2 sets verify_result for PSK in
ssl_parse_certificate_coordinate().

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-16 17:19:30 +00:00
David Horstmann
611f3fb072 Configure the RNG in 3.6 testcase
In Mbed TLS 3.6 we still need to manually configure the RNG for TLS. Add
this to the testcase for default verify_result.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-16 11:15:01 +00:00
Manuel Pégourié-Gonnard
e24f1e5c2c Merge pull request #10609 from mpg/pk-psa-large-stack-buffers
[3.6] PK: avoid large stack buffers in "to/from PSA" functions
2026-03-13 08:53:48 +00:00
Ronald Cron
828e3817ac Merge pull request #10623 from ronald-cron-arm/dtls-client-hello-defragmentation-3.6
Backport 3.6: Add support for (D)TLS 1.2 client hello defragmentation
2026-03-10 14:46:41 +00:00
Ronald Cron
7476e4067d Restore seq number check of post-handshake ClientHello msg
The check was wrongly removed by the commit
"ssl_tls12_server.c: Move ClientHello message_seq adjustment".

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 10:15:42 +01:00
Ronald Cron
d6977afbd8 ssl_tls12_server.c: Move back the digest update
Move back the digest update just after
the call to mbedtls_ssl_read_record().
It fits well here as we explain in the
comment associated to the call to
mbedtls_ssl_read_record() that we
update it manually.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 09:47:29 +01:00
Ronald Cron
1222d8cbf4 Improve comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 09:47:28 +01:00
Gilles Peskine
855e10c108 Merge pull request #10068 from gilles-peskine-arm/pk-0e-prototype-3.6
Minor documentation fixes in pk.h
2026-03-09 13:57:34 +00:00
Gilles Peskine
0306be2cb5 Merge pull request #10465 from bensze01/abicheck-port-3.6
[Backport 3.6] Move abi_check.py to the framework
2026-03-09 13:57:08 +00:00
Gilles Peskine
4b571add25 Merge pull request #10621 from gilles-peskine-arm/unix-detection-202601-3.6
Backport 3.6: Simplify platform requirements
2026-03-06 18:06:04 +00:00
Bence Szépkúti
5dcfb01b52 Add abi_check.py bridge script
The bulk of the script that was moved to the framework is now a pure
python module - bridge scripts like this one will remain in each
individual branch, and continue to be the way to invoke the ABI checks.

This way we can use the bridge scripts to encode branch-specific
information in a more convenient way.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2026-03-05 14:55:00 +01:00
Bence Szépkúti
34bbc72190 Move abi_check.py into the framework
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2026-03-05 14:52:38 +01:00
Gilles Peskine
31934f47c5 Note platforms with known improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
2393fddd60 clock_gettime: don't assume more than 1 second since the origin of time
With e.g. `CLOCK_BOOTTIME`, it's plausible that less than 1 second has
passed since the boot reference time.

Only assert that the returned time is nonzero (because all-bits-zero is
highly implausible as an actual clock value, but likely indicates that the
intended value was not copied out correctly).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
b17d0f3028 Let test suites see strtoull() on FreeBSD if building with -std=c99
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
fa62af0a47 Let test suites see gettimeofday() on FreeBSD
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
08614e1e96 Skip printf("%zu") tests with MinGW
MinGW uses a legacy printf by default which doesn't support the `z` modifier
for `size_t`. Skip these test cases on MinGW.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
5c6ec6bcc0 Add smoke test for gettimeofday()
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
60cfb78882 Fix the build on non-Unix-like platforms that define CLOCK_REALTIME as a macro
Needed for MinGW builds in our CI.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
9cd92b207f Support testing baremetal builds without the UNIXLIKE code
When `MBEDTLS_TEST_PLATFORM_IS_NOT_UNIXLIKE` is defined, do not enable
`MBEDTLS_PLATFORM_IS_UNIXLIKE`. This lets us test baremetal builds as such
even if we happen to be building for Linux or other Unix-like platform.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
dec0d500a8 Test printf integer format modifiers more
In particular, test `"%zu"` for `size_t` and `"%lld"` for `long long`, which
older Windows runtimes do not support, but which Mbed TLS uses.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
f994fe05cd Fix the build on non-UNIXLIKE platforms
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
5ca8894b59 Fix the build with dietlibc
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
df9fdae4c4 Add smoke test for availability of some Unix functions
The goal isn't to do any functional testing, but to have a simple diagnostic
if some Unix platform function isn't available, and to have a record of
success in the outcome file.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
168461a3a9 Unify the detection of Unix-like platforms
We were using slightly different guards to decide whether to include
`<unistd.h>` in different places. Unify those.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
15c041c465 Fix wrong pointer type passed to printf
It works in practice, but clang on FreeBSD rightfully complains about it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
f2c25e0133 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-03-03 15:19:58 +01:00
Gilles Peskine
a7de32a719 Disable Unix-like integration code in baremetal builds in all.sh
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
59c6afcd46 Update framework with TEST_ASSERT_ERRNO
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 15:19:58 +01:00
Gilles Peskine
95be019fb2 Merge pull request #10599 from valeriosetti/backport-fix-ans1write
[backport] include: fix guard in asn1write.h
2026-03-03 09:59:24 +00:00
Manuel Pégourié-Gonnard
c763c2e837 PK: use EC macro for EC key size
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-03 09:53:08 +01:00
Manuel Pégourié-Gonnard
4c4cfe98de PK: use PSA size macros when exporting to PSA
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-03 09:50:53 +01:00
Manuel Pégourié-Gonnard
1fee3da79a PK: require more option combinations in tests
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-27 10:48:48 +01:00
Manuel Pégourié-Gonnard
023c51b282 PK: adjust size macro in case PSA is disabled
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-27 10:37:34 +01:00
Manuel Pégourié-Gonnard
127b0352b3 PK: move another large buffer to the heap
Was previously missed as it only exists when USE_PSA_CRYPTO is enabled.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-27 10:32:19 +01:00
Manuel Pégourié-Gonnard
571d78361a PK: zeroize dummy signature just to be sure
The signature of a dummy hash for which no pre-image is know is probably
not sensitive, but zeroize it anyway.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-27 10:32:04 +01:00
Manuel Pégourié-Gonnard
81ecc37372 PK: clarify comment about key export
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-27 10:32:04 +01:00
Manuel Pégourié-Gonnard
bc69abd2cb PK: use existing macros and functions
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-27 10:32:04 +01:00
Bence Szépkúti
1937efdd94 Merge pull request #10615 from gilles-peskine-arm/generate-psa_test_wrappers-3.6
Backport 3.6: generate psa test wrappers
2026-02-26 13:44:15 +00:00
Ronald Cron
7d022d3275 ssl-opt.sh: DTLS fragmenting: Do not check for ServerKeyExchange fragmentation
In DTLS fragmenting tests, do not check for
ServerKeyExchange message fragmentation as
depending on the configuration and consequently
the chosen ciphersuite the server may not
send the message.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-25 20:18:19 +01:00
Ronald Cron
6b529ff50d component_test_tls1_2_ccm_psk_dtls_psa: Enable MBEDTLS_HAVE_TIME
As done in component_test_tls1_2_ccm_psk_dtls_legacy
enable MBEDTLS_HAVE_TIME in
component_test_tls1_2_ccm_psk_dtls_psa.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-25 17:49:53 +01:00