Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSA core lite PR #1 #20810

Closed
wants to merge 4 commits into from
Closed

PSA core lite PR #1 #20810

wants to merge 4 commits into from

Conversation

frkv
Copy link
Contributor

@frkv frkv commented Mar 9, 2025

This commit adds a thin PSA core to use instead of the regular PSA core (oberon-psa-core).
It is only supported for nRF54L15 devices, and it enabled CRACEN by default

This can be enabled by setting CONFIG_PSA_CORE_LITE=y

It decreases code-size for an NSIB-build with Ed25519 by ~2.7KB

Closed PR, please see: #20812 instead

@frkv frkv requested review from a team as code owners March 9, 2025 20:54
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Mar 9, 2025
@frkv frkv requested review from nvlsianpu, nordicjm and de-nordic March 9, 2025 20:55
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Mar 9, 2025

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 7

Inputs:

Sources:

sdk-nrf: PR head: d16705012eea8b07db7fd8789d91e6dd7beafcf3
zephyr: PR head: 90e614dde1e742e2fb73d9ad53c7800f5506e7ab

more details

sdk-nrf:

PR head: d16705012eea8b07db7fd8789d91e6dd7beafcf3
merge base: 3a4215ba3ab29336c8065c5c97a45ec1d46336e9
target head (main): 45f4037973ab21e418db850a3c965616ecfb36ef
Diff

zephyr:

PR head: 90e614dde1e742e2fb73d9ad53c7800f5506e7ab
merge base: a80a94e07ab07ff2597060c0d711b7344018333b
target head (main): 3b583c2e89004df9b6564a96b8fc91143298fdb2
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (12)
subsys
│  ├── nrf_security
│  │  ├── src
│  │  │  ├── core
│  │  │  │  ├── CMakeLists.txt
│  │  │  │  ├── Kconfig
│  │  │  │  ├── lite
│  │  │  │  │  ├── CMakeLists.txt
│  │  │  │  │  ├── psa_core_lite.c
│  │  │  │  │  │ psa_core_lite.h
│  │  │  │ psa_crypto_driver_wrappers.c
west.yml
zephyr
│  ├── include
│  │  ├── zephyr
│  │  │  ├── sys
│  │  │  │  ├── util_internal.h
│  │  │  │  │ util_macro.h
│  ├── scripts
│  │  ├── checkpatch.pl
│  │  ├── ci
│  │  │  │ check_compliance.py
│  ├── tests
│  │  ├── unit
│  │  │  ├── util
│  │  │  │  │ main.c

Outputs:

Toolchain

Version: 4ffa2202d5
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:4ffa2202d5_8bf7ca4353

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 1711
    • sdk-zephyr test count: 478
  • ❌ Integration tests
    • ✅ test-fw-nrfconnect-chip
    • ❌ test-fw-nrfconnect-nrf-iot_cloud
    • ✅ test-fw-nrfconnect-nrf-iot_thingy91
    • ❌ test-fw-nrfconnect-nrf_crypto
    • ❌ test-fw-nrfconnect-tfm
    • ✅ test-sdk-find-my
    • ✅ test-low-level
    • ✅ test-sdk-dfu
Disabled integration tests
    • desktop52_verification
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-boot
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_mosh
    • test-fw-nrfconnect-nrf-iot_positioning
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-proprietary_esb
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-thread
    • test-sdk-audio
    • test-sdk-mcuboot
    • test-sdk-pmic-samples
    • test-sdk-wifi
    • test-secdom-samples-public

Note: This message is automatically posted and updated by the CI

Copy link

github-actions bot commented Mar 9, 2025

You can find the documentation preview for this PR here.

@frkv frkv force-pushed the psa_core_lite_1 branch 3 times, most recently from e70a15d to c78fd5a Compare March 9, 2025 21:39
{
psa_status_t status = PSA_ERROR_NOT_SUPPORTED;
psa_key_attributes_t attr;
uint8t_t pub_key[pub_key_max_size];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint8t_t ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. No coverage on lite + verify hash yet. This will be fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add some twister test scenario so that the code you are adding is at the very least compiled as part of PR CI.

Comment on lines +26 to +27
psa_key_attributes_t *attributes, uint8_t *key_buffer,
size_t key_buffer_size, size_t *key_buffer_length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

@NordicBuilder
Copy link
Contributor

NordicBuilder commented Mar 18, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
zephyr nrfconnect/sdk-zephyr@a80a94e nrfconnect/sdk-zephyr#2637 nrfconnect/sdk-zephyr#2637/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@frkv frkv force-pushed the psa_core_lite_1 branch from 1831a8c to a1c51b3 Compare March 27, 2025 13:01
frkv added 4 commits March 27, 2025 14:58
-Zephyr PR is work-in-progress. This message must be erased before
 it is ready to go in

-Adds convenience-macros for muliple combined configurations
 IS_ENABLED_ANY, IS_ENABLED_ALL
-Adds conenience-macros for aggregated configurations
 UTIL_CONCAT_OR and UTIL_CONCAT_AND

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-This adds a PSA core that is size optimized. Its intended usage is
 builds that are severely size-limited like bootloaders (NSIB and
 MCUboot).
-The functionality of the PSA core lite is limited to:
 -ECDSA/EdDSA verification (hash/message)
 -one-shot hash calculation
 -FW encryption/decryption (multi part operations)
-This core only supports resolving keys on PSA crypto driver level
 and only a limited set of key management functions (resolve, lock and
 destroy). There is no volatile key support or PSA ITS support.
-Added Kconfig PSA_CORE_LITE
-Added psa_core_lite (.c/.h)

NOTE: This commit requires a subsequent commit to allow for key and
attribute retrieval from KMU.

NOTE: PSA core lite is currently limited to nRF54L series devices

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-Adding an ifdef to prevent call to psa_verfy_message_builtin. This
 API is only possible to use in a full PSA core and is unnecessary
 when the driver(s) provides explict support for verify message

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
-Providing an implementation for get_key_attributes (used for key
 management operations). When this API is called there are
 direct call to the following functions to populate
 psa_key_attributes_t:
 -cracen_kmu_get_key_slot
 -cracen_kmu_get_builtin_key
-Providing an implementation for get_key_buffer to get the keys in
 RAM for usage (if RAM is used).

The statement "old strategy" means that the convention of getting
information about keys available "in hardware" by doing the following
-Calling cracen_kmu_get_key_slot to get slot_number and lifetime
-Calling cracen_kmu_get_builtin_key using slot_number and lifetime to
 retrieve attributes and optionally key_buffer.

NOTE: This implementation uses direct calls to KMU APIs instead of
calling the Mbed TLS API mbedtls_psa_platform_get_builtin_key
to get slot_number and lifetime and using this in a call to
psa_driver_wrapper_get_builtin_key to retrieve attributes and optionally
the key buffer. This provides size optimization but prevent usage
of IKG keys (identity key, MKEK and MEXT)

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
@frkv frkv force-pushed the psa_core_lite_1 branch from a1c51b3 to d167050 Compare March 27, 2025 14:05
@frkv
Copy link
Contributor Author

frkv commented Apr 1, 2025

Closed PR, please see: #20812 instead

@frkv frkv closed this Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. DNM manifest manifest-zephyr
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants