Commit Graph

32554 Commits

Author SHA1 Message Date
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
Minos Galanakis
41325bca41 prepare_release.sh: Added psed helper function
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-30 09:28:20 +00:00
Gilles Peskine
0e59579358 Test with bad data in storage: support existing built-in or volatile key
When testing what happens with when accessing a key ID in the built-in or
volatile range and a file exists in storage, we were skipping the test case
when the key existed. When the volatile or built-in key exists, the
expectations on the test case are wrong, but the test case is still useful:
we should ensure that the existence of the file doesn't somehow prevent
access to the built-in or volatile key. So, instead of skipping, change the
test assertions on the fly to ensure that we are accessing the existing key.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-10-29 23:10:00 +01:00
Valerio Setti
e2b0e94592 tests: suite_psa_crypto_persistent: fix formatting
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-10-29 23:10:00 +01:00
Gilles Peskine
32dbf968c8 Test with bad data in storage: key IDs
Test what happens when the application tries to access a key and the storage
contains something invalid: either a corrupted file, or a key ID that's
outside the standard range for persistent keys.

Coverage of APIs in this commit:

* `psa_get_key_attributes()` (generally as a proxy for any key access);
* `psa_export_key()` (minor, but does provide some coverage of what happens
  if only the key material is corrupted);
* `psa_destroy_key()`, which hopefully should work even for a corrupted file.

Coverage of key IDs in this commit:

* Key IDs in various ranges: user (i.e. the normal range for persistent
  keys), builtin, volatile, reserved file ID, none of the above.
* Includes coverage for nonzero owner ID.

No coverage of corrupted files in this commit.

Assert the behavior that I think is the right thing. Subsequent commits will
reconcile the library behavior with the code as needed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-10-29 23:09:59 +01:00
Gilles Peskine
3e5d0c1202 Test key identifier ranges
Add some assertions on the various ranges of key identifiers to ensure that
they're disjoint and they comply with documented guarantees.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-10-29 23:07:11 +01:00
minosgalanakis
2cd2fae204 Merge pull request #10470 from Begasus/mbedtls-3.6
Use GNUInstallDirs CMAKE_INSTALL_INCLUDEDIR path for headers installation
2025-10-29 15:21:38 +00:00
Jan Wille
8d59423fe5 format: apply suggestions (add spaces)
Signed-off-by: Jan Wille <jan.wille@siemens.com>
2025-10-29 15:50:57 +01: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
Valerio Setti
1b93588d93 psa_crypto_slot_management: check key ID range when loading a persistent key
Do not try to load a persistent key whose key ID is in the volatile range.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-10-27 11:12:07 +01:00
Ben Taylor
82d2fb8720 Update lcov.sh paths in make files
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-24 12:03:59 +01:00
Ben Taylor
6d4abb4377 Remove lcov.sh as this will be moved to the framework
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-24 12:03:59 +01:00
Ben Taylor
567aadbd63 Update framework module
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-24 12:03:59 +01:00
Luc Schrijvers
7a399a6ed6 Add library/CMakeList.txt to the changes
Signed-off-by: Luc Schrijvers <begasus@gmail.com>
2025-10-24 13:00:40 +02: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
Janos Follath
94700198fb Remove dead code
Signed-off-by: Janos Follath <janos.follath@arm.com>
2025-10-23 14:43:52 +01: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
d80b9ff511 Merge pull request #10466 from minosgalanakis/bugfix/reset_gitignore_files
Revert "Added generated files"
2025-10-22 11:09:40 +00:00
Minos Galanakis
ddffba970b Revert "Added generated files"
This reverts commit 335197e60c.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-22 10:51:01 +01: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
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
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
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
minosgalanakis
e185d7fd85 Merge pull request #1428 from Mbed-TLS/mbedtls-3.6.5rc0-pr
Mbedtls 3.6.5RC
mbedtls-3.6.5 v3.6.5
2025-10-13 08:39:14 +01:00
Minos Galanakis
b1db32061c Update BRANCHES.md
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-10 18:04:55 +01:00