You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
samples: matter: Set custom keystore manager during the init.
We need to set a custom keystore manager in Matter server
while using KMU and assign the KMUKeyAllocator.
Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
Copy file name to clipboardexpand all lines: doc/nrf/protocols/matter/end_product/security.rst
+129
Original file line number
Diff line number
Diff line change
@@ -161,6 +161,135 @@ This is a reference configuration that can be modified in the production firmwar
161
161
To use the Oberon backend for specific cryptographic operations supported by both drivers, disable those operations in the CRACEN driver, as it takes priority when both are enabled.
162
162
See the :ref:`nrf_security_drivers` documentation for more information.
163
163
164
+
.. _matter_platforms_security_kmu:
165
+
166
+
nRF54L Key Management Unit (KMU)
167
+
================================
168
+
169
+
nRF54L Series devices include :ref:`ug_nrf54l_crypto_kmu_cracen_peripherals` that can be used to store cryptographic keys in Matter.
170
+
In this solution, the keys are stored within the available slots in the :ref:`ug_nrf54l_crypto_kmu_slots` range that are not reserved for current and future |NCS| use cases.
171
+
172
+
The default slots range used for Matter is from ``100`` to ``180``, excluding the DAC private key.
173
+
For details on the DAC private key configuration, see :ref:`matter_platforms_security_dac_priv_key_kmu`.
174
+
To change the slots range, set the :kconfig:option:`CONFIG_CHIP_KMU_SLOT_RANGE_START` and :kconfig:option:`CONFIG_CHIP_KMU_SLOT_RANGE_END` Kconfig options.
175
+
The Raw usage scheme defined in the :ref:`ug_nrf54l_crypto_kmu_key_usage_schemes` section is used for all Matter keys.
176
+
177
+
To use this feature, set the :kconfig:option:`CONFIG_CHIP_STORE_KEYS_IN_KMU` Kconfig option to ``y``, and switch to the ``KMUKeyAllocator`` by calling the ``chip::Crypto::SetPSAKeyAllocator`` method in your code during the Matter stack initialization.
178
+
179
+
For example:
180
+
181
+
.. code-block:: cpp
182
+
183
+
#include <platform/nrfconnect/KMUKeyAllocator.h>
184
+
185
+
static KMUKeyAllocator kmuAllocator;
186
+
Crypto::SetPSAKeyAllocator(&kmuAllocator);
187
+
188
+
See the :file:`samples/matter/common/src/app/matter_init.cpp` file for a usage example.
189
+
190
+
Due to limited slots available in the KMU, the maximum number of Matter fabric is limited.
191
+
The following table shows the all crypto materials used in Matter, the number of slots needed for each key and a Kconfig option that can be used to adjust the number of each key type:
192
+
193
+
.. list-table:: KMU slots used by Matter crypto materials
.. [3] Group keys are not stored in the KMU yet, but the slots are reserved for the future usage.
235
+
A key may be shared between multiple groups, so the number of slots needed for group keys may be lower than the number of groups.
236
+
Three group keys are assumed for each Matter fabric.
237
+
238
+
The default slots range allows storing more cryptographic materials than the minimum required according to the Matter specification.
239
+
A minimum of 46 slots is required for cryptographic materials, including the DAC private key to support 5 fabrics (minimum required by the specification).
240
+
A single Matter fabric requires at least nine KMU slots.
241
+
242
+
The default range has been chosen to support up to eight Matter fabrics, 32 ICD keys (16 ICD users), and 24 group keys.
243
+
You can change the default Kconfig option for each crypto material to adjust the number of slots, but you must ensure that the total number of slots fits within the defined range.
244
+
If you overlap the slots range, the appropriate compilation error will be shown:
245
+
246
+
.. code-block:: console
247
+
248
+
error: "The number of slots exceeds the range of the KMU defined in CONFIG_CHIP_KMU_SLOT_RANGE_START and CONFIG_CHIP_KMU_SLOT_RANGE_END"
249
+
250
+
For example, to fill the default slots range and support 8 Matter fabrics, 3 group keys per fabric, and 2 ICD users per fabric, set the :kconfig:option:`CONFIG_CHIP_MAX_FABRICS` Kconfig option to 8.
251
+
252
+
Slots arrangement within the slot range defined by :kconfig:option:`CONFIG_CHIP_KMU_SLOT_RANGE_START` and :kconfig:option:`CONFIG_CHIP_KMU_SLOT_RANGE_END` Kconfig options is calculated automatically in the code in the following way:
253
+
254
+
.. list-table:: KMU slots arrangement for Matter crypto materials
255
+
:widths: auto
256
+
:header-rows: 1
257
+
258
+
* - Crypto material
259
+
- Slot range start
260
+
- Slot range end
261
+
- Default slot range for 8 Matter fabrics to fit the default range (100-180)
- 176 - 179 (encrypted) or 178 - 179 (non-encrypted)
278
+
279
+
.. important::
280
+
281
+
Once a slot range is defined, it should not be changed during the firmware update process.
282
+
Changing the slot range will result in the loss of all cryptographic materials stored in the KMU.
283
+
You can safely change slot ranges only when the device is in the factory state and no cryptographic materials are stored in the KMU.
284
+
Otherwise, to extend the slot range beyond the previously defined range and keep the existing cryptographic materials stored in the KMU complete the following steps:
285
+
286
+
1. Locate the :file:`src/platform/nrfconnect/KMUKeyAllocator.h` file in the Matter repository, or create a new one with the same functionality.
287
+
#. Modify the file content to redirect the keys to the new slot range by implementing the ``GetDacKeyId``, ``GetOpKeyId``, and ``AllocateICDKeyId`` functions.
288
+
#. If you want to use your own implementation of the KMUKeyAllocator, assign it in your application code by calling the ``Crypto::SetPSAKeyAllocator`` method.
289
+
#. Ensure that you have chosen an available slot range that does not overlap with any existing one.
290
+
#. Build an application with the new configuration.
Copy file name to clipboardexpand all lines: doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst
+1
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,7 @@ Matter
163
163
* A description for the new :ref:`ug_matter_gs_tools_matter_west_commands_append` within the :ref:`ug_matter_gs_tools_matter_west_commands` page.
164
164
* New arguments to the :ref:`ug_matter_gs_tools_matter_west_commands_zap_tool_gui` to provide a custom cache directory and add new clusters to Matter Data Model.
165
165
* :ref:`ug_matter_debug_snippet`.
166
+
* Storing Matter key materials in the :ref:`matter_platforms_security_kmu`.
166
167
167
168
* Disabled the :ref:`mpsl` before performing factory reset to speed up the process.
0 commit comments