1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-06-15 00:45:50 +08:00

32762 Commits

Author SHA1 Message Date
David Horstmann
5ea94e6cd1 Add changelog entry for TLS 1.2 Finished fix
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-03-11 15:52:48 +00:00
David Horstmann
816b712680 TLS1.2: Check for failures in Finished calculation
If the calc_finished function returns an error code, don't ignore it but
instead return the error code to stop the handshake as the Finished
message may be incorrect.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-03-07 17:20:59 +00:00
David Horstmann
b58618a869
Merge pull request #1314 from gilles-peskine-arm/ssl-hostname-unset-reject-dev
Require setting the hostname for verification
2025-03-05 17:58:59 +00:00
Gilles Peskine
fd89acc735 ssl_session_reset: preserve HOSTNAME_SET flag
When we don't reset `ssl->hostname`, we must not reset the
`MBEDTLS_SSL_CONTEXT_FLAG_HOSTNAME_SET` flag either.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
eb2d29eb6b Document the need to call mbedtls_ssl_set_hostname
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
96073fb997 Improve documentation of mbedtls_ssl_set_hostname
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
02e303ec86 Changelog entries for requiring mbedls_ssl_set_hostname() in TLS clients
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
825c3d075a Add a note about calling mbedtls_ssl_set_hostname to mbedtls_ssl_setup
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
640512eb90 mbedtls_ssl_set_hostname tests: add tests with CA callback
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
856a370628 Call mbedtls_ssl_set_hostname in the generic endpoint setup in unit tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
488b91929d Require calling mbedtls_ssl_set_hostname() for security
In a TLS client, when using certificate authentication, the client should
check that the certificate is valid for the server name that the client
expects. Otherwise, in most scenarios, a malicious server can impersonate
another server.

Normally, the application code should call mbedtls_ssl_set_hostname().
However, it's easy to forget. So raise an error if mandatory certificate
authentication is in effect and mbedtls_ssl_set_hostname() has not been
called. Raise the new error code
MBEDTLS_ERR_SSL_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME, for easy
identification.

But don't raise the error if the backward compatibility option
MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME is
enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
59a5117072 Create error code for mbedtls_ssl_set_hostname not called
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:48:49 +01:00
Gilles Peskine
434016e2eb Keep track of whether mbedtls_ssl_set_hostname() has been called
No behavior change apart from now emitting a different log message depending
on whether mbedtls_ssl_set_hostname() has been called with NULL or not at all.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-24 18:47:44 +01:00
Gilles Peskine
4ac4008fa0 Access ssl->hostname through abstractions in certificate verification
New abstractions to access ssl->hostname:
mbedtls_ssl_has_set_hostname_been_called(), mbedtls_ssl_free_hostname().

Use these abstractions to access the hostname with the opportunity for
extra checks in mbedtls_ssl_verify_certificate().

No behavior change except for a new log message.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 19:24:16 +01:00
Gilles Peskine
e5054e495a mbedtls_ssl_set_hostname tests: baseline
Test the current behavior.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 19:24:16 +01:00
Gilles Peskine
95fe2a6df4 Add a flags field to mbedtls_ssl_context
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 19:24:16 +01:00
Gilles Peskine
58b399e81e Automate MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 18:51:14 +01:00
Gilles Peskine
eb63613347 Make guards more consistent between X.509-has-certs and SSL-has-certs
Fix some build errors when MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED is false
but MBEDTLS_X509_CRT_PARSE_C is enabled. This is not a particularly useful
configuration, but for quick testing, it's convenient for it to work.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 18:51:14 +01:00
Gilles Peskine
86a66edcd0 Fix Doxygen markup
Pacify `clang -Wdocumentation`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 18:51:14 +01:00
Gilles Peskine
aa2594a52e Make ticket_alpn field private
An omission in 3.x.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 18:51:14 +01:00
Ronald Cron
03e704018a
Merge pull request #9917 from valeriosetti/issue9685
[development] Remove the DHE-RSA key exchange
2025-02-09 11:43:50 +00:00
Valerio Setti
bfc1ec15e6 tf-psa-crypto: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-07 17:48:11 +01:00
Valerio Setti
683e49e781 framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-07 17:47:59 +01:00
Valerio Setti
c8cac1d22f changelog: add note abot DHE-RSA removal
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:12:02 +01:00
Valerio Setti
1494a09ff7 test_suite_ssl: require GCM or ChaChaPoly in handshake_serialization()
Hanshake serialization requires that the selected ciphersuite uses
an AEAD algorithm. However, following the DHE-RSA removal, trying to
still use RSA signature might select a ciphersuite which is not using
AEAD, but CBC instead (see preference order in "ssl_ciphersuite.c").

