blob: f786af575d1e22c065411ee236d10f84ada89b48 [file] [log] [blame]
Julian Hall7b594622022-04-08 14:04:15 +01001Secure Storage Service
2======================
3Overview
4--------
Julian Hall2075a212021-03-24 10:11:29 +00005The Secure Storage service provides a generic persistent object store for valuable
6assets such as cryptographic keys. The confidentiality and integrity of stored data
7is typically achieved using keys that are bound to the device. The backend object
8store can be implemented in different ways, depending on available hardware such as:
9
10 * On-SoC secure world peripherals such as NV counters.
11 * A hardware unique key stored in OTP.
12 * Internal flash (on-die or in package).
13 * On-SoC crypto island with persistent storage.
14 * RPMB partition in a an external eMMC chip.
15
16The secure storage service provider architecture offers flexibility to use alternative
17backend storage implementations to suite available hardware.
18
19Service Access Protocol
20-----------------------
21A client accesses any instance of the Secure Storage service using a common secure
22storage access protocol. Although multiple secure storage service instances may exist
23on a device, they are all accessed using the same access protocol. By standardizing on
24a common protocol, client applications maintain compatibility with any secure storage
25provider instance.
26
27The protocol definition lives here::
28
29 protocols/service/secure_storage
30
31PSA Storage Classes
32-------------------
33Backend storage implementations that rely on external components, such as a flash chip,
34will require security measures that are not necessarily needed when on-chip or in-package
35storage is used. The PSA Storage API specification introduces the storage classes
36*Protected* and *Internal Trusted* to distinguish between externally and internally provided
37storage. These storage class designations are used for naming secure storage service instances.
38For example, the secure storage deployment that uses an RPMB backend is referred to as
39Protected Storage. The two storage classes have the following characteristics. Both
40classes of storage are required to support the notion of data ownership and to implement
41access control based on policy set by the owner.
42
43Internal Trusted Storage
44''''''''''''''''''''''''
45Internal trusted storage uses isolated or shielded locations for storage. Example
46storage backends could be on-die or in package flash memory that is inherently secure.
47Alternatively, storage may be delegated to an on-die secure enclave that offers equivalent
48security properities. An external storage device may also be used, as long as there is a
49cryptographic binding between the owning secure partition and the stored data that prevents
50unauthorized access to the storage device.
51
52To provide a persisent store for fundamental objects such as device ID and trust anchor
53certificates, access control based on the secure lifecycle state should be possible to
54support access policies such as r/w during manufacture but read-only in all other lifecycle
55states.
56
57Protected Storage
58'''''''''''''''''
59Protected storage uses an external memory device for persistent storage. To meet PSA
60security goals, the following protection measures should exist:
61
62 * Privacy and integrity protection to prevent data access and modification by an
63 unauthorized agent.
64 * Replay protection to prevent the current set of stored data being replaced by an
65 old set.
66
67Common implementation options for a protected store are:
68
69 * RPMB partition in an eMMC device. Access to the device is brokered by a normal-world
70 agent such as tee-supplicant.
71 * Dedicated serial flash device with secure-world only access.
72 * Normal-world filesystem for backend storage. Data is encrypted and integrity protected
73 in the secure-world.
74
75PSA Storage C API
76-----------------
77For client application developers who wish to use the PSA Storage API to access secure
78storage, two storage frontends are available; one that implements the Protected Storage
79API and another that implements the Internal Trusted Storage API.
80
81Storage Frontend and Backend Separation
82---------------------------------------
83For flexibility, secure storage components are separated between frontend and backend.
84All storage backends implement a common public interface and may be used with any storage
85frontend. A storage frontend presents an interface that suites a particular type of consumer.
86The following class diagram illustrates how a storage frontend is decoupled from any concrete
87storage backend through the use of an abstract storage backend interface.
88
89.. uml:: uml/SecureStorageClassDiagram.puml
90
91Some example storage frontends:
92
93 * Secure storage service provider - provides access using the secure storage access protocol.
94 * ITS frontend - provides secure storage access via PSA Internal Trusted Storage C API
95 * PS frontend - provides secure storage access via PSA Protected Storage C API
96
97Some example storage backends:
98
99 * RPMB storage backend
100 * Secure enclave storage backend
101 * Normal-world filesystem backend
102 * Secure storage service client
103
104Components related to storage frontends and backends live under the following TS project directories::
105
106 components/service/secure_storage/frontend
107 components/service/secure_storage/backend
108
109Storage Frontend and Backend Responsibilities
110---------------------------------------------
111A storage frontend is responsible for presenting an interface that is suitable for a particular
112type of consumer. For example, the Mbed TLS library depends on the PSA Internal Trusted Storage C
113API for accessing persistent storage. The ITS frontend provides an implementation of this API at
114its upper edge. Where appropriate, a storage frontend will be responsible for sanitizing input
115parameters.
116
117A storage backend is responsible for:
118
119 * Realizing the common storage backend interface.
120 * Implementing per object access control based on the provided client ID. The client ID associated
121 with the creator of an object is treated as the object owner.
122 * Providing persistent storage with appropriate security and robustness properties.
123
124Storage Factory
125---------------
126To decouple generic code from environment and platform specific code, a storage factory
127interface is defined that provides a common interface for constructing storage backends.
128A concrete storage factory may use environment specific methods and configuration to construct
129a suitable storage backend. Allows new storage backends to be added without impacting service
130provider implementations. The factory method uses PSA storage classifications to allow a
131service provider to specify the security characteristics of the backend. How those security
132characteristics are realized will depend on the secure processing environment and platform.
133
134A concrete storage factory may exploit any of the following to influence how the storage
135backend is constructed:
136
137 * Environment and platform specific factory component used in deployment
138 * Runtime configuration e.g. from Device Tree
139 * The PSA storage classification specified by the SP initialization code.
140
141Concrete storage factory components live under the following TS project directory::
142
143 components/service/secure_storage/factory
144
145Storage Frontend/Backend Combinations
146-------------------------------------
147The following storage frontend/backend combinations are used in different deployments.
148
149Persistent Key Store for Crypto Service Provider
150''''''''''''''''''''''''''''''''''''''''''''''''
151The Crypto service provider uses the Mbed Crypto portion of Mbed TLS to implement crypto
152operations. Persistent keys are stored via the PSA Internal Trusted Storage C API.
Imre Kis3d6848d2023-01-04 15:36:19 +0100153In the opteesp and sp deployments of the Crypto service provider, a storage client backend is
Julian Hall2075a212021-03-24 10:11:29 +0000154used that accesses a secure store provided by a separate secure partition. The following
155deployment diagram illustrates the storage frontend/backend combination used:
156
157.. uml:: uml/InternalTrustedDeploymentDiagram.puml
158
159Proxy for OP-TEE Provided Storage
160'''''''''''''''''''''''''''''''''
161When service providers are deployed in secure partitions running under OP-TEE, access
162to OP-TEE provided secure storage is possible via an S-EL1 SP that hosts a secure storage
163provider instance. The following deployment diagram illustrates how secure storage
164access is brokered by an S-EL0 proxy:
165
166.. uml:: uml/ProtectedProxyDeploymentDiagram.puml
167
168--------------
169
Imre Kis3d6848d2023-01-04 15:36:19 +0100170*Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.*
Julian Hall2075a212021-03-24 10:11:29 +0000171
172SPDX-License-Identifier: BSD-3-Clause