31195 Commits

Author SHA1 Message Date
Manuel Pégourié-Gonnard
4bc15d89cb Fix guards on #include
The rest of the file uses mbedtls_mpi_uint_t unconditionally, so its
definition should also be #include'd unconditionally.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-02 11:12:09 +02:00
Manuel Pégourié-Gonnard
126cfedba4 Fix code style
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-02 10:42:46 +02:00
Janos Follath
0a75adcf4e Prepare codepath tests for early termination
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
e9cc10d2af Fix incorrect test result
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
96cfd7a77a Move bignum code path testing out of the library
Without this, it's not at all obvious that turning on MBEDTLS_TEST_HOOKS
doesn't change the functional behavior of the code.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
2f8ad595db Explain the choice of the value of MBEDTLS_MPI_IS_PUBLIC
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
e86607c498 Initial local variables to secure default
Unfortunately compilers aren't good at analyzing whether variables are
analyzed on all code paths, and it is better to initialize to the
safe-path values.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
42f72b3ea5 Introduce MBEDTLS_MPI_IS_TEST
A + B + 1 is not a good way to get a number that's neither A nor B.
This can be a problem for example if values later are changed to
A = 0 and B = -1.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
55be79b500 Add tests for optionally safe code paths in RSA
Only add the test hooks where it is meaningful. That is, not adding
where the operation is essentially the same or the target is not the
function that is being tested.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
Janos Follath
5fc20fc56a Add tests for optionally safe code paths in bignum
Not adding _unsafe version to the tests targeting behaviour related to
RR as it is independent from the secret involved in the safe/unsafe
distinction.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-02 10:30:47 +02:00
David Horstmann
aae8011eb0
Merge pull request #1288 from Mbed-TLS/mbedtls-3.6.1_mergeback
Mbedtls 3.6.1 mergeback
2024-08-30 13:38:02 +01:00
David Horstmann
fbc34eeb69 Revert "Add generated files"
This reverts commit 0d1117692ee261d6d89e2819a742c64e06e5bd42.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-30 11:03:51 +01:00
David Horstmann
71c569d44b
Merge pull request #1286 from Mbed-TLS/mbedtls-3.6.1rc0-pr
Mbedtls 3.6.1rc0 PR
v3.6.1 mbedtls-3.6.1
2024-08-30 10:11:54 +01:00
David Horstmann
4c8ca72a88 Move some ChangeLog entries to a different section
2 ChangeLog entries that were originally placed under "Changes" are
more appropriately placed under "Default behaviour changes".

Move these 2 entries to the correct section.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:58:24 +01:00
David Horstmann
fedf9a2096 Add CVE IDs to security ChangeLog
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
18f3bebb6f Update BRANCHES.md
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
0d1117692e Add generated files
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
ea44fa7f35 Finalise ChangeLog
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
1d2dcfce6f Bump version to 3.6.1
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
9cf929d421 Assemble ChangeLog
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
636367f757 Don't clean test_keys.h and test_certs.h
This is in keeping with other generated files (such as generated .data
files) that are added to releases.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
204c4b41f5 Fix typos in make clean target for Windows
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:56:16 +01:00
David Horstmann
9f10979853 Merge branch 'mbedtls-3.6-restricted' into mbedtls-3.6.1rc0-pr
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-08-28 20:48:27 +01:00
Gilles Peskine
72064b202e
Merge pull request #9507 from ronald-cron-arm/disable-new-session-tickets
3.6: Disable new session tickets at runtime
2024-08-28 18:20:56 +00:00
Ronald Cron
c46edd4423 Fix/Improve documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 18:15:36 +02:00
Ronald Cron
9f44c883f4 Rename some "new_session_tickets" symbols
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 17:47:46 +02:00
Ronald Cron
c9884b04ad Fix change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 16:36:07 +02:00
Ronald Cron
48a9f562ba Improve documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 13:36:43 +02:00
Ronald Cron
ba45a44f13 Move session tickets getter functions to ssl_misc.h
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 13:22:26 +02:00
Ronald Cron
31b40b3600 Add change logs
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 10:42:01 +02:00
Ronald Cron
97dc5832c5 Improve debug logs
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 10:42:01 +02:00
Ronald Cron
fc76718dcd Move MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET doc
Move MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET
error code documentation to the documentation of
mbedtls_ssl_read() as we cannot have long error
descriptions because of a limitation in
generate_errors.pl.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 10:42:01 +02:00
Ronald Cron
d67f801c63 Do not add a new field in the SSL config
We cannot add a new field in SSL config in
an LTS. Use `session_tickets` field instead.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 10:41:54 +02:00
Ronald Cron
57ad182644 ssl_client2: Fix new_session_tickets option parsing
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 10:30:24 +02:00
Ronald Cron
e55659d576 Document NewSessionTicket handling being disabled by default
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-28 10:30:17 +02:00
Ronald Cron
9df056390a Improve MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-27 18:04:44 +02:00
Ronald Cron
0e5d4fdfc5 Document MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-27 16:20:47 +02:00
Ronald Cron
23303a47f4 Enable TLS 1.3 ticket handling in resumption tests
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-27 16:20:40 +02:00
Ronald Cron
b675b2ba5d TLS 1.3: Ignore tickets if disabled at runtime
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-27 15:41:24 +02:00
Ronald Cron
bedddd707a Add mbedtls_ssl_conf_enable_new_session_tickets() API
Add mbedtls_ssl_conf_enable_new_session_tickets() API
to be able to enable and disable the handling of TLS 1.3
NewSessionTicket messages.

