-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
secure_storage: add a global registry header file for PSA key IDs
We need to make sure that within Zephyr different users of the PSA APIs don't interfere with each other because of using the same numerical IDs for persistent assets. This takes care of the PSA key IDs when using persistent keys through the PSA Crypto API. See the comments in `<zephyr/psa/key_ids.h>` for more information. This removes the recently-introduced Kconfig options that allowed changing the base IDs subsystems were using for their persistent keys. Signed-off-by: Tomi Fontanilles <[email protected]>
- Loading branch information
Showing
13 changed files
with
103 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* Copyright (c) 2025 Nordic Semiconductor | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#ifndef ZEPHYR_PSA_KEY_IDS_H_ | ||
#define ZEPHYR_PSA_KEY_IDS_H_ | ||
|
||
/** | ||
* @file zephyr/psa/key_ids.h | ||
* | ||
* @brief This file defines the key ID ranges of the existing users of the PSA Crypto API. | ||
* | ||
* In addition to the application, different subsystems store and use persistent keys through the | ||
* PSA Crypto API. Because they are not aware of each other, collisions are avoided by having them | ||
* use different ID ranges. | ||
* This file acts as the registry of all the allocated PSA key ID ranges within Zephyr. | ||
* | ||
* The end-user application also has a dedicated range, `ZEPHYR_PSA_APPLICATION_KEY_ID_RANGE_BEGIN`. | ||
* | ||
* Some of the IDs below are based on previously existing and used values, while others | ||
* are chosen to be somewhere in the PSA user key ID range to try to avoid collisions | ||
* (avoiding, for example, the very beginning of the range). | ||
*/ | ||
|
||
#include <stdint.h> | ||
typedef uint32_t psa_key_id_t; | ||
|
||
/** PSA key ID range to be used by OpenThread. The base ID is equal to the default value upstream: | ||
* https://github.com/openthread/openthread/blob/thread-reference-20230706/src/core/config/platform.h#L138 | ||
*/ | ||
#define ZEPHYR_PSA_OPENTHREAD_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x20000 | ||
#define ZEPHYR_PSA_OPENTHREAD_KEY_ID_RANGE_SIZE 0x10000 /* 64 Ki */ | ||
|
||
/** PSA key ID range to be used by Matter. The base ID is equal to the default value upstream: | ||
* https://github.com/project-chip/connectedhomeip/blob/v1.4.0.0/src/crypto/CHIPCryptoPALPSA.h#L55 | ||
*/ | ||
#define ZEPHYR_PSA_MATTER_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x30000 | ||
#define ZEPHYR_PSA_MATTER_KEY_ID_RANGE_SIZE 0x10000 /* 64 Ki */ | ||
|
||
/** PSA key ID range to be used by Bluetooth Mesh. */ | ||
#define ZEPHYR_PSA_BT_MESH_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x20000000 | ||
#define ZEPHYR_PSA_BT_MESH_KEY_ID_RANGE_SIZE 0xC000 /* 48 Ki */ | ||
|
||
/** PSA key ID range to be used by Wi-Fi credentials management. */ | ||
#define ZEPHYR_PSA_WIFI_CREDENTIALS_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x20010000 | ||
#define ZEPHYR_PSA_WIFI_CREDENTIALS_KEY_ID_RANGE_SIZE 0x100 /* 256 */ | ||
|
||
/** PSA key ID range to be used by the end-user application. */ | ||
#define ZEPHYR_PSA_APPLICATION_KEY_ID_RANGE_BEGIN (psa_key_id_t)0x30000000 | ||
#define ZEPHYR_PSA_APPLICATION_KEY_ID_RANGE_SIZE 0x100000 /* 1 Mi */ | ||
|
||
#endif /* ZEPHYR_PSA_KEY_IDS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.