Commit Graph

34336 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
497abfa776 Merge pull request #10644 from minosgalanakis/mbedtls-release-sync
MbedTLS 4.1.0 release-sync
2026-03-17 19:16:45 +00:00
Minos Galanakis
831ea1e621 Updated tf-psa-crypto pointer
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-17 16:47:55 +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
Manuel Pégourié-Gonnard
d7f2a4cdc6 Merge pull request #10591 from valeriosetti/replace-legacy-rsa-symbols
library: replace `MBEDTLS_RSA_C` with `PSA_WANT`
2026-03-17 10:35:15 +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
David Horstmann
0862cf31b5 Merge pull request #10640 from davidhorstmann-arm/add-unused-fields-to-structs
Add unused fields to structs
2026-03-16 14:40:03 +00: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
Valerio Setti
ae885590fb library: bulk replace MBEDTLS_RSA_C with PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC
Follow the same pattern that was used in the past to remove dependency
on MBEDTLS_RSA_C and use PSA_WANT instead.

Relying on MBEDTLS_RSA_C is fine only when builtin drivers are compiled
since all PSA_WANT are converted to legacy build symbols. However when
builtin drivers are not built (ex: in case of TF-M), then part of the code
in TLS/X509 won't be compiled because MBEDTLS_RSA_C is not set. OTOH
it's not possible to declare that symbol in a configuration file because
it's a legacy one and it will be rejected by buildtime checks.

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
a9ba5975f8 Add unused field to mbedtls_x509_crt structure
This field reserves a small space for us to repurpose in the lifetime
of the 4.1 LTS release without breaking the ABI, if needed.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-13 15:19:11 +00:00
David Horstmann
22245cb294 Add unused fields to SSL structs
These fields reserve a small space for us to repurpose in the lifetime
of the 4.1 LTS release without breaking the ABI, if needed.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-13 15:16:35 +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
Valerio Setti
488dbf8bcb Merge pull request #10638 from valeriosetti/x509-fix-ecp-guard
library: x509: fix guard in mbedtls_x509_crt_profile_next
2026-03-13 14:21:04 +00:00
Valerio Setti
95f0885507 library: x509: fix guard in mbedtls_x509_crt_profile_next
Replace MBEDTLS_ECP_C with PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY which is
already used in all other profiles in this file.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-13 12:01:18 +01:00
Gilles Peskine
931fc8c406 Update massif_max.pl location
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-12 15:49:21 +01: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
c4d40c2de3 Move requirements to the framework for scripts in the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-12 10:18:52 +01:00
Gilles Peskine
702b389645 Update framework with moved scripts
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
David Horstmann
624fc2e0de Move TLS 1.3 verify-result setting for PSK
When we are doing PSK, we'd like to set verify_result to
MBEDTLS_X509_BADCERT_SKIP_VERIFY. 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-10 15:12:47 +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
09210ea54f 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:12:55 +01:00
Ronald Cron
7f40da187c 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 08:25:21 +01:00
Ronald Cron
65a038198e Improve comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 23:28:50 +01:00
Gilles Peskine
11d1f51631 Merge pull request #10464 from bensze01/abicheck-port
Move abi_check.py to the framework
2026-03-09 13:57:04 +00:00
Valerio Setti
109ce5e687 Merge pull request #10617 from ronald-cron-arm/tf-psa-crypto-reorg-prep
Prepare for TF-PSA-Crypto repository reorganization
2026-03-09 11:49:28 +00:00
Ronald Cron
bef136e607 Update framework pointer to the merge of PR 280
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:30:07 +01: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
325170b962 legacy.make: Add globs and paths for tags and cscope
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
Ronald Cron
ae82217476 programs: metatest: Add tf-psa-crypto/platform as include dir
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
1ef64a73e4 programs: metatest: Remove include path duplication
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Gilles Peskine
65da2a38bf Merge pull request #10606 from gilles-peskine-arm/unix-detection-202601-4.0
Simplify platform requirements before 4.1
2026-03-06 18:06:08 +00:00
Gilles Peskine
b38e28dbf0 Make sure we declare TF-PSA-Crypto platform requirements before including system headers
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:54:35 +01:00
Gilles Peskine
037f3c62ff Tell MSVC to allow non-s functions where needed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:32:18 +01:00
Gilles Peskine
37fd7d5210 Start from a clean baseline for C11 ext1 and POSIX features
Define `_POSIX_C_SOURCE` and `_XOPEN_SOURCE` in a single place that
applies everywhere, to make things simple.

This may break some platforms that require special handling for POSIX
functions and types. Subsequent commits will add platform-specific hacks
as needed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:32:18 +01:00
Gilles Peskine
e8dec9c031 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-04 11:32:18 +01:00