1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-07-09 17:04:14 +08:00

32071 Commits

Author SHA1 Message Date
Gilles Peskine
bd6fb46ff6 Add a build with NV seed as the only entropy source
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-06 10:18:36 +02:00
Gilles Peskine
582b6fbad3 We do support builds where NV seed is the only entropy source
We want to support builds where there are no platform entropy
sources (`MBEDTLS_NO_PLATFORM_ENTROPY` enabled), and no custom entropy
sources (`MBEDTLS_ENTROPY_HARDWARE_ALT` disabled), but
`mbedtls_entropy_init()` sets up a working entropy without needing to add
sources manually with `mbedtls_entropy_add_source()`
(`MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES` disabled) thanks to a nonvolatile seed
file injected outside the library's control (`MBEDTLS_ENTROPY_NV_SEED`
enabled).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-06 10:18:33 +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
David Horstmann
23a0d48d1c
Merge pull request #10196 from ronald-cron-arm/move-crypto-struct-inclusion
[Backport 3.6] Move the inclusion of crypto_sizes.h and crypto_struct.h in crypto.h
2025-05-28 15:51:09 +00:00
Ronald Cron
4960825a94 Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-05-28 10:05:32 +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
Manuel Pégourié-Gonnard
1173786544
Merge pull request #10185 from rojer/tls_consts_3.6
Mark TLS 1.2 algo suite definitons const
2025-05-20 06:55:12 +00:00
Deomid rojer Ryabkov
fb5e2e5e46 Mark ssl_tls12_preset_suiteb_sig_algs const
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
2025-05-19 20:48:13 +01:00
Deomid rojer Ryabkov
e3aaf82a77 Mark ssl_tls12_preset_default_sig_algs const
To place in flash and save RAM on targets where this applies.

Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
2025-05-19 20:48:08 +01:00
Manuel Pégourié-Gonnard
dad206d25c
Merge pull request #10168 from gilles-peskine-arm/union-initialization-gcc15-basic-fix-3.6
Backport 3.6: Fix insufficient union initialization in contexts
2025-05-19 10:31:47 +00: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
Gilles Peskine
ff32e86429
Merge pull request #10170 from yanesca/mbedtls-3.6.3.1-pr
Mbedtls 3.6.3.1 PR
2025-05-13 10:19:56 +00:00
Gilles Peskine
91b29a0bd9 Grammar in comments
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-13 11:53:31 +02:00
Janos Follath
c5848a5704 Merge branch 'mbedtls-3.6.3.1-rc' into mbedtls-3.6.3.1-pr
This merge was done by the '-s ours' strategy. The only purpose of this
merge is to bring the commit for the 3.6.3.1 release into the
mbedtls-3.6 history and make the CI pass.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2025-05-09 13:03:56 +01:00
Janos Follath
6fb5120fde Remove .gitmodules
Signed-off-by: Janos Follath <janos.follath@arm.com>
v3.6.3.1
2025-05-08 16:06:32 +01:00
Gilles Peskine
65b548386f Changelog entry for the union initialization fixes
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-07 18:51:57 +02:00
Gilles Peskine
f4ebf807e6 Test with GCC 15 with sloppy union initialization
This is a non-regression test for
https://github.com/Mbed-TLS/mbedtls/issues/9814

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-07 18:51:57 +02:00
Gilles Peskine
0e4907d4f5 Initialize MAC context in internal functions for one-shot MAC
In functions that bypass the API functions and call an internal MAC setup
function directly, make sure to initialize the driver-specific part of the
context. This is a union, and initializing the union to `{0}` only
guarantees that the first member of the union is initialized, not
necessarily the member used by the driver. Most compilers do initialize the
whole union to all-bits-zero, but some don't. With compilers that don't, the
lack of initialization caused failures of the affected operations. This
affected one-shot MAC operations using the built-in implementation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-07 18:42:52 +02:00
Gilles Peskine
bbec1c1d25 Initialize MAC context in internal functions for KDF
In functions that bypass the API functions and call the MAC driver wrapper
`psa_driver_wrapper_mac_sign_setup()` directly, make
sure to initialize the driver-specific part of the context. This is a union,
and initializing the union to `{0}` only guarantees that the first member of
the union is initialized, not necessarily the member used by the driver.
Most compilers do initialize the whole union to all-bits-zero, but some
don't. With compilers that don't, the lack of initialization caused failures
of the affected operations. This affected several key derivation operations.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-07 18:42:33 +02:00
Gilles Peskine
a7a480bb81 Initialize driver context in setup functions
In API functions that set up a multipart or interruptible operation, make
sure to initialize the driver-specific part of the context. This is a union,
and initializing the union to `{0}` only guarantees that the first member of
the union is initialized, not necessarily the member used by the driver.
Most compilers do initialize the whole union to all-bits-zero, but some
don't. With compilers that don't, the lack of initialization caused failures
of built-in MAC, interruptible-sign and interruptible-verify. It could also
cause failures for other operations with third-party drivers: we promise
that drivers' setup entry points receive a zero-initialized operation
structure, but this promise was not kept.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-05-07 18:41:59 +02:00
Gilles Peskine
f0daff971b
Merge pull request #10151 from gilles-peskine-arm/union-initialization-gcc15-preliminaries-3.6
Backport 3.6: Test with GCC 15
2025-05-07 14:22:28 +00:00
Gilles Peskine
15bb8e04bf Improve comments
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-30 16:58:00 +02:00
David Horstmann
3bd433d38a
Merge pull request #10150 from gilles-peskine-arm/pylint-check-str-concat-3.6
Backport 3.6: Pylint: Complain about a missing comma in multiline lists of strings
2025-04-28 16:53:39 +00:00
Gilles Peskine
88f6ce195e Update framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 19:06:50 +02:00
Gilles Peskine
df065720da Allow gcc-15 to be in $PATH
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:59:45 +02:00
Gilles Peskine
2eab9fd92a Enable drivers when testing with GCC 15
The goal of testing with GCC 15 is to validate fixes for
https://github.com/Mbed-TLS/mbedtls/issues/9814 . The bug is present in
multiple places, and some of them affect third-party drivers but not our
built-in implementation. (The bug is that driver contexts might not be
zero-initialized, but some of our built-in implementations happen not to
care about this.) Thus, enable the test drivers in the test component that
uses GCC 15, to gain the extra checks performed in the driver wrappers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:59:42 +02:00
Gilles Peskine
bf90dc9c71 GCC 15: Silence -Wunterminated-string-initialization
This is a new warning in GCC 15 that our code base triggers in many places.
Silence it for the time being.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:58:33 +02:00
Gilles Peskine
94c1b9a4c3 Test with GCC 15
Non-regression for https://github.com/Mbed-TLS/mbedtls/issues/9814

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:57:33 +02:00
Gilles Peskine
451b9ada27 Disable warning from gcc -pedantic on dlsym/dlopen
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:49:56 +02:00
Gilles Peskine
ebd0888cf0 Move persistent key tests to a separate .data file
They can cause specific challenges when debugging, so move them out for
maintainers' convenience.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:48:59 +02:00
Gilles Peskine
f5f15aa9e2 Move concurrent tests to a separate .data file
They can cause specific challenges when debugging, so move them out for
maintainers' convenience.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:48:52 +02:00
Gilles Peskine
cdb37812e5 Update obsolete section title
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-25 18:48:36 +02:00
Gilles Peskine
ae18357880
Merge pull request #10138 from XavierChapron/xch/constify-mbedtls_cipher_base_lookup_table-3.6
Constify cipher_wrap:mbedtls_cipher_base_lookup_table
2025-04-24 17:49:03 +00:00
Gilles Peskine
cc4649dd7f Complain about a missing comma in multiline lists of strings
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-24 19:37:58 +02:00
Gilles Peskine
0dd76e0470 Prepare framework for pylint check-str-concat-over-line-jumps
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-24 19:37:41 +02:00
Gilles Peskine
84442115ff
Merge pull request #10137 from gilles-peskine-arm/test_suite_ssl-fix-ret-20250408-3.6
Backport 3.6: Fix uncaught failure conditions in test_suite_ssl
2025-04-23 16:42:17 +00:00
Gilles Peskine
74383ab137
Merge pull request #10132 from valeriosetti/issue157-3.6
[3.6] Make demo_common.sh usable on its own
2025-04-18 11:11:11 +00:00
Valerio Setti
309ca525ac framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-04-18 10:31:28 +02:00
Xavier Chapron
afedef5eea Constify cipher_wrap:mbedtls_cipher_base_lookup_table
This structure is initialized during the compilation and there is no
reason it changes.
Making it const allows the compiler to put it in .rodata section instead
of .data one.

Signed-off-by: Xavier Chapron <chapron.xavier@gmail.com>
2025-04-18 09:24:36 +02:00
David Horstmann
e08edcc494
Merge pull request #9469 from mfil/feature/backport36_implement_tls_exporter
[Backport 3.6] Implement TLS-Exporter
2025-04-17 14:47:20 +00:00
Gilles Peskine
0e6032dd94 Fix some test helper functions returning 0 on some failures
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-17 10:35:04 +02:00
Gilles Peskine
1ff12810e5 Check the status of mbedtls_ssl_set_hostname()
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-04-17 10:35:03 +02:00
Max Fillinger
1b0e2e903b Add missing ifdef for mbedtls_ssl_tls13_exporter
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 14:35:24 +02:00
Max Fillinger
40c202461f Add label_len argument to non-PSA tls_prf_generic
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:24:50 +02:00
Max Fillinger
820e5cc29b Fix dependencies for TLS-Exporter tests
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
2025-04-16 11:24:50 +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