Skip to content

Commit 571e601

Browse files
tomi-fontcarlescufi
authored andcommitted
doc: secure_storage: add documentation for the secure storage subsystem
It includes both the high-level documentation of the subsystem and that of APIs defined in code (PSA Secure Storage and internal APIs of the subsystem). Signed-off-by: Tomi Fontanilles <[email protected]>
1 parent c9a59dd commit 571e601

File tree

6 files changed

+129
-4
lines changed

6 files changed

+129
-4
lines changed

MAINTAINERS.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4114,6 +4114,7 @@ Secure storage:
41144114
files:
41154115
- subsys/secure_storage/
41164116
- samples/psa/
4117+
- doc/services/secure_storage.rst
41174118
- tests/subsys/secure_storage/
41184119
labels:
41194120
- "area: Secure storage"

doc/releases/release-notes-4.0.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ We are pleased to announce the release of Zephyr version 4.0.0.
99

1010
Major enhancements with this release include:
1111

12+
* The introduction of the :ref:`secure storage<secure_storage>` subsystem. It allows the use of the
13+
PSA Secure Storage API and of persistent keys in the PSA Crypto API on all board targets. It
14+
is now the standard way to provide device-specific protection to data at rest. (:github:`76222`)
15+
1216
An overview of the changes required or recommended when migrating your application from Zephyr
1317
v3.7.0 to Zephyr v4.0.0 can be found in the separate :ref:`migration guide<migration_4.0>`.
1418

doc/services/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ OS Services
66
.. toctree::
77
:maxdepth: 1
88

9-
109
binary_descriptors/index.rst
1110
console.rst
1211
crypto/index
@@ -30,6 +29,7 @@ OS Services
3029
portability/index.rst
3130
poweroff.rst
3231
profiling/index.rst
32+
secure_storage.rst
3333
shell/index.rst
3434
serialization/index.rst
3535
settings/index.rst

