Commit Graph

32430 Commits

Author SHA1 Message Date
David Horstmann
1ecd0c1ea6 Simplify ChangeLog entry
Improve readability of the ChangeLog by including only the strictly
necessary information.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-10 09:05:37 +00:00
David Horstmann
a749c3a5f8 Add ChangeLog entry for FFDH buffer overflow fix
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-10 09:05:37 +00:00
David Horstmann
01bcc1f754 Add missing FFDH public key buffer length check
When exporting an FFDH public key we were not properly checking the
length of the output buffer and would write the full length of the key
in all cases. Fix this by checking the size of the output buffer before
we write to it.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-10 09:05:37 +00:00
David Horstmann
443300e700 Add testcase for FFDH buffer overflow
This testcase calls psa_export_public_key() on an FFDH key with an
output buffer that is too small. Since the size is calculated based on
the required key size but not checked against the available buffer size,
we overflow the buffer.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-03-10 09:05:37 +00: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
Janos Follath
72e18e0032 inet_pton: simplify IPv4 walkback loop
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-21 17:29:07 +00:00
Janos Follath
51fc6428eb Add ChangeLog entry
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-21 10:43:41 +00:00
Janos Follath
4595bb47d2 inet_pton: fix buggy condition
The flawed condition made us accept invalid IPv6 addresses and in some
cases lead to a buffer underread.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-20 18:46:52 +00:00
Janos Follath
763a0cfd15 inet_pton: help ASan find the underflow
The generated unit tests have the input parameters in large stack
buffers and therefore ASan doesn't notice under or overflows in them.
Copy the input parameter into a locally allocated buffer to trigger ASan
if something goes wrong.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-20 18:19:33 +00:00
David Horstmann
366e469c2b Merge pull request #10568 from yanesca/add_clarifications_3.6.x
[Backport 3.6] Add miscellaneous clarifications
2026-01-20 16:38:58 +00:00
Janos Follath
6c0a661b68 programs/README.md clarify security remark
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-20 13:47:05 +00:00
Janos Follath
92dbfb34f0 SECURITY.md: make x509 data section more readable
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-20 13:47:03 +00:00
Janos Follath
7b2ad1c518 Clarify purpose and suitability of sample programs
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-19 15:00:22 +00:00
Janos Follath
baea194a04 Clarify CRL security guarantees
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-19 14:58:39 +00:00
David Horstmann
bdc6ce751b Merge pull request #10538 from gilles-peskine-arm/include-common-first-fix-aesce-3.6
Backport 3.6: Fix AESCE regression with Clang due to inclusion order changes
2025-12-18 14:32:55 +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
Gilles Peskine
ad6ceaa4e7 Indicate which Clang version stops requiring the workaround
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-12-11 16:10:41 +01:00
Gilles Peskine
85e28b266e AESCE: fix the build with Clang <<16
As indicated in a comment, with older Clang, we need to define
`__ARM_FEATURE_CRYPTO` before we include `arm_neon.h`, which is done via
`common.h`. 4c44990d65
accidentally broke this. Fix it, while taking care not to include another
header before `common.h`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-12-11 16:09:53 +01: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
c05500c7f9 Merge pull request #10513 from mpg/rsa-blinding-crt
[3.6] Rsa: use the CRT to generate base blinding values
2025-12-09 11:18:21 +00:00
Manuel Pégourié-Gonnard
f6f837aec5 rsa: clarify drawing at random with the CRT
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-09 09:39:07 +01:00
Manuel Pégourié-Gonnard
d251d73d06 rsa: clarify CRT computation
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-09 09:26:20 +01:00
Manuel Pégourié-Gonnard
ec5bc19996 Fix some typos in comments
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-09 09:16:25 +01:00
Valerio Setti
d5161daa48 Merge pull request #10531 from gilles-peskine-arm/race-condition-in-makefile-3.6
Backport 3.6: fix race condition in makefile affecting test_sha3_variations
2025-12-04 21:42:20 +00:00
Pengyu Lv
0502ba15b1 Fix dependencies in programs/Makefile
Make fuzz depend on MBEDLIBS to avoid multiple instances for
generation the library files.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2025-12-04 16:56:21 +01:00
Pengyu Lv
b902851840 Fix the commands to build library
In `scripts/common.make`, used by `tests/Makefile` and `programs/Makefile`,
we have the following rules to build the library:

  ```
  $(MBEDLIBS):
      $(MAKE) -C ../library
  ```

$(MBEDLIBS) contains three library files but the command is for all
the 3 files instead of single target generation. This would cause a
race when doing parallel build. This commit fixes command so that
the recipe could generate a single library file.

