Commit Graph

1681 Commits

Author SHA1 Message Date
Gilles Peskine
a863415205 New API psa_random_set_prediction_resistance()
Let applications configure prediction resistance at runtime.

Prediction resistance is always considered disabled when there is no actual
entropy source, only a nonvolatile seed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 17:54:56 +01:00
Gilles Peskine
5093f08415 New API psa_random_deplete(): force a reseed on the next RNG query
In some scenarios, application or integration code knows that the random
generator should be reseeded, but the reseed cannot or must not happen
immediately and there is no way to report errors. In such scenarios, users
can call the new function `psa_random_deplete()`, which just marks the DRBG
as needing a reseed.

This change requires DRBG modules to treat `reseed_counter == reseed_interval`
as a condition that requires a reseed. Historically they reseeded when
`reseed_counter > reseed_interval`, but that made it impossible to require
a reseed when `reseed_interval == MAX_INT`. Note that this edge case is not
tested.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 17:54:56 +01:00
Gilles Peskine
ccfb7357a3 New function psa_random_reseed()
Explicit reseed of the PSA random generator.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 17:54:56 +01:00
Gilles Peskine
685a1ce6f4 Merge remote-tracking branch 'mbedtls-3.6' into merge-3.6-restricted-20260304 2026-03-04 14:39:06 +01:00
David Horstmann
7c2f728178 Merge pull request #1429 from yanesca/1427_buffer_underflow-backport-3.6
Fix buffer underflow in `x509_inet_pton_ipv6()` [3.6 backport]
2026-02-16 11:58:38 +00:00
Valerio Setti
25b5fcdcd3 Merge pull request #10581 from valeriosetti/issue665-backport
[backport] Software GCM table calculation buggy with gcc -O3
2026-01-29 15:17:00 +00:00
David Horstmann
337218d667 Merge pull request #10165 from davidhorstmann-arm/fix-mingw-ansi-stdio-3.6
[3.6] Fix format specifiers for MinGW ANSI stdio
2026-01-28 16:42:07 +00:00
Valerio Setti
f79c548ad0 changelog: add changelog about fixing issue #665 in tf-psa-crypto
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-28 00:07:44 +01:00
Janos Follath
51fc6428eb Add ChangeLog entry
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-21 10:43:41 +00:00
David Horstmann
419f302dcd Merge pull request #10526 from gilles-peskine-arm/include-common-first-202510-3.6
Backport 3.6: Include common header first
2025-12-09 16:50:12 +00:00
Gilles Peskine
e45e036b91 Fix Mbed-TLS/TF-PSA-Crypto#548
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-12-03 20:09:47 +01:00
Manuel Pégourié-Gonnard
30c2fa00af Add ChangeLog for RSA private performance regression
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-03 11:32:45 +01:00
Valerio Setti
14ada7f73c Merge pull request #10473 from valeriosetti/issue488-3.6
[3.6] psa_load_builtin_key_into_slot: prevent accessing the PSA storage if key ID is in volatile range
2025-11-11 12:31:15 +00:00
Valerio Setti
667e56a0a7 Merge pull request #10478 from Cube707/backport/iar-compiler-warning
[backport] add cast to fix IAR compiler errors
2025-10-31 12:33:11 +00:00
Jan Spannberger
73d5398f02 add cast to fix IAR compiler errors
IAR throws a warning "mixed ENUM with other type"

backport of a5384bdf09

Signed-off-by: Jan Spannberger <jan.spannberger@siemens.com>
2025-10-28 15:14:30 +01:00
Valerio Setti
2a9a272bdb changelog: prevent loading peristent keys if the key ID is in the volatile range
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-10-27 11:16:36 +01:00
Schrijvers Luc
9644a688f3 Update ChangeLog.d/gnuinstalldirs_include.txt
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Schrijvers Luc <begasus@gmail.com>
2025-10-24 10:59:27 +02:00
Luc Schrijvers
08d88fcf72 add changelog change
Signed-off-by: Luc Schrijvers <begasus@gmail.com>
2025-10-24 09:32:02 +02:00
Gilles Peskine
6dacfdc59e Merge pull request #10447 from valeriosetti/static-key-store-fix-size
[3.6] psa: improve buffer size computation for static key slots
2025-10-20 13:42:04 +00:00
Valerio Setti
a8ff9f76e9 changelog: add note about MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE improvements
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-10-16 16:47:01 +02:00
Minos Galanakis
5a3d0214b3 Merge tag 'mbedtls-3.6.5' into mbedtls-3.6.5_mergeback
Mbed TLS 3.6.5

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-15 18:41:13 +01:00
Minos Galanakis
369ea7a041 Assemble ChangeLog
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-10 18:04:55 +01:00
Gilles Peskine
42ae2ac6ec Merge pull request #10318 from keith-packard/gcc-14-3-array-bounds
Avoid invalid gcc 14.3 warning about array bounds in mbedtls_xor
2025-10-08 19:00:48 +00:00
Keith Packard
292b96c0a6 Avoid invalid gcc 14.3 warning about array bounds in mbedtls_xor
The combination of the multi-byte loop with the single byte loop
confuses GCC 14.3's array bounds checker. When the loop size is
constant, check to see if it is a multiple of the multi-byte size and
bail early. As this will be evaluated at compile time, there should be
no run-time cost.