doc/services/secure_storage.rst

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
.. _secure_storage:
2+
3+
Secure storage
4+
##############
5+
6+
| The secure storage subsystem provides an implementation of the functions defined in the
7+
`Platform Security Architecture (PSA) Secure Storage API <https://arm-software.github.io/psa-api/storage/>`_.
8+
| It can be enabled on :term:`board targets<board target>`
9+
that don't already have an implementation of the API.
10+
11+
Overview
12+
********
13+
14+
The secure storage subsystem makes the PSA Secure Storage API available on all board targets with
15+
non-volatile memory support.
16+
As such, it provides an implementation of the API on those that don't already have one, ensuring
17+
functional support for the API.
18+
Board targets with :ref:`tfm` enabled (ending in ``/ns``), for instance,
19+
cannot enable the subsystem because TF-M already provides an implementation of the API.
20+
21+
| In addition to providing functional support for the API, depending on
22+
device-specific security features and the configuration, the subsystem
23+
may secure the data stored via the PSA Secure Storage API at rest.
24+
| Keep in mind, however, that it's preferable to use a secure processing environment like TF-M when
25+
possible because it's able to provide more security due to isolation guarantees.
26+
27+
Limitations
28+
***********
29+
30+
The secure storage subsystem's implementation of the PSA Secure Storage API:
31+
32+
* does not aim at full compliance with the specification.
33+
34+
| Its foremost goal is functional support for the API on all board targets.
35+
| See below for important ways the implementation deviates from the specification.
36+
37+
* does not guarantee that the data it stores will be secure at rest in all cases.
38+
39+
This depends on device-specific security features and the configuration.
40+
41+
* does not yet provide an implementation of the Protected Storage (PS) API as of this writing.
42+
43+
Instead, the PS API directly calls into the Internal Trusted Storage (ITS) API
44+
(unless a `custom implementation <#whole-api>`_ of the PS API is provided).
45+
46+
Below are some ways the implementation deviates from the specification
47+
and an explanation why. This is not an exhaustive list.
48+
49+
* The data stored in the ITS is by default encrypted and authenticated (Against ``1.`` in
50+
`3.2. Internal Trusted Storage requirements <https://arm-software.github.io/psa-api/storage/1.0/overview/requirements.html#internal-trusted-storage-requirements>`_.)
51+
52+
| The specification considers the storage underlying the ITS to be
53+
``implicitly confidential and protected from replay``
54+
(`2.4. The Internal Trusted Storage API <https://arm-software.github.io/psa-api/storage/1.0/overview/architecture.html#the-internal-trusted-storage-api>`_)
55+
because ``most embedded microprocessors (MCU) have on-chip flash storage that can be made
56+
inaccessible except to software running on the MCU``
57+
(`2.2. Technical Background <https://arm-software.github.io/psa-api/storage/1.0/overview/architecture.html#technical-background>`_).
58+
| This is not the case on all MCUs. Thus, additional protection is provided to the stored data.
59+
60+
However, this does not guarantee that the data stored will be secure at rest in all cases,
61+
because this depends on device-specific security features and the configuration.
62+
It requires a random entropy source and especially a secure encryption key provider
63+
(:kconfig:option:`CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER`).
64+
65+
In addition, the data stored in the ITS is not protected against replay attacks,
66+
because this requires storage that is protected by hardware.
67+
68+
* The data stored via the PSA Secure Storage API is not protected from direct
69+
read/write by software or debugging. (Against ``2.`` and ``10.`` in
70+
`3.2. Internal Trusted Storage requirements <https://arm-software.github.io/psa-api/storage/1.0/overview/requirements.html#internal-trusted-storage-requirements>`_.)
71+
72+
It is only secured at rest. Protecting it at runtime as well
73+
requires specific hardware mechanisms to support this.
74+
75+
Configuration
76+
*************
77+
78+
To configure the implementation of the PSA Secure Storage API provided by Zephyr, have a look at the
79+
``CONFIG_SECURE_STORAGE_.*`` Kconfig options. They are defined in the various Kconfig files found
80+
under ``subsys/secure_storage/``.
81+
82+
Customization
83+
*************
84+
85+
Custom implementations can also replace those of Zephyr at different levels
86+
if the functionality provided by the existing implementations isn't enough.
87+
88+
Whole API
89+
=========
90+
91+
If you already have an implementation of the whole ITS or PS API and want to make use of it, you
92+
can do so by enabling the following Kconfig option and implementing the relevant functions:
93+
94+
* :kconfig:option:`CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM`, for the ITS API.
95+
* :kconfig:option:`CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_CUSTOM`, for the PS API.
96+
97+
ITS API
98+
=======
99+
100+
Zephyr's implementation of the ITS API
101+
(:kconfig:option:`CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR`)
102+
makes use of the ITS transform and store modules, which can be configured and customized separately.
103+
Have a look at the ``CONFIG_SECURE_STORAGE_ITS_(STORE|TRANSFORM)_.*_CUSTOM``
104+
Kconfig options to see the different customization possibilities.
105+
106+
It's especially recommended to implement a custom encryption key provider
107+
(:kconfig:option:`CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM`)
108+
that is more secure than the available options, if possible.
109+
110+
Samples
111+
*******
112+
113+
* :zephyr:code-sample:`persistent_key`
114+
* :zephyr:code-sample:`psa_its`
115+
116+
PSA Secure Storage API reference
117+
********************************
118+
119+
.. doxygengroup:: psa_secure_storage

doc/services/tfm/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _tfm:
22

3-
Trusted Firmware-M
4-
##################
3+
Trusted Firmware-M (TF-M)
4+
#########################
55

66
.. toctree::
77
:maxdepth: 1

doc/zephyr.doxyfile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ INPUT = @ZEPHYR_BASE@/doc/_doxygen/mainpage.md \
980980
@ZEPHYR_BASE@/include/ \
981981
@ZEPHYR_BASE@/lib/libc/minimal/include/ \
982982
@ZEPHYR_BASE@/subsys/testsuite/include/ \
983-
@ZEPHYR_BASE@/subsys/testsuite/ztest/include/
983+
@ZEPHYR_BASE@/subsys/testsuite/ztest/include/ \
984+
@ZEPHYR_BASE@/subsys/secure_storage/include/ \
984985

985986
# This tag can be used to specify the character encoding of the source files
986987
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses

0 commit comments

Comments
 (0)