Commit Graph

34364 Commits

Author SHA1 Message Date
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
Ronald Cron
ade56554a6 Revert "ssl_server2.c: DTLS: Attempt to read the response to the close notification"
This reverts commit 2e9b9681e6.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-24 18:38:37 +01:00
Ronald Cron
9f19fe1874 Merge pull request #1466 from yanesca/1445_fix_signature_algorithm_injection
Fix signature algorithm injection
2026-03-17 17:10:00 +01:00
Ronald Cron
a08cff3d40 Merge pull request #1483 from ronald-cron-arm/context_load_and_session_load_documentation
Tighten context/session load and save APIs documentation
2026-03-17 14:11:39 +01:00
Ronald Cron
ccea2fd244 Improve change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-17 11:06:04 +01:00
Ronald Cron
894cea1fa2 Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-16 15:03:12 +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
703c2a6d7c Fix a typo and an oversight
DEBUG_C supposed to have been removed from the test dependencies, still
being there is an oversight. Removing it was the sole purpose of
3e58109fbd.

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
862c191f4f send_invalid_sig_alg: reduce debug dependency
Run as much of the test as we can even in the abscence of
MBEDTLS_DEBUG_C.

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
8d21dbf8e8 Fix dependencies
The unit test framework always loads the client key as well, which
requires a different curve and a hash than the server key.

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
75092c8262 send_invalid_sig_alg: add baseline test
Add a test case with a successful handshake for each test case that
causes the desired handshake failure, with minimal differences between
the two.

The reason is to have more assurance that the handshake is failing for
the desired reason (as opposed to not having done something correctly in
the test code).

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:28:34 +00:00
Janos Follath
6394676a74 Fix test case dependency
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
c139e44935 Fix typos
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
6cb0d86f16 Fix some compile time guards
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
305aef1ad7 send_invalid_sig_alg: check logs
There are other issues that can fail with the same error code. Make sure
that the handshake fails exactly the way we want it to fail by analysing
the client logs.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
971309addf Use API function to set sig_alg config in test
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
25f971db87 Fix the MBEDTLS_TEST_HAS_ADDITIONAL_HASH macro
It should require a hash that is configured in TLS 1.2 SSL contexts by
default.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +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
f68d402029 sig_algs: add ChangeLog
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:21 +00:00
Janos Follath
475ac34e1f sig_algs: Add non-regression test
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:27:18 +00:00
Janos Follath
bab37f69d9 Fix mbedtls_test_free_handshake_options
We usually follow the pattern that a zero-initialised struct is safe to
free. This wasn't the case here.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:26:21 +00:00
Janos Follath
01f6ccf020 Fix root cert prerequisites
This root certificate uses SECP-384 and if we don't have it in the
build, the parsing already fails even if we don't try to use it, there
is no reason to have it in the build without the SECP-384.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:26: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
Gilles Peskine
cb4d172ce0 Merge pull request #1507 from gilles-peskine-arm/merge-development-restricted-20260311
Merge public development with tf-psa-crypto directory reorg prep
2026-03-11 16:04:01 +01:00
Gilles Peskine
f51e72ab2d Update tf-psa-crypto to development
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-11 12:35:30 +01:00
Gilles Peskine
b9ff81c4c5 Merge remote-tracking branch 'development' into merge-development-restricted-20260311 2026-03-11 12:32:56 +01:00
Ronald Cron
622b69d1d0 Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 19:24:19 +01:00
Ronald Cron
759895e7df tls13_hrr_then_tls12_second_client_hello: Improve client and server state checks
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 19:24:19 +01:00
Ronald Cron
139ac457ab tls13_hrr_then_tls12_second_client_hello: Improve some comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 19:24:13 +01: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
e051abd5e3 tls13_hrr_then_tls12_second_client_hello: Various improvements
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 15:43:46 +01: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
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
Manuel Pégourié-Gonnard
b6c3aa7f31 Merge pull request #1502 from gilles-peskine-arm/merge-development-restricted-20260309
Merge development public into restricted (ready for fork fix)
2026-03-09 10:13:38 +01: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