31145 Commits

Author SHA1 Message Date
Gilles Peskine
4002e6fdee Merge remote-tracking branch 'mbedtls-3.6' into mbedtls-3.6-restricted 2024-08-23 11:15:11 +02:00
Gilles Peskine
86a4c25136
Merge pull request #9499 from waleed-elmelegy-arm/fix-legacy-compression-issue-3.6
[Backport 3.6] Fix issue in handling legacy_compression_methods in ssl_tls13_parse_client_hello()
2024-08-22 18:23:33 +00:00
Gilles Peskine
df0ef8a624
Merge pull request #9281 from mpg/rsapub
[3.6] Reduce performance regression in RSA public operations
2024-08-22 16:50:38 +00:00
Waleed Elmelegy
8ac9caf89b Fix the capitalisation in the changelog entry
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 16:42:18 +00:00
Waleed Elmelegy
d930a3e950 Reduce the wording in changelog entry
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 16:39:39 +00:00
Waleed Elmelegy
5183e1ab17 Improve the changelog entry for fixing legacy compression issue
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 16:39:21 +00:00
Waleed Elmelegy
f669fef856 Add chanelog entry for fixing legacy comprssion methods issue
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 16:15:06 +00:00
Waleed Elmelegy
1297309fdb Remove redundant legacy compression test
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:46 +00:00
Waleed Elmelegy
38c8757b2c Improve legacy compression regression testing
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:46 +00:00
Waleed Elmelegy
790f3b16d4 Add regression testing to handling Legacy_compression_methods
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:45 +00:00
Waleed Elmelegy
a1c4f4cab6 Improve comments explaining legacy_methods_compression handling
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:45 +00:00
Waleed Elmelegy
3918598e52 Correct a small typo in ssl_tls13_parse_client_hello()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:45 +00:00
Waleed Elmelegy
566ed54d6e Improve handling of legacy_compression_methods in ssl_tls13_parse_client_hello()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:45 +00:00
Waleed Elmelegy
41e0cdf8c1 Fix issue in handling legacy_compression_methods in ssl_tls13_parse_client_hello()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-22 15:50:45 +00:00
Janos Follath
4c857c49b4 Fix Changelog formatting
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-22 15:45:18 +01:00
David Horstmann
d8d5353218
Merge pull request #1279 from gilles-peskine-arm/memory_allocation_cleanup_psa_crypto_rsa-changelog-3.6
Backport 3.6: Changelog entry for the RSA memory leak (+ extra changelog fixes)
2024-08-22 15:45:07 +01:00
Janos Follath
5f316972b2 Add header for mbedtls_mpi_exp_mod_unsafe()
To silence no previous prototype warnings. And this is the proper way to
do it anyway.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-22 15:00:09 +01:00
Janos Follath
5d16334e84
Improve ChangeLog
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-22 14:49:58 +01:00
Manuel Pégourié-Gonnard
273d07b0c0
Merge pull request #9240 from gilles-peskine-arm/psa-keystore-dynamic-3.6
Backport 3.6: dynamically sized key store
2024-08-22 12:53:32 +00:00
Janos Follath
82976f3548 Make mbedtls_mpi_exp_mod_unsafe internal
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-22 13:00:12 +01:00
Janos Follath
6c2086931d Add changelog
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-22 12:59:36 +01:00
Elena Uziunaite
d2cb074a3a Tiny fix in ChangeLog pt 2
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-08-22 13:05:34 +02:00
Elena Uziunaite
c3ed44cc3b Tiny fix in ChangeLog
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-08-22 13:05:28 +02:00
Gilles Peskine
58da249465 Changelog entry for the RSA memory leak
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-22 13:00:57 +02:00
minosgalanakis
7be977a7a7
Merge pull request #9486 from sergio-nsk/sergio-nsk/3.6/lean_and_mean/1
[Backport 3.6] Fix Mbed-TLS build when WIN32_LEAN_AND_MEAN macro is defined globally
2024-08-22 10:08:11 +00:00
Gilles Peskine
11cac75449 Simplify and explain the overflow check for maximum slice length
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-22 10:55:40 +02:00
Manuel Pégourié-Gonnard
6298d73f5e
Merge pull request #1265 from mpg/refactor-tls123-verif
[3.6] Refactor TLS 1.2/1.3 certificate verification code
2024-08-21 23:42:14 +02:00
Manuel Pégourié-Gonnard
7e551a2bba
Merge pull request #1263 from mpg/fix-tls13-optional-ku
[3.6] Fix 1.3 cli-auth optional reporting of (ext)KeyUsage issues
2024-08-21 23:40:40 +02:00
David Horstmann
9183ba1179 Add overflow check for maximum key slot length
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-21 17:05:37 +01:00
David Horstmann
43124912c5 Tweak macro check to allow 3 extra key slices
We are technically allowed to use all possible values of key slice index
that will fit into the bit width we have allocated, so allow all values.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-21 15:18:28 +01:00
David Horstmann
a8e13d7c2a Fix incorrect comments on slice numbering
The persistent key cache slice is the last slice (not the first as
previously stated). Update the numbering-related comments accordingly.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-21 14:41:06 +01:00
Manuel Pégourié-Gonnard
f4f3e92ac9 Add a ChangeLog entry
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
c32a4a2128 Fix guards around function now used by 1.3 as well
Actually moved the function rather than trying to edit guards around it,
because the relevant guards are not nearby, the function was part of
larger blocks, so it seemed risky.