This is especially problematic in tests scenarios where both GCM and
ChaChaPoly are disabled, so that CCM remains as the only AEAD algorithm.
Ciphersuites using RSA signature and CCM are very low on the preference
list, so very unlikely to be picked in tests. This cause a CBC one to
be selected in this case and the handshake_serialization() function
to fail.

In order to prevent failures from happening, in this commit we require
that either GCM or ChaChaPoly are enabled, so that ciphersuites using one
of these are likely to be picked.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:12:02 +01:00
Valerio Setti
d137f15e1b mbedtls_config.h: remove definition of MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:12:02 +01:00
Valerio Setti
f886924eec docs: remove references to DHE-RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:12:01 +01:00
Valerio Setti
02ae66830e check_config.h: remove checks for DHE-RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Valerio Setti
8438c637ee tests: remove references to DHE-RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Valerio Setti
b7e2eccf1f ssl_ciphersuites: remove MBEDTLS_KEY_EXCHANGE_SOME_XXDH_1_2_ENABLED
This symbol is unused in the code so it can be removed.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Valerio Setti
b8621b6f9d ssl_ciphersuites: remove references to DHE-RSA key exchanges
In this commit also MBEDTLS_KEY_EXCHANGE_SOME_DHE_ENABLED is removed.
This cause some code in "ssl_ciphersuites_internal.h" and
"ssl_tls12_server.c" to became useless, so these blocks are removed
as well.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Valerio Setti
89743b5db5 ssl_tls: remove code related to DHE-RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Valerio Setti
98f348a2c5 ssl-opt.sh|compat.sh: remove references to DHE-RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Ronald Cron
0baf3611e6
Merge pull request #9940 from valeriosetti/issue94-development
[Development] Move test_psa_*.py scripts to the framework
2025-02-05 13:55:38 +00:00
Valerio Setti
c96d75bba3 framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:05:01 +01:00
Valerio Setti
da1673c013 components-compliance.sh: update references to test_psa_compliance.py
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:04:36 +01:00
Valerio Setti
2ef55352e8 components-configuration.sh: update references to test_psa_constant_names.py
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:04:36 +01:00
Valerio Setti
40e14a7559 Move files out of Mbed TLS
The following files are moved to the framework repo (deleted here):

tests/scripts/test_psa_compliance.py
tests/scripts/test_psa_constant_names.py

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:04:36 +01:00
David Horstmann
be658c47c8
Merge pull request #9938 from bjwtaylor/ssl-ticket-api
Move ssl_ticket to the PSA API
2025-02-05 10:41:09 +00:00
Ronald Cron
7b4b176aca
Merge pull request #9908 from Harry-Ramsey/move-configs-to-tf-psa-crypto
Move configs to TF-PSA-Crypto
2025-02-04 17:42:04 +00:00
Ben Taylor
7d4c48ba4f fixed trailing whitespace
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-02-04 15:27:53 +00:00
Harry Ramsey
94c386a8ea Update config paths in scripts
This commit updates the moved config paths in multiple script files.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-04 12:54:15 +00:00
Harry Ramsey
c89fa17ba3 Update configs README
This commit updates configs/ext/README.md to reflect the necessary files
which were removed from Mbed TLS.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-04 12:54:15 +00:00
Harry Ramsey
6e5dfa851c Move crypto configs to TF-PSA-Crypto
This commit moves config-symmetric-only.h,
crypto-config-ccm-aes-sha256.h and crypto_config_profile_medium.h to
TF-PSA-Crypto.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-04 12:54:15 +00:00
Ronald Cron
2a992bf39b
Merge pull request #9915 from Harry-Ramsey/move-ssl-macros-development
Move MbedTLS Macros
2025-02-04 10:25:05 +00:00
Ben Taylor
b6fb07bc48 Change Changelog entry to a maximum of 80 charactors
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-02-04 09:08:02 +00:00
Harry Ramsey
93a496e877 Update framework pointer
This commit updates the framework pointer to include changes to enable
check_names.py to run independently for TF-PSA-Crypto and Mbed TLS.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-04 08:13:14 +00:00
Harry Ramsey
285722a3fe Update TF-PSA-Crypto pointer
This commit updates the TF-PSA-Crypto pointer to include the moved
config files.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-04 08:13:11 +00:00
Ben Taylor
837130cf65 Improve Changelog and correct alg selection
Improve the description of the API changes in the changelog and
fix some incorrect alg selection variables in ssl_server2.c.

Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-02-04 07:50:19 +00:00
Ben Taylor
d0498803a1 Correct typos in comments
Correct the typos in the mbedtls_ssl_ticket_setup function docs

Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-02-03 11:35:34 +00:00