Fix https://github.com/Mbed-TLS/mbedtls/issues/8229

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Gilles Peskine <gilles.peskine@arm.com>
2025-12-04 16:53:37 +01: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
83e3b37e9d rsa: rm unused variable + fix typos
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-03 13:27:19 +01:00
Manuel Pégourié-Gonnard
f90c04d646 RSA: remove undocumented check
This only made the function harder to use.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-03 11:35:28 +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
Manuel Pégourié-Gonnard
fbd7388482 RSA: handle low-probability events in a uniform way
Previously we were looping in one case but not even checking the other.
Let's check both cases and error out immediately. The error path should
never be taken in pratice anyway.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-03 11:26:09 +01:00
Gilles Peskine
4c44990d65 Include common.h before system headers
In library source files, the order of things should be:

1. Define macros that affect the behavior of system headers, such as
   `_POSIX_C_SOURCE` and `_GNU_SOURCE`.
2. Include the library's common header: `common.h`.
   It takes care of many things, including defining the library
   configuration, granting access to private fields in structures, and
   activating platform-specific hacks.
3. Possibly a few header inclusions and macro definitions.
4. Guard everything else by `#if defined(MBEDTLS_XXX_C)` or some such.

Enforce this order in files that previously did things they shouldn't have
before including `common.h`. To locate the potentially
problematic files:

```
grep -m1 '^#' library/*.c | grep -v -F common.h
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-12-02 22:35:16 +01:00
Manuel Pégourié-Gonnard
8b0ee342fa rsa: use the CRT to generate blinding values
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-11-18 12:02:33 +01:00
Manuel Pégourié-Gonnard
b13033dd3e rsa: extract helper function for CRT
Was only used in one place so far, but will be used in
rsa_gen_rand_with_inverse()'s upcoming CRT-based implementation.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-11-18 11:39:40 +01:00
Manuel Pégourié-Gonnard
3be31bf21b rsa: extract helper function
Will gain a new implementation using the CRT, so we want to hide the
upcoming complexity in a dedicated function.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-11-18 11:38:47 +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
Gilles Peskine
89141231d6 Merge pull request #10497 from JuhaPekkaa/juke/loglevel-change-3.6
Update log level for mbedtls_ssl_check_record and PSA-based ECDH computation (3.6)
2025-11-06 17:37:53 +00:00
Manuel Pégourié-Gonnard
1d0ccfae0d Merge pull request #10452 from bjwtaylor/move-lcov-3.6
Move lcov 3.6
2025-11-06 11:12:04 +00:00
Juha-Pekka Kesonen
b11d969e2c ssl_msg.c: change log level for record checking
Signed-off-by: Juha-Pekka <juha-pekka.kesonen@nordicsemi.no>
2025-11-05 15:06:02 +02:00
Juha-Pekka Kesonen
a535836d14 ssl_tls12: change log level for ECDH computation
Signed-off-by: Juha-Pekka <juha-pekka.kesonen@nordicsemi.no>
2025-11-05 15:05:23 +02:00
Ronald Cron
8d0641675c Merge pull request #10483 from minosgalanakis/bugfix/update_prepare_release_3.6
[Backport]Update prepare_release.sh
2025-11-04 16:03:29 +00:00
Minos Galanakis
1c03c3e197 prepare_release.sh: Updated regex syntax
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-11-04 10:40:58 +00:00
Ben Taylor
753c1afcf8 Update lcov.sh patch to use CMake variable
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-11-04 09:45:37 +00:00
Valerio Setti
8102fe3b0f tests: suite_psa_crypto_persistent_key: fix load_primed_storage
Do not remove keys that belong to the reserved range.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-11-03 11:07:04 +01:00
Valerio Setti
cc0385852d Merge pull request #10471 from yanesca/fix_dead_code_231025
Fix dead code - 3.6 Backport
2025-10-31 12:49:57 +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
Valerio Setti
cbc6bc56b1 tests: suite_psa_crypto_persistent_key: fix test data for 3.6 branch
Previous tests were backported from tf-psa-crypto and they work fine there.
However the library implementation is not the same between 3.6 and
tf-psa-crypto: in 3.6 we only prevent loading of persistent keys if their
ID is within the volatile range, but the built-in one is still allowed.
Therefore this commit fix expected return values for the 3.6 branch
when built-in keys are accessed.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-10-31 12:37:09 +01:00
Minos Galanakis
ae80683fe2 Added documentation
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-30 09:48:59 +00:00
Minos Galanakis
fea16efc1c prepare_release.sh: Adjusted build system matching patterns
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-30 09:48:59 +00:00
Minos Galanakis
9e7f033546 prepare_release.sh: Removed -r/-u modes
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-30 09:37:17 +00:00