Commit Graph

2167 Commits

Author SHA1 Message Date
Ronald Cron
39813964ef ssl_tls.c: Allow client hello fragmentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
86b7df5591 ssl_tls.c: Rename and expand ssl_tls13_get_hs_msg_name
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
David Horstmann
059fe77e4b Fix missing type conversion in the TLS-Exporter
In the TLS-Exporter for TLS 1.3 we mistakenly call PSA_HASH_LENGTH() on
an mbedtls_md_type_t when it should be called on a psa_algorithm_t.

Fortunately, these two types have almost the same values, since we have
previously aligned them to make conversion more efficient. As a result,
PSA_HASH_LENGTH() produces exactly the same value when called on an
mbedtls_md_type_t as with the equivalent psa_algorithm_t.

Thanks to this happy coincidence, fix a largely cosmetic issue (rather
than a major functional bug).

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-02-16 16:59:20 +00:00
Valerio Setti
2a72766d75 Merge pull request #10570 from valeriosetti/issue10349
mbedtls 4.x does not expose mbedtls_ecp_curve_list()
2026-02-03 11:01:11 +00:00
Valerio Setti
4f1e4fba80 library: ssl: make the list of "TLS ID" <-> "group name" public when possible
This is only done when MBEDTLS_DEBUG_C is declared in order not to inflate
the library size.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-27 00:51:35 +01:00
Valerio Setti
fb317afa9f library: ssl: rework macro to define known TLS ID <-> group name list
- let the macro be an initializer for the array of known TLS IDs, not
  a variable declarator;
- last item's group name is NULL, not an empty string
- change then name of the macro from MBEDTLS_TLS_ID_GROUP_NAME_TABLE to
  MBEDTLS_SSL_IANA_TLS_GROUPS_INFO
- define a new public structure "mbedtls_ssl_iana_tls_group_info_t" to
  hold each element of the table and that can be used the go over the
  list from user code.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-27 00:36:17 +01:00
Nico Geyso
6afd8367b9 remove whitespace in mbedtls_ssl_session_msg_layer
to comply with coding style, remove blank new line for alert reset

Signed-off-by: Nico Geyso <ng@gsmk.de>
2026-01-26 13:22:44 +01:00
Nico Geyso
4f83ebedd1 Fix outstanding code review issues
- adjust function name to mbedtls_ssl_get_fatal_alert
- fix missing property name changes for  mbedtls_ssl_context

Signed-off-by: Nico Geyso <ng@gsmk.de>
2026-01-26 13:15:07 +01:00
Valerio Setti
7ca3c602b7 library: ssl: add macro for allocating a TLS-ID <-> group-name table
Being a macro allow the table to be instatiated only when/if necessary
by the consuming code.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-26 10:48:01 +01:00
Valerio Setti
2aecd2cd5f library|tests: ssl: remove secp256k1 from default groups
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-22 17:13:44 +01:00
Valerio Setti
335b1b6089 library: ssl: add missing secp256k1 to ssl_preset_default_groups
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-22 09:43:46 +01:00
Valerio Setti
67f30df5a1 library: ssl: use correct PSA_WANT for DH groups in ssl_preset_default_groups
Use proper PSA_WANT_DH_RFC7919_xxx instead of PSA_WANT_ALG_FFDH.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-22 09:43:46 +01:00
Valerio Setti
2707100ab7 library: ssl: move location of ssl_preset_default_groups()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-22 09:43:45 +01:00
Valerio Setti
0c8b25a684 library: ssl: add public function to retrieve the list of supported groups
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-22 09:43:17 +01:00
Nico Geyso
33bd8f8f7f ssl - reset alert type for session reset
reset indicator (in_alert_recv) and type (in_alert_type) in
mbedtls_ssl_session_reset_msg_layer

Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:43:36 +01:00
Nico Geyso
d589854611 mbedtls_ssl_get_alert(): getter for fatal alerts
Even though the TLS RFCs do not mandate libraries to expose *Error
Alerts* (as defined in RFC8446 6.2 for TLS 1.3 and in RFC5246 7.2.2 for
TLS 1.2) to the user, there are use cases when it is handy to get the
actual last received fatal error instead of a generic one. For instance
this enables the user to differ between received fatal errors in case
`mbedtls_ssl_handshake()`, `mbedtls_ssl_handshake_step()` or
`mbedtls_ssl_read()` returned `MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE`.

This changesets stores the last incoming fatal alert in
`mbedtls_ssl_context` and provides `mbedtls_ssl_get_alert()` as a getter
for retrieving it. Another option would be to provide a callback
mechanisms for all kinds of alerts (not only fatals) but for simplicity
I discarded this option.

Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:37:07 +01:00
Valerio Setti
d8f0b37d1a ssl: replace remaining occurrence of pk_can_do with pk_get_key_type
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-05 15:57:39 +01:00
Valerio Setti
902467d62f ssl: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_type()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Manuel Pégourié-Gonnard
5341c86877 Add comments for remaining internal includes
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-02 12:35:20 +01:00
Manuel Pégourié-Gonnard
3e6455d50e Remove useless includes of psa_util_internal
Those in SSL modules were redundant because it's already included from
ssl_misc.h.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-02 12:00:34 +01:00
Ben Taylor
b76c38334a Update name of mbedtls_ssl_pk_alg_from_sig_pk_alg to mbedtls_ssl_pk_sig_alg_from_sig
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-31 08:40:25 +00:00
Ben Taylor
5f037c7fb3 Rename mbedtls_ssl_pk_alg_from_sig to mbedtls_ssl_pk_alg_from_sig_pk_alg and update to use mbedtls_pk_sigalg_t
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-30 14:59:24 +00:00
Ben Taylor
a2de40a100 Change the return type of mbedtls_ssl_get_ciphersuite_sig_pk_alg to mbedtls_pk_sigalg_t
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-28 07:58:37 +00:00
Ben Taylor
2c056721d1 Tidy up debug of non ext functions
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-28 07:58:37 +00:00
Ben Taylor
c3e2b37530 Remove mbedtls_ssl_write_handshake_msg as it now replaced by mbedtls_ssl_write_handshake_msg_ext
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-28 07:58:37 +00:00
Ben Taylor
91b8310e54 Remove internal deprecated items
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-07 08:19:44 +01:00
Ben Taylor
7e8e438fce Replace cases of time_t with mbedtls_time_t
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-09-29 14:24:47 +01:00
Valerio Setti
7b2d72aaf0 ssl: replace PSA_ALG_ECDSA with MBEDTLS_PK_ALG_ECDSA
When the key is parsed from PK it is assigned the pseudo-alg
MBEDTLS_PK_ALG_ECDSA. Trying to run "mbedtls_pk_can_do_psa" with an hardcoded
deterministc/randomized ECDSA can make the function to fail if the proper
variant is not the one also used by PK.
This commit fixes this problem.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-09-16 16:12:07 +02:00
Valerio Setti
0009b042ac library: ssl: replace mbedtls_pk_can_do_ext with mbedtls_pk_can_do_psa
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-09-16 16:12:07 +02:00
Ben Taylor
15f1d7f812 Remove support for static ECDH cipher suites
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-09-11 13:22:40 +01:00
Anton Matkin
92129adcf2 Removed the whitespace which is causing CI to fail
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-29 16:09:09 +02:00
Anton Matkin
8135b84ed2 Fixed incorrect usage of key derivation procedures
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-29 16:09:09 +02:00
Anton Matkin
8e4d8c9227 Update ssl_tls.c to use psa_pake_get_shared_key
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-29 16:09:09 +02:00
Anton Matkin
6eb5335ef0 Fixed issues with policy verification, since wildcard JPAKE policy is now disallowed, changed to concrete jpake algorithm (with SHA256 hash)
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-12 13:50:48 +02:00
Anton Matkin
1b70084bd9 TF-PSA-Crypto submodule link fixup
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-12 13:50:45 +02:00
Manuel Pégourié-Gonnard
5b74c79f00 Merge pull request #10298 from bjwtaylor/remove-deprecated-items
Remove deprecated items
2025-08-11 07:13:08 +00:00
Ben Taylor
5a27010fab Remove group_list_heap_allocated
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-08 08:33:03 +01:00
Ben Taylor
6023652711 Remove additional references to sig_algs_heap_allocated
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-06 08:28:43 +01:00
Valerio Setti
d0d0791aed remove usage of secp192[k|r]1 curves
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-08-06 09:15:35 +02:00
Valerio Setti
70a4a31cb5 remove secp224[k|r]1 curves
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-08-06 09:15:35 +02:00
Ben Taylor
9f54408c31 Remove sig_algs_heap_allocated=0 as it is always 0
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-05 08:28:33 +01:00
Ben Taylor
9db2e91cfe Fix style issues
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-01 11:45:14 +01:00
Ben Taylor
73de8aa8c6 Removal of sig_hashes in ssl.h
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-01 11:45:14 +01:00
Ben Taylor
01bf8bafcd removed mbedtls_ssl_conf_sig_hashes and temporarily re-add sig_hashes
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-01 11:45:14 +01:00
Ben Taylor
4a43804d69 Remove deprecated items
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-08-01 11:45:14 +01:00
Anton Matkin
72d6030f89 Combine psa_pake_set_password_key and psa_pake_setup into a single function
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-01 09:21:17 +02:00
Manuel Pégourié-Gonnard
921331867d Merge pull request #10197 from gilles-peskine-arm/ssl_helpers-split_perform_handshake-dev
Break down mbedtls_test_ssl_perform_handshake
2025-06-30 09:39:29 +00:00
Gilles Peskine
4c83221320 Replace MBEDTLS_ERR_OID_NOT_FOUND with MBEDTLS_ERR_X509_UNKNOWN_OID
Replace the non-X.509-named error code `MBEDTLS_ERR_OID_NOT_FOUND` with
`MBEDTLS_ERR_X509_UNKNOWN_OID`, which already exists and is currently not
used for anything.

Public functions in X.509 propagate this error code, so it needs to have a
public name.

Remove the definition of `MBEDTLS_ERR_OID_NOT_FOUND` in `x509_oid.h`, then

```
git grep -l MBEDTLS_ERR_OID_NOT_FOUND | xargs perl -i -pe 's/\bMBEDTLS_ERR_OID_NOT_FOUND\b/MBEDTLS_ERR_X509_UNKNOWN_OID/g'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
Gilles Peskine
c4949d1426 mbedtls_ssl_conf_alpn_protocols: declare list elements as const
This reflects the fact that the library will not modify the list, and allows
the list to be read from a const buffer.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-28 20:23:22 +02:00
Deomid rojer Ryabkov
7dddc1724f Mark ssl_tls12_preset_suiteb_sig_algs const
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
2025-05-15 15:27:40 +03:00