Skip to content

Commit 919b89e

Browse files
author
itayzafrir
committed
Change PSA_MAX_PERSISTENT_KEY_IDENTIFIER to 64 bits when using ITS
When compiling for SPM with ITS backend, the value of PSA_MAX_PERSISTENT_KEY_IDENTIFIER must be a 64 bit value instead of the default 32 bit. ITS UIDs are 64 bits and are expected to contain the partition id (32 bits) in the lower 32 bits, and the psa_key_id_t (32 bits) in the upper 32 bits of the ITS UID. In SPM, the NSPE partition id is defined as 0xffffffff, and since the crypto implementation reserves a range (0xffff0000-0xffffffff) of key ids for internal/future use, crypto key ids must be smaller than 0xffff0000ffffffff.
1 parent 92cf681 commit 919b89e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/psa_crypto_storage.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ extern "C" {
5959
* This limitation will probably become moot when we implement client
6060
* separation for key storage.
6161
*/
62+
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C)
63+
#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER 0xffff0000ffffffff
64+
#else
6265
#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER 0xffff0000
66+
#endif
6367

6468
/**
6569
* \brief Format key data and metadata and save to a location for given key

0 commit comments

Comments
 (0)