1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-10-24 13:32:59 +03:00
Commit Graph

32313 Commits

Author SHA1 Message Date
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
aa611e4bef Update framework to the merge of the merge PR
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-17 18:22:30 +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
64d4c3675a Merge pull request #1424 from gilles-peskine-arm/pkcs7-padding-error-timing-leak-cveid-3.6
CVE ID for PKCS7 padding timing leak in psa_cipher_finish
2025-09-16 16:10:56 +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
c2b94d45d4 Merge pull request #10401 from gilles-peskine-arm/psa_can_do-declare-publicly-3.6
Backport 3.6: Declare psa_can_do_cipher() publicly
2025-09-15 12:02:50 +00:00
Janos Follath
753036edb3 Merge pull request #10336 from gilles-peskine-arm/generated-files-lib-build-3.6
Backport 3.6: fix `make lib GEN_FILES=` sometimes requiring python
2025-09-12 13:27:26 +00: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
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
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
Manuel Pégourié-Gonnard
3e59e0ae08 Merge pull request #1411 from mpg/bypass-wrappers
[3.6] Bypass GCD/modinv wrappers when possible
2025-09-11 12:25:23 +02:00
Manuel Pégourié-Gonnard
c6b28b31ef Be explicit about modinv output range
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-09-11 09:58:45 +02:00
Janos Follath
f46aee2603 Merge pull request #1406 from gilles-peskine-arm/pkcs7-padding-error-timing-leak-3.6
Backport 3.6: Fix timing leak in PSA CBC-PKCS7 decryption
2025-09-08 16:33:22 +01:00
David Horstmann
fb7eba06b0 Merge pull request #10387 from davidhorstmann-arm/upgrade-python-packages-3.6
[Backport 3.6] Upgrade packages in requirements.txt
2025-09-08 15:31:46 +00:00
Gilles Peskine
cc908ad04c Remove redundant memset on freshly initialized buffer
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +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
04dfd70432 psa_cipher_decrypt: treat status and output length as sensitive
In `psa_cipher_decrypt()` and in the corresponding function in our built-in
implementation `mbedtls_psa_cipher_decrypt()`, treat `status` and
`*output_length` as sensitive variables whose value must not leak through a
timing side channel. This is important when doing decryption with unpadding,
where leaking the validity or amount of padding can enable a padding oracle
attack.

With this change, `psa_cipher_decrypt()` should be constant-time if the
underlying legacy function (including the cipher implementation) is.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
3b380daedb psa_cipher_finish: treat status and output length as sensitive
In `psa_cipher_finish()` and in the corresponding function in our built-in
implementation `mbedtls_psa_cipher_finish()`, treat `status` and
`*output_length` as sensitive variables whose value must not leak through a
timing side channel. This is important when doing decryption with unpadding,
where leaking the validity or amount of padding can enable a padding oracle
attack.

With this change, `psa_cipher_finish()` should be constant-time if the
underlying legacy function (including the cipher implementation) is.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
e74b42832e Return PSA_ERROR_INVALID_PADDING in constant time
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
d179dc80a5 Use mbedtls_psa_cipher_finish() in PSA
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
d3e182e7da Add BUFFER_TOO_SMALL testing
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
b6b1a8299b Factor API calls into auxiliary functions
Factor some common code for one-shot or multipart encryption/decryption into
auxiliary functions. No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-08 12:22:39 +02:00
Gilles Peskine
bba5d7c439 Add constant-time AES-CBC encrypt and decrypt tests through PSA
The main goal is to validate that unpadding is constant-time, including
error reporting.

Use a separate test function, not annotations in the existing function, so
that the functional tests can run on any platform, and we know from test
outcomes where we have run the constant-time tests.

The tests can only be actually constant-time if AES is constant time, since
AES computations are part of what is checked. Thus this requires
hardware-accelerated AES. We can't run our AESNI (or AESCE?) code under
Msan (it doesn't detect when memory is written from assembly code), so these
tests can only be run with Valgrind.

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
Gilles Peskine
943c291f59 Merge pull request #10390 from gilles-peskine-arm/threading-3.6-alt-doc
Improve documentation of MBEDTLS_THREADING_ALT
2025-09-08 09:50:16 +00: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
c056b64042 Merge pull request #10378 from gilles-peskine-arm/threading-1.0-condition-3.6
Smoke tests for threading
2025-09-05 15:52:01 +00:00
Gilles Peskine
4c40f08148 Update framework: support threading internal interface 4.0.0.0
3.6 is still using the threading internal interface 3.6.0.0 for now.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-05 11:27:13 +02:00
David Horstmann
7f231a634b Upgrade packages in requirements.txt
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-09-05 09:36:44 +01:00
David Horstmann
89f7cdbbac Merge pull request #1418 from mpg/ssbleed-mstep-changelog
[3.6] Add ChangeLog entry for SSBleed and M-Step
2025-09-04 14:51:24 +01: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
Gilles Peskine
56c4dc12b8 Single-threaded test of nominal mutex usage
No negative tests since all forbidden usage has undefined behavior.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-01 00:28:15 +02:00
Manuel Pégourié-Gonnard
e0ef179ea7 Merge pull request #10375 from gilles-peskine-arm/threading_internal.h-3.6
Backport 3.6: Create threading_internal.h
2025-08-29 11:48:51 +00:00
Gilles Peskine
c2e9dac28f Expand on why and how we bypass the quiet wrapper
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-29 13:23:33 +02:00
Gilles Peskine
9f7ac0371f Fix code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-29 10:46:52 +02:00
Gilles Peskine
7e43145bac Typo
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-29 09:35:29 +02:00
Gilles Peskine
2324a02602 Create threading_internal.h
This is meant to hold threading-related definitions that are not public, but
are used in the test framework.

To be populated later.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-29 08:59:27 +02:00
Gilles Peskine
44765c4b9b Test invalid_padding against all-bits-one
`SIZE_MAX` and `~(size_t) 0` are the same, but since the documentation says
"all-bits-one", write it that way in the test code.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-26 13:14:22 +02:00
Manuel Pégourié-Gonnard
c18eea6d43 Minor grammar fix in comment
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-26 11:34:45 +02:00
Manuel Pégourié-Gonnard
b46432930e ecdsa: rm unused variable
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-26 11:33:12 +02:00
Manuel Pégourié-Gonnard
6ab0f519b8 dhm: remove unused variable (and improve comment)
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-26 11:31:52 +02:00
Gilles Peskine
94e4e15748 Explain the near-duplication of test function for constant-flow tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-25 16:56:44 +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
David Horstmann
54bf8addd7 Merge pull request #10366 from davidhorstmann-arm/clarify-file-generation-cc-3.6
[Backport 3.6] Clarify use of `CC` and friends for file generation
2025-08-20 09:48:26 +00:00
David Horstmann
8281e6a13b Clarify use of CC and friends for file generation
Add more detail around how generation of configuration-independent files
chooses a C compiler. Mention that setting HOSTCC or CC is recommended
where there are multiple toolchains.

Mention that the fallback location is the cc executable, which may help
users troubleshooting when the file generation picks up the wrong
toolchain (as in Mbed-TLS/mbedtls#10360).

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-08-19 18:14:30 +01:00
Manuel Pégourié-Gonnard
9e1c532847 RSA: use CT gcd-modinv in deduce_private_exponent()
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:40:05 +02:00
Manuel Pégourié-Gonnard
a4bf680e92 RSA: refactor: avoid code duplication
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:40:05 +02:00
Manuel Pégourié-Gonnard
630148e67f RSA: use constant-time modinv in deduce_crt()
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:40:05 +02:00