32767 Commits

Author SHA1 Message Date
Janos Follath
5b5e3ba75b Fix ssl_parse_signature_algorithm guards
In 3.6 we still have RSA key exchange and the existing preprocessor
guards are insufficient. Use the same macro to guard the definition that
guards the call.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:39:01 +00:00
Janos Follath
b353e92c2b 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:39:01 +00:00
Janos Follath
c07cc0e36b 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:39:01 +00:00
Janos Follath
1f938bc20f Fix code style
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:39:01 +00:00
Janos Follath
28886c543e 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:39:01 +00:00
Janos Follath
d91902c9d6 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:39:01 +00:00
Janos Follath
4d70ce2f13 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:39:01 +00:00
Janos Follath
51ea7aca6f 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:39:01 +00:00
Janos Follath
e50420a2dd Fix code style
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:39:01 +00:00
Janos Follath
03a9c87895 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:38:59 +00:00
Janos Follath
4d2027b271 Fix test case dependency
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:38:21 +00:00
Janos Follath
0ab0d7c170 Fix typos
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:38:21 +00:00
Janos Follath
2b696cd84f Fix some compile time guards
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:38:21 +00:00
Janos Follath
cd0b3f34b6 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:38:21 +00:00
Janos Follath
b34279950d Use API function to set sig_alg config in test
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:38:21 +00:00
Janos Follath
3549b6f4a8 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:38:20 +00:00
Janos Follath
fcb70427f8 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:38:20 +00:00
Janos Follath
238976c73a sig_algs: add ChangeLog
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:38:20 +00:00
Janos Follath
27c0aa0b3e sig_algs: Add non-regression test
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-03-16 12:38:17 +00:00
Janos Follath
94116eddb8 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:37:49 +00:00
Janos Follath
a51506b3f0 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:37:49 +00:00
Janos Follath
0165a8d763 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:37:49 +00:00
Minos Galanakis
ebe26fd095 test_suite_psa_crypto: Fixed a typo in documentation
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-16 11:54:39 +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
0d48c34169
Merge pull request #1490 from ronald-cron-arm/tls12-2nd-client-hello-3.6
Backport 3.6: Fix TLS 1.2 client hello after HRR
2026-03-16 10:58:44 +01:00
Gilles Peskine
d05d789316 grammar
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-15 19:53:48 +01:00
Gilles Peskine
e6efd3e406 Match macro definition order with order in mbedtls_entropy_init
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-15 19:52:16 +01:00
Gilles Peskine
900b7dc5ac Test that the compile-time and run-time entropy source counts match
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-15 19:52:16 +01:00
Gilles Peskine
909055d760 Fix negation that broke psa_random_set_prediction_resistance
Platform entropy is available when `MBEDTLS_NO_PLATFORM_ENTROPY` is _not_
defined.

This caused the ok/not-supported behavior of `broke
psa_random_set_prediction_resistance() to be inverted, and the unit tests
checking that behavior to be similarly inverted, so the unit tests didn't
catch it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-15 19:32:39 +01:00
Manuel Pégourié-Gonnard
2d0aa97f81
Merge pull request #1501 from mpg/restricted-ffdh-peerkey-checks
[Backport 3.6] FFDH peer key checks
2026-03-13 12:44:30 +01:00
Manuel Pégourié-Gonnard
01b04ab723
Merge pull request #1489 from davidhorstmann-arm/fix-psa-ffdh-buffer-overflow-3.6
[Backport 3.6] Fix buffer overflow in FFDH public key export
2026-03-13 09:56:43 +01: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
Minos Galanakis
fa284db5a1 test_suite_psa_crypto: Updated multipart tests
- Added checks for calling `finish()`, `verify()` after
  `set_len()` without calling `update()` & `update_ad()`

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-12 16:23:24 +00:00
Minos Galanakis
5311a6e220 Updated mbedtls_ccm_finish_boundary to handle zero len tags
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-12 12:00:23 +00:00
Gilles Peskine
9d17d28dda More documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-12 12:39:16 +01:00
Minos Galanakis
e8a2499d4e ccm: Fixed a missing error flag assertion.
In ccm_calculate_first_block_if_ready when using ccm
tag_len==0 is invalid. When it fails, it will now also
assert the CCM_STATE__ERROR in the state machine's
context.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-12 11:09:31 +00:00
Minos Galanakis
8b50733a73 ccm: Re-ordered len checks in mbedtls_ccm_finish.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-12 11:09:31 +00:00
Minos Galanakis
66d57b0d7b test_suite_psa_crypto: Updated multipart tests
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-12 11:09:31 +00:00
Gilles Peskine
f05a711011 Minor documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-11 12:58:22 +01:00
Gilles Peskine
43afaa5343 Fix Doxygen warning in realfull config
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-11 12:21:18 +01:00
Minos Galanakis
e96de33867 psa_core: Added a retval in psa_aead_final_checks()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-11 10:30:57 +00:00
Minos Galanakis
0004fe7e96 test_suite_ccm: Updated input arguments
Key and iv are now test function internal arguments.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-11 10:30:56 +00:00
Gilles Peskine
d8ce52df19 Fix Doxygen comment start
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-11 10:48:58 +01:00
Gilles Peskine
409427eac4 Fix grammar
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-11 10:31:59 +01:00
Gilles Peskine
7cf7a85008 Add missing parenthetical remark
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-11 10:31:58 +01:00
Minos Galanakis
32caf3bad0 ccm: Fail when calling finish without ccm_starts
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-10 22:04:27 +00:00
Minos Galanakis
27069c6be6 test_suite_ccm.function: Fixed typo in docs
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-10 22:04:27 +00:00
Minos Galanakis
f447b0264a test_suite_psa_crypto: Extended aead_multipart_state_test(2)
This patch adds psa_aead_decrypt_setup() & psa_aead_finish()
path to the multipart_state_testing.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-03-10 22:04:27 +00:00
Ronald Cron
0be90b44e2 Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 19:26:14 +01:00
Ronald Cron
668e677faf 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:26:14 +01:00