Line data Source code
1 1 : /* Copyright (c) 2025 Nordic Semiconductor
2 : * SPDX-License-Identifier: Apache-2.0
3 : */
4 : #ifndef ZEPHYR_PSA_KEY_IDS_H_
5 : #define ZEPHYR_PSA_KEY_IDS_H_
6 :
7 : /**
8 : * @file zephyr/psa/key_ids.h
9 : *
10 : * @brief This file defines the key ID ranges of the existing users of the PSA Crypto API.
11 : *
12 : * In addition to the application, different subsystems store and use persistent keys through the
13 : * PSA Crypto API. Because they are not aware of each other, collisions are avoided by having them
14 : * use different ID ranges.
15 : * This file acts as the registry of all the allocated PSA key ID ranges within Zephyr.
16 : *
17 : * The end-user application also has a dedicated range, `ZEPHYR_PSA_APPLICATION_KEY_ID_RANGE_BEGIN`.
18 : *
19 : * Some of the IDs below are based on previously existing and used values, while others
20 : * are chosen to be somewhere in the PSA user key ID range to try to avoid collisions
21 : * (avoiding, for example, the very beginning of the range).
22 : */
23 :
24 : #include <stdint.h>
25 0 : typedef uint32_t psa_key_id_t;
26 :
27 : /** PSA key ID range to be used by OpenThread. The base ID is equal to the default value upstream:
28 : * https://github.com/openthread/openthread/blob/thread-reference-20230706/src/core/config/platform.h#L138
29 : */
30 1 : #define ZEPHYR_PSA_OPENTHREAD_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x20000
31 0 : #define ZEPHYR_PSA_OPENTHREAD_KEY_ID_RANGE_SIZE 0x10000 /* 64 Ki */
32 :
33 : /** PSA key ID range to be used by Matter. The base ID is equal to the default value upstream:
34 : * https://github.com/project-chip/connectedhomeip/blob/v1.4.0.0/src/crypto/CHIPCryptoPALPSA.h#L55
35 : */
36 1 : #define ZEPHYR_PSA_MATTER_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x30000
37 0 : #define ZEPHYR_PSA_MATTER_KEY_ID_RANGE_SIZE 0x10000 /* 64 Ki */
38 :
39 : /** PSA key ID range to be used by Bluetooth Mesh. */
40 1 : #define ZEPHYR_PSA_BT_MESH_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x20000000
41 0 : #define ZEPHYR_PSA_BT_MESH_KEY_ID_RANGE_SIZE 0xC000 /* 48 Ki */
42 :
43 : /** PSA key ID range to be used by Wi-Fi credentials management. */
44 1 : #define ZEPHYR_PSA_WIFI_CREDENTIALS_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x20010000
45 0 : #define ZEPHYR_PSA_WIFI_CREDENTIALS_KEY_ID_RANGE_SIZE 0x100 /* 256 */
46 :
47 : /** PSA key ID range to be used by the end-user application. */
48 1 : #define ZEPHYR_PSA_APPLICATION_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x30000000
49 0 : #define ZEPHYR_PSA_APPLICATION_KEY_ID_RANGE_SIZE 0x100000 /* 1 Mi */
50 :
51 : #endif /* ZEPHYR_PSA_KEY_IDS_H_ */
|