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
Manuel Pégourié-Gonnard
7dcfd73731
RSA: use constant-time GCD in deduce_primes()
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:18:52 +02:00
Manuel Pégourié-Gonnard
0d73de5ee0
ecdsa: use CT modinv
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:18:52 +02:00
Manuel Pégourié-Gonnard
f35d30799c
ECP: use CT modinv
...
A function that was previously called in multiple places is now called
only once, hence more susceptible to being inlined, hence the test fix.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:18:52 +02:00
Manuel Pégourié-Gonnard
c2d210ea0d
DHM: use CT modinv for blinding
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:18:52 +02:00
Manuel Pégourié-Gonnard
a56a05b015
RSA: use CT gcd-modinv in prepare_blinding()
...
While at it, draw the blinding value uniformly in the permissible range.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-14 09:18:52 +02:00
Janos Follath
210f8bc4d7
Merge pull request #1408 from mpg/improve-gcd-3.6
...
[3.6] Make GCD (a lot) less leaky
2025-08-13 19:44:57 +01:00
Manuel Pégourié-Gonnard
e4ca79c04f
Merge pull request #1409 from mpg/improve-inv-mod
...
[3.6] Make `mpi_inv_mod()` (a lot) less leaky
2025-08-13 14:17:49 +02:00
Manuel Pégourié-Gonnard
30f0732369
bignum: gcd: improve comments
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-13 09:01:55 +02:00
Manuel Pégourié-Gonnard
87e77d6516
bignum: fix memory leak in GCD with 0 as an input
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-13 09:01:55 +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
Manuel Pégourié-Gonnard
c6a9d84555
bignum: use CT gcd for mbedtls_mpi_gcd()
...
The overall function is still not constant-time, but it just got a lot
less leaky.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-13 09:01:45 +02:00
Manuel Pégourié-Gonnard
a08faf9070
bignum: follow customs for ret initialisation
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-12 11:55:22 +02:00
Manuel Pégourié-Gonnard
7a5447ff65
Fix a few typos
...
Co-authored-by: Felix Conway <felix.conway@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-12 11:55:15 +02:00
minosgalanakis
a53d8c5a33
Merge pull request #10350 from ariwo17/backport/add-pbes2-aes-testdata
...
[BACKPORT] Issue #398 : Add AES-CBC PBES2 test cases to match 3DES variants
2025-08-11 15:04:24 +00:00
Manuel Pégourié-Gonnard
65b8011f7e
bignum: make mbedtls_mpi_lsb() less leaky
...
The path using builtin should be OK, as it should be using dedicated CPU
instructions which are constant time.
This fixes the no-builing path.
GCC gained support for __has_builtin in version 10. We're still testing
with older GCC on the CI, so the non-builtin path is tested on the CI.
https://gcc.gnu.org/gcc-10/changes.html
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-11 09:36:26 +02:00
Manuel Pégourié-Gonnard
40dfc811ef
bignum: remove dead variable-time inv_mod code
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-11 09:35:28 +02:00
Manuel Pégourié-Gonnard
1ac0a1e071
bignum: use CT modinv when A is odd (any range)
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-11 09:35:28 +02:00
Manuel Pégourié-Gonnard
e41709c17e
bignum: use CT modinv when A is odd and in [2, N)
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-11 09:35:28 +02:00
Manuel Pégourié-Gonnard
cdfd1c9c7d
bignum: use CT modinv when N is odd
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-11 09:35:28 +02:00
Manuel Pégourié-Gonnard
00076b4907
Expand testing for mbedtls_mpi_inv_mod() again
...
In the next refactoring we'll have:
- pretty different paths for N odd or even,
- possibly different paths for A <= 0, in [0, N) or above,
- possibly special cases when A % N is 0 or 1.
Pick two small moduli of different parities (3 and 4)
and go over the range [-(N+1), 2N-1] with A.
This should ensure we naturally run into all special cases.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-08-11 09:35:28 +02:00
Manuel Pégourié-Gonnard
246d86b941
Merge pull request #1403 from felixc-arm/bignum-invmod-wrapper
...
[3.6] Add wrapper `mpi_gcd_invmod_odd()`
2025-08-11 09:22:38 +02:00
Gilles Peskine
b4b1920f7a
We now run some tests with MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
...
Addresses https://github.com/Mbed-TLS/mbedtls/issues/9586 .
This is not a fully satisfactory resolution, because we don't run every
constant-flow test with Valgrind in PR jobs, only a small subset. We should
improve the coverage/resource balance.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-08 17:17:04 +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
beb53af31f
Expand the ignore patterns for test_full_block_cipher_psa_dispatch
...
Some tests from `test_suite_cipher.constant_time.data` follow the same
pattern as `test_suite_cipher.aes.data` and so have the same coverage
discrepancy.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-08-08 15:15:07 +02:00