Commit Graph

7074 Commits

Author SHA1 Message Date
Manuel Pégourié-Gonnard
e24f1e5c2c Merge pull request #10609 from mpg/pk-psa-large-stack-buffers
[3.6] PK: avoid large stack buffers in "to/from PSA" functions
2026-03-13 08:53:48 +00:00
Ronald Cron
828e3817ac Merge pull request #10623 from ronald-cron-arm/dtls-client-hello-defragmentation-3.6
Backport 3.6: Add support for (D)TLS 1.2 client hello defragmentation
2026-03-10 14:46:41 +00:00
Gilles Peskine
855e10c108 Merge pull request #10068 from gilles-peskine-arm/pk-0e-prototype-3.6
Minor documentation fixes in pk.h
2026-03-09 13:57:34 +00:00
Ronald Cron
1bdb0901c9 Update mbedtls_ssl_handshake() documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-24 15:37:28 +01:00
Manuel Pégourié-Gonnard
4bebabb687 PSA: improve PSA_EXPORT_KEY_OUTPUT_SIZE; PK: use it
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-23 09:42:06 +01:00
Manuel Pégourié-Gonnard
1cc0e98f68 PSA: add and use PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-23 09:42:06 +01:00
Valerio Setti
32649e1e33 include: fix guard in asn1write.h
Fix the location of the ending braket of "extern C" block in order to
have it balanced between C guards.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-02-16 14:03:48 +01: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
Manuel Pégourié-Gonnard
12b3c46d6a Merge pull request #10347 from aphroteus/mbedtls-3.6
[3.6] Fix a build failure that occurs in environments using Code Page 950
2025-12-16 08:14:04 +00:00
Luc Schrijvers
b044efeb61 Use GNUInstallDirs CMAKE_INSTALL_INCLUDEDDIR path for headers installation
Signed-off-by: Luc Schrijvers <begasus@gmail.com>
2025-10-23 11:37:58 +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
5306324015 psa: crypto_extra: update documentation of MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-10-16 16:36:50 +02:00
Valerio Setti
45574797e7 psa: crypto_extra: improve buffer size computation for static key slots
Take also MAC's key types into account when computing the size of the
buffer to store key material in static key slot configuration.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-10-15 16:22:39 +02:00
Minos Galanakis
ad63800090 Version bump for mbedtls-3.5.6
./scripts/bump_version.sh --version 3.6.5

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-10 18:04:55 +01:00
Gilles Peskine
0c4a951b37 Be more precise about the user/peer ID limitation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
(cherry picked from commit 84a9b26b88)
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-10 18:04:55 +01:00
Gilles Peskine
90eac7fc7a Document JPAKE limitations
Document limitations on the user ID, peer ID, primitive (elliptic curve) and
hash for `PSA_ALG_JPAKE`.

https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/502
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/503
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/504

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
(cherry picked from commit 8ca2a5bf95)
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-10 18:04:55 +01:00
Gilles Peskine
84a9b26b88 Be more precise about the user/peer ID limitation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-10-10 12:08:21 +02:00
Gilles Peskine
8ca2a5bf95 Document JPAKE limitations
Document limitations on the user ID, peer ID, primitive (elliptic curve) and
hash for `PSA_ALG_JPAKE`.

https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/502
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/503
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/504

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-10-08 17:39:23 +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
9a5444a3b8 Fix copypasta
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-12 11:27:11 +02:00
Gilles Peskine
6e1b66320a Improve documentation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-12 11:27:09 +02:00
Gilles Peskine
3aee15b8e5 Declare psa_can_do_cipher() in a public header
Integrators in a client-server architecture need to provide this function on
the client side.

Fixes mbedtls/issues#10341.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-12 11:27:07 +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
Gilles Peskine
df13694ecd Improve documentation of MBEDTLS_THREADING_ALT
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-07 14:45:15 +02:00
Gilles Peskine
fe00817fe7 Improve documentation of mutex primitives
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-07 14:42:54 +02:00
Gilles Peskine
f845e9d111 Minor documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-25 16:48:42 +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
46ebc3a758 Note that the decrypted length is sensitive when there was padding
The decrypted length reveals the amount of padding that was eliminated, and
thus reveals partial information about the last ciphertext block.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-08 15:15:07 +02:00
Gilles Peskine
6cb9f35d8c Switch legacy cipher to constant-time invalid padding reporting
In internal `get_padding` functions, report whether the padding was invalid
through a separate output parameter, rather than the return code. Take
advantage of this to have `mbedtls_cipher_finish_padded()` be the easy path
that just passes the `invalid_padding` through. Make
`mbedtls_cipher_finish()` a wrapper around `mbedtls_cipher_finish_padded()`
that converts the invalid-padding output into an error code.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-08 15:14:47 +02:00
Gilles Peskine
155de2ab77 New function mbedtls_cipher_finish_padded
New function `mbedtls_cipher_finish_padded()`, similar to
`mbedtls_cipher_finish()`, but reporting padding errors through a separate
output parameter. This makes it easier to avoid leaking the presence of a
padding error, especially through timing. Thus the new function is
recommended to defend against padding oracle attacks.

In this commit, implement this function naively, with timing that depends on
whether an error happened. A subsequent commit will make this function
constant-time.

Copy the test decrypt_test_vec and decrypt_test_vec_cf test cases into
variants that call `mbedtls_cipher_finish_padded()`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-08 15:14:47 +02:00
Paul Huang
11b8a23714 Fix a build failure that occurs in environments using Code Page 950
Replace a non-ASCII character with a space

Signed-off-by: Paul Huang <aphroteus@gmail.com>
2025-08-07 13:04:45 +08:00
Felix Conway
c51168039b Clarify mpi_gdc() documentation when B is 0
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-07-29 15:50:05 +01:00
Felix Conway
8951916ac7 Fix pointer aliasing in bignum tests
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-07-29 11:03:08 +01:00
Felix Conway
1527b69c7f Clarify parameter documentation
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-07-28 16:31:44 +01:00
Felix Conway
9646537e94 Improve testing of mbedtls_mpi_gcd() and mbedtls_mpi_inv_mod()
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-07-24 15:25:00 +01:00
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
David Horstmann
3e715b02e6 Fix format specifiers for ANSI stdio
Instead of using the windows-specific "I64d" format specifier, use the
friendly MinGW abstraction PRId64, which works both when
__USE_MINGW_ANSI_STDIO is enabled and when it is disabled.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-05-15 17:02:47 +01:00