The TLS 1.2 equivalent function is named
mbedtls_ssl_conf_session_tickets() thus the most
natural name would have been
mbedtls_ssl_conf_new_session_tickets() but it is
already used on server side thus rather
mbedtls_ssl_conf_enable_new_session_tickets().

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-08-27 15:41:18 +02:00
Gilles Peskine
7defa41fb3
Merge pull request #9501 from gilles-peskine-arm/tls13-psa-init-auto-3.6
[3.6] TLS 1.3: call psa_crypto_init
2024-08-26 15:26:35 +00:00
Manuel Pégourié-Gonnard
8b8228ce2e
Merge pull request #1282 from gilles-peskine-arm/merge-3.6-restricted-20240823
Merge 3.6 into -restricted
2024-08-26 12:07:24 +02:00
Gilles Peskine
57dbd69945 TLS 1.3 server: move crypto_init after protocol negotiation
This reduces the workflows where psa_crypto_init is called when not
necessary: it won't be called when a dual-version server receives a 1.2-only
ClientHello.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-26 12:04:39 +02:00
Gilles Peskine
aa6ef7da50 Changelog entry for psa_crypto_init potentially being called from TLS
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-26 12:01:31 +02:00
Gilles Peskine
92e803ea5b Clarify "negotiating"
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-26 11:59:48 +02:00
Gilles Peskine
50476272a9 Error translation and init are needed in PSK-only builds as well
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-26 09:28:41 +02:00
Gilles Peskine
069bccdf78 Call psa_crypto_init in the library when required for TLS 1.3
For backward compatibility with Mbed TLS <=3.5.x, applications must be able
to make a TLS connection with a peer that supports both TLS 1.2 and TLS 1.3,
regardless of whether they call psa_crypto_init(). Since Mbed TLS 3.6.0,
we enable TLS 1.3 in the default configuration, so we must take care of
calling psa_crypto_init() if needed. This is a change from TLS 1.3 in
previous versions, where enabling MBEDTLS_SSL_PROTO_TLS1_3 was a user
choice and could have additional requirement.

This commit makes the library call psa_crypto_init() when it needs PSA
crypto in a situation where the application might not have called it,
namely, when starting a TLS 1.3 connection.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-25 10:44:39 +02:00
Gilles Peskine
cd4da16eea Don't call psa_crypto_init in test programs when not required for TLS 1.3
For backward compatibility with Mbed TLS <=3.5.x, applications must be able
to make a TLS connection with a peer that supports both TLS 1.2 and TLS 1.3,
regardless of whether they call psa_crypto_init(). Since Mbed TLS 3.6.0,
we enable TLS 1.3 in the default configuration, so we must take care of
calling psa_crypto_init() if needed. This is a change from TLS 1.3 in
previous versions, where enabling MBEDTLS_SSL_PROTO_TLS1_3 was a user
choice and could have additional requirement.

This commit changes our test programs to validate that the library
does not have the compatibility-breaking requirement.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-25 10:44:39 +02:00
Gilles Peskine
5950301740 Don't call psa_crypto_init in unit tests when not required for TLS 1.3
For backward compatibility with Mbed TLS <=3.5.x, applications must be able
to make a TLS connection with a peer that supports both TLS 1.2 and TLS 1.3,
regardless of whether they call psa_crypto_init(). Since Mbed TLS 3.6.0,
we enable TLS 1.3 in the default configuration, so we must take care of
calling psa_crypto_init() if needed. This is a change from TLS 1.3 in
previous versions, where enabling MBEDTLS_SSL_PROTO_TLS1_3 was a user
choice and could have additional requirement.

This commit changes our unit tests to validate that the library
does not have the compatibility-breaking requirement.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-25 10:44:39 +02:00
Gilles Peskine
590bdcbddf Call psa_crypto_init in the library when required for TLS 1.3: doc
For backward compatibility with Mbed TLS <=3.5.x, applications must be able
to make a TLS connection with a peer that supports both TLS 1.2 and TLS 1.3,
regardless of whether they call psa_crypto_init(). Since Mbed TLS 3.6.0,
we enable TLS 1.3 in the default configuration, so we must take care of
calling psa_crypto_init() if needed. This is a change from TLS 1.3 in
previous versions, where enabling MBEDTLS_SSL_PROTO_TLS1_3 was a user
choice and could have additional requirement.

This commit removes the compatibility-breaking requirement from the
documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-25 10:44:39 +02:00