Skip to content
Commit 806c3441 authored by Tomi Fontanilles's avatar Tomi Fontanilles Committed by Benjamin Cabé
Browse files

secure_storage: make UIDs 32-bit



Make the storage UID type 32-bit long.
This makes it more convenient to use those UIDs as storage entry IDs
when storing the entries to NVM.
The previous 64+ bits UIDs made it incovenient to use them as such.
As Zephyr defines UID ranges to be used (see
e.g. `zephyr/psa/key_ids.h`), this guarantees that all the UIDs will
fit within the 30 bits reserved for them.

The secure storage ITS implementation API is changed to take
`psa_storage_uid_t` separately so the implementation can check
that no forbidden bits are set before they are packed into
`secure_storage_its_uid_t`.

This change breaks backward compatibility because
`secure_storage_its_uid_t`, which is used both as part of the additional
data for authentication and for generating encryption keys, changes
size from 12 to 4 bytes.
For users wanting to preserve backward compatibility (for example when
upgrading an existing installation to a newer Zephyr release) or that
for some reason want to use a 64-bit `psa_storage_uid_t`, the Kconfig
option CONFIG_SECURE_STORAGE_64_BIT_UID is added. When enabled, it
makes the implementation behave the same as previously and compatibility
with existing entries is preserved. This was tested manually.

Fixes zephyrproject-rtos/zephyr#86177.

Signed-off-by: default avatarTomi Fontanilles <tomi.fontanilles@nordicsemi.no>
parent db8274a5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment