Commit Graph

13915 Commits

Author SHA1 Message Date
Gilles Peskine
a314ada082 Merge pull request #10631 from yiwu0b11/destdir_install_env_support
Support DESTDIR for install and add build-system test
2026-04-29 14:37:29 +00:00
Valerio Setti
ae8579f2a2 Merge pull request #10650 from valeriosetti/fix-tls13-guard
check_config: add missing check for TLS 1.3 key exchanges
2026-04-24 14:32:36 +00:00
Valerio Setti
51b62060de Merge pull request #10639 from valeriosetti/ecdhe-rsa-fix-check
library: check_config: remove RSA encryption requirement from ECDHE-RSA
2026-04-24 07:30:47 +00:00
Valerio Setti
c3d52b905b check_config: fix error message for missing TLS 1.2 key exchanges
Align the error message to the one used for the same check in TLS 1.3.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-22 15:00:55 +02:00
Valerio Setti
5ea77200d9 check_config: add check for TLS 1.3 key exchanges
When MBEDTLS_SSL_PROTO_TLS1_3 is enabled ensure that at least one of the
related key exchanges is also enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-22 15:00:54 +02:00
Viktor Sokolovskiy
f90e81c7f8 Pacify uncrustify
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-18 01:51:17 +03:00
Viktor Sokolovskiy
3d61c38ea0 ssl: add TLS 1.2 RSA-PSS debug trace
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-17 17:36:31 +03:00
Viktor Sokolovskiy
2168fe9cda ssl: narrow TLS 1.2 RSA-PSS handling and add interop coverage
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-16 04:36:48 +03:00
Viktor Sokolovskiy
f75c033ead ssl: add TLS 1.2 RSA-PSS regression coverage
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-07 20:20:09 +03:00
Viktor Sokolovskiy
c064ba0edb ssl: accept TLS 1.2 rsa_pss_rsae signature schemes
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-04 03:57:04 +03:00
Minos Galanakis
e89565f92a Bump version
./scripts/bump_version.sh --version 4.1.0 \
  --so-crypto 18 --so-tls 23 --so-x509 9

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-26 22:34:28 +00:00
Minos Galanakis
308e7fb232 Merge remote-tracking branch 'restricted/development-restricted' into mbedtls-4.1.0.rc3
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-26 22:18:31 +00:00
Ronald Cron
1330606ca1 dtls: Fix adaptation to first ClientHello
For each received ClientHello fragment, check
that its epoch is zero and update the
record-level sequence number.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:45:24 +01:00
Ronald Cron
1141cd0fb6 Improve comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:45:24 +01:00
Ronald Cron
f2f44a9c9f Restrict mapping of UNEXPECTED_RECORD to UNEXPECTED_MESSAGE
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:45:24 +01:00
Ronald Cron
c9264ad227 dtls: Fix log level
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
140ebea442 dtls: parse_client_hello: Adapt mbedtls_ssl_read_record() error code
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
f9b7441542 dtls: Keep invalid/unexpected record header error code
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
0c301a686a dtls: Improve comment
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
912ef74195 Update buffering when adapting to ClientHello message_seq
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
16c5dd99b3 Introduce ssl_buffering_shift_slots
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
676d74e4c7 dtls: Error out on invalid/unexpected record header
Error out on invalid/unexpected record header
when reading the DTLS 1.2 ClientHello.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Ronald Cron
315c970fbe dtls: Fix debug log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-25 08:44:16 +01:00
Valerio Setti
52379636c5 library: check_config: remove RSA encryption requirement from ECDHE-RSA
ECDHE-RSA only requires RSA signature, not encryption. This commits fixes
guards in "mbedtls_check_config.h".

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-19 17:50:26 +01: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
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
Janos Follath
6714b39017 Improve ssl_parse_signature_algorithm
Simplify and improve error reporting and remove unnecessary
initialisation (the caller is responsible for initialising those
values).

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:28:36 +00:00
Janos Follath
5ffef28971 Fix code style
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:28:36 +00:00
Janos Follath
7b255e3a12 ssl_parse_signature_algorithm: match error codes
The caller is returning MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER if
ssl_parse_signature_algorithm() fails, but
ssl_parse_signature_algorithm() returns
MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE upon failure. There is no good reason
for this mismatch and better to be aligned.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:28:36 +00:00
Janos Follath
c46eccf6ef ssl_parse_signature_algorithm: caller to get bytes
After the recent refactoring ssl_parse_signature_algorithm() sends an
alert on failure, but the caller also sends an alert on failure. Sending
two alerts is at least a protocol violation, and might not leave the SSL
context in a good state.

It is simpler to have the caller read the two bytes, and pass them to
this function.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:28:36 +00:00
Janos Follath
3d02353281 Fix code style
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:28:36 +00:00
Janos Follath
e8894974cb Reintroduce ssl_parse_signature_algorithm
The logic was easier to follow before 693a47a, which removed the
ssl_parse_signature_algorithm function and introduced the bug being
fixed in this PR.

When validating multiple conditions, it's easier to read, easier to
debug and, as we can see, easier to get right if you validate them
separately.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
d7b85b76a6 sig_algs: fix typo in client's sig_algs check
This bug caused the client accepting sig_algs used by the server that
it explicitly wanted to disallow.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:26:21 +00:00
Manuel Pégourié-Gonnard
d8868c432f Merge pull request #1486 from ronald-cron-arm/tls12-2nd-client-hello
Fix TLS 1.2 client hello after HRR
2026-03-16 10:58:50 +01: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
b9ff81c4c5 Merge remote-tracking branch 'development' into merge-development-restricted-20260311 2026-03-11 12:32:56 +01: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
Manuel Pégourié-Gonnard
fe2599ea82 Merge pull request #1487 from davidhorstmann-arm/fix-null-pointer-dereference
Fix null pointer dereference in `mbedtls_x509_string_to_names()`
2026-03-09 12:43:08 +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
Gilles Peskine
cf02249039 Merge remote-tracking branch 'development' into merge-development-restricted-20260309 2026-03-08 20:24:58 +01:00
Yi Wu
b6ef9ec78f Support DESTDIR for install and add build-system test
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-03-05 17:32:51 +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
Gilles Peskine
3d4b7cd3f9 Merge remote-tracking branch 'development' into development-restricted 2026-03-03 19:00:20 +01:00