Skip to content

Commit e794122

Browse files
nvlsianpucarlescufi
authored andcommitted
doc/../device_guide/nrf54l: added KMU basics info page
Added page for provide bare-minimum info on KMU key provisioning knowledge, terms, good practices and limitation. Added description for new --policy specifier of west ncs-provision command. Signed-off-by: Anna Wojdylo <[email protected]> Signed-off-by: Andrzej Puzdrowski <[email protected]> Signed-off-by: Marek Pieta <[email protected]>
1 parent 9fb8c4a commit e794122

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

doc/nrf/app_dev/device_guides/nrf54l/cryptography.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ The CRACEN PSA driver supports the following:
2020

2121
The keys that are stored in the KMU or generated by the IKG are referenced using the built-in keys that are key IDs in the range from ``MBEDTLS_PSA_KEY_ID_BUILTIN_MIN`` to and including ``MBEDTLS_PSA_KEY_ID_BUILTIN_MAX``.
2222

23+
.. _ug_nrf54l_crypto_kmu_cracen_peripherals:
24+
2325
KMU and CRACEN peripherals
2426
**************************
2527

@@ -131,6 +133,8 @@ IKG keys are also accessed using the standard PSA Crypto APIs, and are reference
131133
The keys are not exportable, except for the public key associated with the asymmetric key.
132134

133135

136+
.. _ug_nrf54l_crypto_kmu_key_programming_model:
137+
134138
Programming model for referencing keys
135139
**************************************
136140

doc/nrf/app_dev/device_guides/nrf54l/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ Ensure to check the revision of your nRF54L15 device to see if it is supported:
6868
building_nrf54l
6969
nrf54l_signing_with_payload
7070
fota_update
71+
kmu_basics
7172
kmu_provision
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.. _ug_nrf54l_developing_basics_kmu:
2+
3+
Introduction to KMU key provisioning
4+
####################################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
The nRF54L devices are equipped with a Key Management Unit (KMU) that facilitates secure and confidential storage of keys.
11+
This feature is crucial not only for private keys but also for public keys, as the :ref:`KMU can directly transfer a key to the CRACEN RAM<ug_nrf54l_crypto_kmu_cracen_peripherals>`.
12+
Even when keys must pass through addressable RAM, the KMU significantly reduces the risk of key exposure.
13+
Therefore, you should use KMU for managing secrets whenever possible.
14+
15+
Key Types
16+
*********
17+
18+
Different types of keys, such as revocable and locked keys, serve distinct purposes and have unique policies associated with their use and management.
19+
In the PSA abstraction, key types are mapped by the ``psa_set_key_lifetime`` function.
20+
Refer to :ref:`PSA Key programming model<ug_nrf54l_crypto_kmu_key_programming_model>` for details.
21+
22+
Revocable keys
23+
==============
24+
25+
Revocable keys can be set as invalid for further use, which prevents the keys from being reused or new keys from being provisioned onto the same slots.
26+
For these keys, the revocation policy (RPOLICY) must be marked as ``revoked``.
27+
For some technical solutions, a few keys of the same key type (for example, generation 0, 1, 2) might be provisioned.
28+
At any given time, only one generation should be active.
29+
If a key generation is compromised, it should be revoked to prevent its use.
30+
The specifics of the revocation scheme depend on the technical solution, but it is recommended to designate one generation as non-revocable (``locked``) to prevent a Denial of Service (DoS) attack on the key's availability for the solution.
31+
32+
Locked keys
33+
===========
34+
35+
Once provisioned, locked keys are permanently available for use and cannot be deleted without erasing the device.
36+
For these keys, the revocation policy (RPOLICY) must be marked as ``locked``.
37+
38+
Provisioning keys for the bootloader
39+
************************************
40+
41+
The bootloader can use multiple key generations for image verification (up to three for nRF54L SoCs).
42+
To safeguard against unauthorized provisioning by attackers, you must :ref:`provision all key generations onto the device<ug_nrf54l_developing_provision_kmu>`.
43+
44+
By default, MCUboot uses a single key.
45+
You can configure the number of key generations that MCUboot uses for application verification with the ``CONFIG_BOOT_SIGNATURE_KMU_SLOTS`` MCUboot's Kconfig option.
46+
47+
Limitations on key types and trade-offs
48+
***************************************
49+
50+
Access to the KMU is restricted to secure code.
51+
When an SoC runs applications code as secure, the application has some control over the KMU.
52+
A provisioned key cannot be overwritten, but its content might be blocked from use at runtime (push block mechanism) by unexpected routines.
53+
However, applications can revoke a revocable key on the nRF54L15, nRF54L10, and nRF54L05 devices.
54+
The revoked key might not necessarily belong to an application; it could, for example, belong to a bootloader.
55+
56+
Revocable KMU keys are exposed to revocation by applications running in secure mode.
57+
If you cannot trust the application running in the secure mode, you should provision locked keys.
58+
You can consider the following options:
59+
60+
* Supporting key generations with revocable keys - The advantage of this method is that the application or bootloader can revoke a key generation if the private key is compromised or lost.
61+
The disadvantage is that a malicious application could also revoke the key.
62+
* Supporting one locked key - The advantage of this method is that the key cannot be deleted by the application.
63+
The disadvantage is that the method does not support multiple generations of keys.
64+
65+
Always consider the specific security needs of your application and choose the most appropriate key management approach to safeguard your digital assets.

doc/nrf/app_dev/device_guides/nrf54l/kmu_provision.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,27 @@ Once you have an unprovisioned SoC, upload keys to the board by running the foll
7171

7272
* Parameter ``--dev-id`` specifies the interface serial number and should be used if multiple J-link interfaces are connected to the development machine.
7373

74+
* Parameter ``-p" (--policy)`` specifies the policy applied to the given set of keys.
75+
You can apply the following options:
76+
77+
* ``lock-last`` - Uploads the last key as locked, while the preceding keys are revocable. This option is set by default.
78+
* ``revokable`` - Enables revocation for each key.
79+
* ``lock`` - Sets all keys to be permanent.
80+
7481
The script generates the public key for each private key and uploads them to your device.
7582
These public keys generate the verification keys for the application image, which are then used by MCUboot for validation.
7683
The first key specified in the command is used for signing the application image.
7784
Currently, the script supports only ED25519 Keys.
85+
86+
For MCUboot, take note of the following:
87+
88+
* By default, it uses one key.
89+
* KMU support in its configuration needs to be enabled by setting the ``SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU`` sysbuild Kconfig option.
90+
Otherwise, MCUboot will fallback to the compiled in key.
91+
92+
For provision one key to the board run the following command:
93+
94+
.. parsed-literal::
95+
:class: highlight
96+
97+
west ncs-provision upload -s nrf54l15 -k ed25519.pem

0 commit comments

Comments
 (0)