1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-07-06 22:10:34 +08:00

7037 Commits

Author SHA1 Message Date
Minos Galanakis
5374262f3b Version bump 3.6.4
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-06-25 14:07:55 +01:00
Minos Galanakis
f36277558a Merge remote-tracking branch 'restricted/mbedtls-3.6-restricted' into mbedtls-3.6.4rc0-pr
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-06-23 18:52:17 +01:00
David Horstmann
54ceaf7a53
Merge pull request #10200 from aslze/mbedtls-3.6
[3.6] Fix build C++ apps with MSVC
2025-06-19 14:25:50 +00:00
Ronald Cron
d1f51696a6 Remove blank line
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-06-16 11:08:46 +02:00
Gilles Peskine
7df273bb34 Merge remote-tracking branch 'mbedtls-3.6' into mbedtls-3.6-restricted 2025-06-06 10:46:03 +02:00
Gilles Peskine
1592639c1f
Merge pull request #10182 from gilles-peskine-arm/f_rng-documentation-3.6
3.6 only: document f_rng callbacks
2025-06-03 15:34:23 +00:00
Ronald Cron
381900520f Fix psa_pake_operation_s member types
As the definition of psa_pake_operation_s has
been moved the "xyt_t" structure types can not
be used anymore (defined later).

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-06-03 10:09:00 +02:00
Ronald Cron
d3324fd095 Move PAKE size calculation macros, cipher suite and operation structs
In crypto_extra.h, move PAKE size calculation macros,
the definition of psa_pake_cipher_suite_s and
psa_pake_operation_s just after PAKE type and values
definitions.

This aligns with the order of crypto header inclusions
in crypto.h: crypto_types.h, then crypto_values.h,
then crypto_sizes.h, and then crypto_struct.h.

Take care of keeping them outside of the pake Doxygen
group as they used to be.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-06-03 10:06:22 +02:00
Ronald Cron
3ea3635d2f Move the inclusion of crypto_sizes.h and crypto_struct.h in crypto.h
That way when API are declared, the types they use are defined.

This should resolve the issues related to psa_xyz_init functions
returning a structure described in #7087.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-05-28 10:02:12 +02:00
Gilles Peskine
addf8fc03e Fix ECDSA documentation: blinding is no longer optional
Since Mbed TLS 3.0, blinding is no longer optional in ECDSA.
`mbedtls_ecdsa_write_signature()` and
`mbedtls_ecdsa_write_signature_restartable()` error out if
`f_rng == NULL`. We forgot to update the function documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-16 15:00:09 +02:00
Gilles Peskine
c0b357d8b4 ECDSA is a special flower
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-16 14:59:42 +02:00
Gilles Peskine
ed10e2ab87 Note functions that store the RNG callback in a context
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-16 14:24:50 +02:00
Gilles Peskine
060c70e3ab Reference mbedtls_f_rng_t in public documentation
In public functions that take `f_rng, p_rng` callbacks, link to the
documentation of the callback which is attached to the type name
`mbedtls_f_rng_t`.

Resolves #5868.

```
grep -l -w 'f_rng)' include | xargs perl -i -pe 's/\Qint (*f_rng)(void *, unsigned char *, size_t)\E/mbedtls_f_rng_t *f_rng/g'
```
and include `platform_util.h` where needed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-16 14:19:38 +02:00
Gilles Peskine
1337d540ad Name and document the type of random generator callbacks
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-16 14:12:15 +02:00
Manuel Pégourié-Gonnard
19d2c9165a Fix undocumented free() in x509_string_to_names()
Now programs/x509/cert_write san="DN:CN=#0000;DN:CN=#0000" is no longer
crashing with use-after-free, instead it's now failing cleanly:

 failed
  !  mbedtls_x509_string_to_names returned -0x2800 - X509 - Input invalid

That's better of course but still not great, will be fixed by future
commits.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-05-05 16:44:18 +02:00
Max Fillinger
0b65a91eea Fix doxygen for MBEDTLS_SSL_KEYING_MATERIAL_EXPORT
Error was introduced while resolving a merge conflict.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:24:50 +02:00
Max Fillinger
76bb753054 Fix max. label length in key material exporter
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:24:50 +02:00
Max Fillinger
97a287953f Document BAD_INPUT_DATA error in key material exporter
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:24:50 +02:00
Max Fillinger
8ee21410f1 Use one maximum key_len for all exported keys
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:23:42 +02:00
Max Fillinger
e95edbf6c5 Fix output size check for key material exporter
HKDF-Expand can produce at most 255 * hash_size bytes of key material,
so this limit applies to the TLS 1.3 key material exporter.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:23:41 +02:00
Max Fillinger
d97e0e8edc Enable MBEDTLS_SSL_KEYING_MATERIAL_EXPORT by default
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:20:50 +02:00
Max Fillinger
951b886801 Create MBEDTLS_SSL_KEYING_MATERIAL_EXPORT option
Add the option MBEDTLS_SSL_KEYING_MATERIAL_EXPORT to mbedtls_config.h
to control if the function mbedtls_ssl_export_keying_material() should
be available. By default, the option is disabled.

This is because the exporter for TLS 1.2 requires client_random and
server_random need to be stored after the handshake is complete.

Signed-off-by: Max Fillinger <max@max-fillinger.net>
2025-04-16 11:20:50 +02:00
Max Fillinger
7b52328f6c Remove TLS 1.2 Exporter if we don't have randbytes
The TLS-Exporter in TLS 1.2 requires client_random and server_random.
Unless MBEDTLS_SSL_CONTEXT_SERIALIZATION is defined, these aren't stored
after the handshake is completed.

Therefore, mbedtls_ssl_export_keying_material() exists only if either
MBEDTLS_SSL_CONTEXT_SERIALIZATION is defined or MBEDTLS_SSL_PROTO_TLS1_2
is *not* defined.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:20:50 +02:00
Max Fillinger
c48e9e0004 Fix coding style
Signed-off-by: Max Fillinger <max@max-fillinger.net>
2025-04-16 11:20:49 +02:00
Max Fillinger
9359f4d703 Fix coding style
Signed-off-by: Max Fillinger <max@max-fillinger.net>
2025-04-16 11:20:49 +02:00
Max Fillinger
f95bfda1f9 Fix doxygen comment parameter name
Signed-off-by: Max Fillinger <max@max-fillinger.net>
2025-04-16 11:20:49 +02:00
Max Fillinger
5805cc9807 Fix typos in comment
Signed-off-by: Max Fillinger <max@max-fillinger.net>
2025-04-16 11:20:49 +02:00
Max Fillinger
3be83a7696 Fix mismatches in function declarations
Missed some const keywords in function declarations.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:20:49 +02:00
Max Fillinger
44042f0a57 Implement TLS-Exporter feature
The TLS-Exporter is a function to derive shared symmetric keys for the
server and client from the secrets generated during the handshake.
It is defined in RFC 8446, Section 7.5 for TLS 1.3 and in RFC 5705 for
TLS 1.2.

Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:20:49 +02:00
Minos Galanakis
e62ef05344 Version Bump for 3.6.3
./scripts/bump_version.sh --version 3.6.3

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-03-18 17:11:54 +00:00
Minos Galanakis
dfc8e43614 Merge remote-tracking branch 'upstream/mbedtls-3.6' into pre-3.6.3-upstream-merge 2025-03-14 14:23:23 +00:00
Gilles Peskine
0ed5cb8074
Merge pull request #10004 from gilles-peskine-arm/doc-threading-needed-by-psa-3.6
Backport 3.6: Document PSA's need for threading
2025-03-14 03:51:52 +00:00
Gilles Peskine
ba4f16691c
Merge pull request #10058 from gilles-peskine-arm/mbedtls_net_send-api-desc-tweak-3.6
Backport 3.6: mbedtls_net_send API description typo fix
2025-03-13 16:29:57 +00:00
Bence Szépkúti
b22247b85b
Merge pull request #10043 from Mbed-TLS/msvc-format-size-macros-3.6
[Backport 3.6] Fix preprocessor guards for C99 format size specifiers
2025-03-13 10:09:13 +00:00
Noah Pendleton
b05b3b19d7 mbedtls_net_send API description typo fix
Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
2025-03-13 10:32:27 +01:00
Minos Galanakis
104bd06826 Merge remote-tracking branch 'origin/features/tls-defragmentation/3.6' into feature_merge_defragmentation_36
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-03-12 15:21:56 +00:00
Gilles Peskine
858900656e State globally that the limitations don't apply to DTLS
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-03-12 10:55:47 +01:00
Gilles Peskine
bc0255592f Clarify DTLS
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-03-12 10:55:11 +01:00
Gilles Peskine
c3af2f48c4 ClientHello may be fragmented in renegotiation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-03-12 10:55:11 +01:00
Gilles Peskine
494e4943b5 Move the defragmentation documentation to mbedtls_ssl_handshake
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-03-12 10:55:10 +01:00
Gilles Peskine
b5ccd32390 Document the limitations of TLS handshake message defragmentation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-03-12 10:53:11 +01:00
Gilles Peskine
d3b3c6740f More generally, what needs psa_crypto_init also needs threading
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-03-11 14:45:54 +01:00
Bence Szépkúti
db475821f9 Fix comments
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-08 01:02:57 +01:00
Bence Szépkúti
c6934ff670 Never use %zu on MinGW
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-07 17:54:20 +01:00
Bence Szépkúti
f65983d670 Fix MSVC version guard for C99 format size specifiers
Visual Studio 2013 (_MSC_VER == 1800) doesn't support %zu - only use it
on 2015 and above (_MSC_VER >= 1900).

%ldd works on Visual Studio 2013, but this patch keeps the two macro
definitions together, for simplicity's sake.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-07 17:45:27 +01:00
Gilles Peskine
9dfe548008 Document the need to call mbedtls_ssl_set_hostname
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-25 18:46:17 +01:00
Gilles Peskine
5ee008d15f Improve documentation of mbedtls_ssl_set_hostname
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-25 18:46:17 +01:00
Gilles Peskine
4f563e7d90 Expand and rectify the documentation of mbedtls_ssl_context::hostname
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-25 18:46:17 +01:00
Gilles Peskine
11f74c5751 Add a note about calling mbedtls_ssl_set_hostname to mbedtls_ssl_setup
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-25 18:46:17 +01:00
Valerio Setti
79a98bd7b6 crypto_extra: improve description of psa_can_do_hash()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 15:01:04 +01:00