This change uses the __builtin_constant_p compile-time operation. To
check if that is supported, the change uses the existing
MBEDTLS_HAS_BUILTIN macro. That macro was defined later in
library/common.h than is needed for this change, so it was moved up to
join some other macros that looked similar.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-10-02 11:09:29 -07:00
Minos Galanakis
bafcf5bddf Merge remote-tracking branch 'restricted/mbedtls-3.6-restricted' into mbedtls-3.6.5rc0-pr
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-02 15:37:04 +01:00
Ben Taylor
6e73b2f2fd Backport time_t type conversions
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-09-29 15:35:28 +01:00
Gilles Peskine
70135847cd Merge pull request #1425 from gilles-peskine-arm/restricted-3.6-merge-public-20250916
3.6: : merge public into restricted 2025-09-16
2025-09-17 21:05:31 +02:00
Gilles Peskine
334dfa8799 Merge remote-tracking branch '3.6' into restricted-3.6-merge-public-20250916
Conflicts:

* `framework`: update submodule to the merge of `main` and `main-restricted`.
2025-09-16 16:16:53 +02:00
Gilles Peskine
d1244932f1 We have a CVE ID
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-16 10:39:29 +02:00
Gilles Peskine
447134b704 Announce psa_can_do_cipher()
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-12 11:27:08 +02:00
Gilles Peskine
2d666646ba Changelog entry for PSA CBC-PKCS7 padding oracle fix
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
9d7d0e63ae Merge pull request #1407 from gilles-peskine-arm/mbedtls_cipher_finish_padded-3.6
Backport 3.6: Introduce mbedtls_cipher_finish_padded
2025-09-08 12:18:50 +02:00
Manuel Pégourié-Gonnard
07cbb33e76 Add ChangeLog entry for SSBleed and M-Step
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-09-02 10:41:50 +02:00
Manuel Pégourié-Gonnard
381d4ba03b Make mbedtls_mpi_gcd() more consistent
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-13 09:01:45 +02:00
Gilles Peskine
7db50d0700 Changelog entry for mbedtls_cipher_finish_padded()
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-08 15:15:07 +02:00
Gilles Peskine
8d524e8841 Merge pull request #10312 from ronald-cron-arm/dependency-on-generated-files
Backport 3.6: cmake: library: Fix potential concurrent file generation
2025-07-30 11:44:53 +00:00
Ronald Cron
5491fe3ee0 Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-07-21 09:45:14 +02:00
Minos Galanakis
c52f68fd21 Assemble ChangeLog
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
David Horstmann
a84be59757 Merge pull request #1366 from gilles-peskine-arm/base64-decode-clean-3.6
Backport 3.6: mbedtls_base64_decode: fix sloppiness
2025-06-17 14:55:39 +01:00
Gilles Peskine
3c9ad42719 Merge pull request #1367 from gilles-peskine-arm/aesni_has_support-volatile-3.6
Backport 3.6: Fix race condition in mbedtls_aesni_has_support
2025-06-13 23:20:28 +02:00
Felix Conway
b8d14734fd Simplify changelog
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-13 09:33:24 +01:00
Felix Conway
80ca13f07d Add changelog
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-12 13:28:26 +01:00
Gilles Peskine
f5db3e9436 Note that GCM is also impacted
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-11 10:45:41 +02:00
Gilles Peskine
a79525239f Merge pull request #1359 from Mbed-TLS/bugfix_1351_1352_1353_lms_drivers_3.6bp
[3.6 Backport]Bugfix: lms/lmots driver hardening.
2025-06-10 19:08:15 +02:00
Manuel Pégourié-Gonnard
7ed3653c57 Merge pull request #1363 from gilles-peskine-arm/3.6-restricted-merge-20250606
Merge mbedtls-3.6 into mbedtls-3.6-restricted
2025-06-10 11:01:11 +02:00
Manuel Pégourié-Gonnard
cae443405e Merge pull request #1347 from mpg/fix-asn1-store-named-data-null-deref-3.6
Backport 3.6: Fix asn1 store named data null deref
2025-06-10 09:50:34 +02:00
Gilles Peskine
8c67ac0f7f Fix race condition in mbedtls_aesni_has_support
Fix a race condition in `mbedtls_aes_ni_has_support()` with some compilers.
A compiler could hoist the assignment `done = 1` above the assignment to `c`,
in which case if two threads call `mbedtls_aes_ni_has_support()` at almost
the same time, they could be interleaved as follows:

    Initially: done = 0, c = 0

    thread A                thread B
    if (!done)
      done = 1;                                     # hoisted
                            if (!done)
                                return c & what;    # wrong!
      c = cpuid();
    return c & what

This would lead to thread B using software AES even though AESNI was
available. This is a very minor performance bug. But also, given a very
powerful adversary who can block thread A indefinitely (which may be
possible when attacking an SGX enclave), thread B could use software AES for
a long time, opening the way to a timing side channel attack.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-09 23:48:34 +02:00
Gilles Peskine
2b3d6a8f28 mbedtls_base64_decode: insist on correct padding
Correct base64 input (excluding ignored characters such as spaces) consists
of exactly 4*k, 4*k-1 or 4*k-2 digits, followed by 0, 1 or 2 equal signs
respectively.

Previously, any number of trailing equal signs up to 2 was accepted, but if
there fewer than 4*k digits-or-equals, the last partial block was counted in
`*olen` in buffer-too-small mode, but was not output despite returning 0.

Now `mbedtls_base64_decode()` insists on correct padding. This is
backward-compatible since the only plausible useful inputs that used to be
accepted were inputs with 4*k-1 or 4*k-2 digits and no trailing equal signs,
and those led to invalid (truncated) output. Furthermore the function now
always reports the exact output size in buffer-too-small mode.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-09 23:01:21 +02:00