Also, that seems logically correct: the function is no longer part of
the "TLS 1.2 handshake functions common to server and client" section,
it's part of the "helper functions common to 1.2 and 1.3 server and
client" block. Ideally in the future perhaps the file structure should
reflect that (`ssl_generic.c` vs `ssl_tls12_generic.c`?) but that's out
of scope here.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
565da768a4 Fix typos in comments
Co-authored-by: David Horstmann <david.horstmann@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
ff28e4c7f4 Fix two dependency declarations in ssl-opt
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
f2aa65fd57 Improve some comments
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
ce60330dfb Merge 1.2 and 1.3 certificate verification
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
d37054c824 Minor refactoring of generic SSL certificate verif
Rename as there was a name collision with a static function in another
file: ssl_parse_certificate_verify in ssl_tls12_server.c is the function
that parses the CertificateVerify message, which seems appropriate. Here
it meant "the 'verify' step after parsing the Certificate message".
Use a name that focuses on what it does: verify, not parse.

Also, take ciphersuite_info as an argument: when TLS 1.3 calls this
function, it can pass NULL as the ciphersuite has no influence there.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
dee6ffa961 Add support for context f_vrfy callback in 1.3
This was only supported in 1.2 for no good reason.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
e910ac8627 Improve a variable's name
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
523a7e4aaf Restrict the scope of a few variables
In particular, make sure pointer variables are initialized right after
being declared.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Ronald Cron
8d5da8f4a3 ssl-opt.sh: Test trusted certificate callback in TLS 1.3
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Ronald Cron
cb7f63266f tls13: Add support for trusted certificate callback
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Ronald Cron
84442a3bff ssl-opt.sh: Fix test case titles
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
2b98a4ee3b Allow no authentication of the server in 1.3
See notes about optional two commits ago for why we're doing this.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
a0a781eadd Reorder some tests in ssl-opt.sh
The tests above are required then optional then none. Follow the same
pattern here.

Just moving things around (see git's --color-moved option).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
e1cc926717 Allow optional authentication of the server in 1.3
This is for compatibility, for people transitioning from 1.2 to 1.3.
See https://github.com/Mbed-TLS/mbedtls/issues/9223 "Mandatory server
authentication" and reports linked from there.

In the future we're likely to make server authentication mandatory in
both 1.2 and 1.3. See https://github.com/Mbed-TLS/mbedtls/issues/7080

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
4d4c0c72da Add comments about 1.3 server sending no cert
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
85b864e1db Rm translation code for unused flag
We don't check the non-standard nsCertType extension, so this flag can't
be set, so checking if it's set is useless.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00
Manuel Pégourié-Gonnard
8a14aaaca5 Simplify certificate curve check for 1.2
The comments were about the time we were using mbedtls_pk_ec(), which
can return NULL, which we don't want to propagate to other functions.

Now we're using mbedtls_pk_get_ec_group_id() with is a safer interface
(and works even when EC is provided by drivers).

The check for GROUP_NONE was an heritage from the previous NULL check.
However it's actually useless: if NONE were returned (which can't happen
or parsing of the certificate would have failed and we wouldn't be
here), then mbedtls_ssl_check_curve() would work and just say that the
curve wasn't valid, which is OK.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-08-20 22:03:10 +02:00