blob: 1bf35f50db48995672e484affd828c74b7dd2660 [file] [log] [blame]
Kevin Pengc6d74502020-03-04 16:55:37 +08001###########################################
2Protected Storage Service Integration Guide
3###########################################
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02004
5************
6Introduction
7************
Kevin Pengc6d74502020-03-04 16:55:37 +08008TF-M Protected Storage (PS) service implements PSA Protected Storage APIs.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02009
10The service is backed by hardware isolation of the flash access domain and, in
11the current version, relies on hardware to isolate the flash area from
12non-secure access. In absence of hardware level isolation, the secrecy and
13integrity of data is still maintained.
14
Kevin Pengc6d74502020-03-04 16:55:37 +080015The PS service implements an AES-GCM based AEAD encryption policy, as a
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020016reference, to protect data integrity and authenticity.
17
Kevin Pengc6d74502020-03-04 16:55:37 +080018PS reuses the non-hierarchical filesystem provided by the TF-M Internal Trusted
Jamie Foxdd3de952019-11-25 17:45:40 +000019Storage service to store encrypted, authenticated objects on the external flash
20device.
21
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020022The design addresses the following high level requirements as well:
23
24- **Confidentiality** - Resistance to unauthorised accesses through
25 hardware/software attacks.
Antonio de Angelisee774c22019-05-03 13:44:01 +010026
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020027- **Access Authentication** - Mechanism to establish requester's identity (a
28 non-secure entity, secure entity, or a remote server).
Antonio de Angelisee774c22019-05-03 13:44:01 +010029
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020030- **Integrity** - Resistant to tampering by either the normal users of a product,
31 package, or system or others with physical access to it. If the content of the
Kevin Pengc6d74502020-03-04 16:55:37 +080032 protected storage is changed maliciously, the service is able to detect it.
Antonio de Angelisee774c22019-05-03 13:44:01 +010033
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020034- **Reliability** - Resistant to power failure scenarios and incomplete write
35 cycles.
Antonio de Angelisee774c22019-05-03 13:44:01 +010036
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020037- **Configurability** - High level configurability to scale up/down memory
38 footprint to cater for a variety of devices with varying security
39 requirements.
Antonio de Angelisee774c22019-05-03 13:44:01 +010040
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020041- **Performance** - Optimized to be used for resource constrained devices with
42 very small silicon footprint, the PPA (power, performance, area) should be
43 optimal.
44
Kevin Pengc6d74502020-03-04 16:55:37 +080045******************************
46Current PS Service Limitations
47******************************
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020048- **Fragmentation** - The current design does not support fragmentation, as an
49 asset is stored in a contiguous space in a block. This means that the maximum
50 asset size can only be up-to a block size. Detailed information about the
51 maximum asset size can be found in the section `Maximum asset size` below.
52 Each block can potentially store multiple assets.
53 A delete operation implicitly moves all the assets towards the top of the block
54 to avoid fragmentation within block. However, this may also result in
55 unutilized space at the end of each block.
Antonio de Angelisee774c22019-05-03 13:44:01 +010056
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020057- **Asset size limitation** - An asset is stored in a contiguous space in a
58 block/sector. Hence, the maximum asset size can be up-to the size of the
59 data block/sector. Detailed information about the maximum asset size can be
60 found in the section `Maximum asset size` below.
Antonio de Angelisee774c22019-05-03 13:44:01 +010061
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020062- **Non-hierarchical storage model** - The current design uses a
63 non-hierarchical storage model, as a filesystem, where all the assets are
64 managed by a linearly indexed list of metadata. This model locates the
65 metadata in blocks which are always stored in the same flash location. That
66 increases the number of writes in a specific flash location as every change in
67 the storage area requires a metadata update.
Antonio de Angelisee774c22019-05-03 13:44:01 +010068
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020069- **PSA internal trusted storage API** - In the current design, the service does
70 not use the PSA Internal Trusted Storage API to write the rollback protection
TudorCretuc0e4bee2019-07-23 11:38:21 +010071 values stored in the internal storage.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020072
73- **Protection against physical storage medium failure** - Complete handling of
74 inherent failures of storage mediums (e.g. bad blocks in a NAND based device)
75 is not supported by the current design.
76
77- **Key diversification** - In a more robust design, each asset would be
78 encrypted through a different key.
79
80- **Lifecycle management** - Currently, it does not support any subscription
81 based keys and certificates required in a secure lifecycle management. Hence,
82 an asset's validity time-stamp can not be invalidated based on the system
83 time.
84
85- **Provisioning vs user/device data** - In the current design, all assets are
86 treated in the same manner. In an alternative design, it may be required to
87 create separate partitions for provisioning content and user/device generated
88 content. This is to allow safe update of provisioning data during firmware
89 updates without the need to wipe out the user/device generated data.
90
91**************
92Code Structure
93**************
Kevin Pengc6d74502020-03-04 16:55:37 +080094Protected storage service code is located in
95``secure_fw/partitions/protected_storage/`` and is divided as follows:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020096
97 - Core files
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020098 - Cryptographic interfaces
99 - Non-volatile (NV) counters interfaces
100
Kevin Pengc6d74502020-03-04 16:55:37 +0800101The PSA PS interfaces for PS service are located in ``interface/include/psa``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200102
103PSA Protected Storage Interfaces
104================================
105
Kevin Pengc6d74502020-03-04 16:55:37 +0800106The PS service exposes the following mandatory PSA PS interfaces, version 1.0:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200107
108.. code-block:: c
109
Minos Galanakise06c6f62020-03-10 15:44:32 +0000110 psa_status_t psa_ps_set(psa_storage_uid_t uid, size_t data_length, const void *p_data, psa_storage_create_flags_t create_flags);
111 psa_status_t psa_ps_get(psa_storage_uid_t uid, size_t data_offset, size_t data_size, void *p_data, size_t *p_data_length);
112 psa_status_t psa_ps_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info);
113 psa_status_t psa_ps_remove(psa_storage_uid_t uid);
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200114 uint32_t psa_ps_get_support(void);
115
116For the moment, it does not support the extended version of those APIs.
117
Kevin Pengc6d74502020-03-04 16:55:37 +0800118These PSA PS interfaces and PS TF-M types are defined and documented in
Minos Galanakise06c6f62020-03-10 15:44:32 +0000119``interface/include/psa/protected_storage.h``,
120``interface/include/psa/storage_common.h`` and
Kevin Pengc6d74502020-03-04 16:55:37 +0800121``interface/include/tfm_ps_defs.h``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200122
123Core Files
124==========
Kevin Pengc6d74502020-03-04 16:55:37 +0800125- ``tfm_ps_req_mngr.c`` - Contains the PS request manager implementation which
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200126 handles all requests which arrive to the service. This layer extracts the
127 arguments from the input and output vectors, and it calls the protected
128 storage layer with the provided parameters.
129
130- ``tfm_protected_storage.c`` - Contains the TF-M protected storage API
Kevin Pengc6d74502020-03-04 16:55:37 +0800131 implementations which are the entry points to the PS service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200132
Kevin Pengc6d74502020-03-04 16:55:37 +0800133- ``ps_object_system.c`` - Contains the object system implementation to manage
134 all objects in PS area.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200135
Kevin Pengc6d74502020-03-04 16:55:37 +0800136- ``ps_object_table.c`` - Contains the object system table implementation which
137 complements the object system to manage all object in the PS area.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200138 The object table has an entry for each object stored in the object system
139 and keeps track of its version and owner.
140
Kevin Pengc6d74502020-03-04 16:55:37 +0800141- ``ps_encrypted_object.c`` - Contains an implementation to manipulate
142 encrypted objects in the PS object system.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200143
Kevin Pengc6d74502020-03-04 16:55:37 +0800144- ``ps_utils.c`` - Contains common and basic functionalities used across the
145 PS service code.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200146
Jamie Foxdd3de952019-11-25 17:45:40 +0000147Flash Filesystem and Flash Interfaces
148=====================================
Kevin Pengc6d74502020-03-04 16:55:37 +0800149The PS service reuses the non-hierarchical filesystem and flash interfaces
Jamie Foxdd3de952019-11-25 17:45:40 +0000150provided by the TF-M Internal Trusted Storage service. It stores encrypted,
151authenticated objects on the external flash device by making service calls to
Kevin Pengc6d74502020-03-04 16:55:37 +0800152the ITS service. When the ITS service receives requests from the PS partition,
Jamie Foxdd3de952019-11-25 17:45:40 +0000153it handles the request by using a separate filesystem context initialised to use
154the external flash device.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200155
Jamie Foxdd3de952019-11-25 17:45:40 +0000156The ITS filesystem and flash interfaces and their implementation can be found in
Ken Liu738a4b02020-06-04 14:52:38 +0800157``secure_fw/partitions/internal_trusted_storage/flash_fs`` and
158``secure_fw/partitions/internal_trusted_storage/flash`` respectively. More
Jamie Foxdd3de952019-11-25 17:45:40 +0000159information about the filesystem and flash interfaces can be found in the
160:doc:`ITS integration guide
Minos Galanakise4094012020-06-12 14:25:34 +0100161</docs/reference/services/tfm_its_integration_guide>`.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200162
Jamie Foxdd3de952019-11-25 17:45:40 +0000163The structure containing info about the external flash device, used by the ITS
Kevin Pengc6d74502020-03-04 16:55:37 +0800164service to handle requests from the PS partition, is defined in
Ken Liu738a4b02020-06-04 14:52:38 +0800165``secure_fw/partitions/internal_trusted_storage/flash/its_flash_info_external.c``,
Jamie Foxdd3de952019-11-25 17:45:40 +0000166which depends on target-specific definitions from
167``platform/ext/target/<TARGET_NAME>/partition/flash_layout.h``. Please see the
Kevin Pengc6d74502020-03-04 16:55:37 +0800168`Protected Storage Service Definitions` section for details.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200169
170Cryptographic Interface
171=======================
Kevin Pengc6d74502020-03-04 16:55:37 +0800172- ``crypto/ps_crypto_interface.h`` - Abstracts the cryptographic operations for
173 the protected storage service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200174
Kevin Pengc6d74502020-03-04 16:55:37 +0800175- ``crypto/ps_crypto_interface.c`` - Implements the PS service cryptographic
Antonio de Angelisee774c22019-05-03 13:44:01 +0100176 operations with calls to the TF-M Crypto service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200177
178Non-volatile (NV) Counters Interface
179====================================
Kevin Pengc6d74502020-03-04 16:55:37 +0800180The current PS service provides rollback protection based on NV
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200181counters.
Kevin Pengc6d74502020-03-04 16:55:37 +0800182PS defines and implements the following NV counters functionalities:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200183
Kevin Pengc6d74502020-03-04 16:55:37 +0800184- ``nv_counters/ps_nv_counters.h`` - Abstracts PS non-volatile
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200185 counters operations. This API detaches the use of NV counters from the TF-M NV
186 counters implementation, provided by the platform, and provides a mechanism to
Kevin Pengc6d74502020-03-04 16:55:37 +0800187 compile in a different API implementation for test purposes. A PS test suite
188 **may** provide its own custom implementation to be able to test different PS
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200189 service use cases.
190
Kevin Pengc6d74502020-03-04 16:55:37 +0800191- ``nv_counters/ps_nv_counters.c`` - Implements the PS NV counters interfaces
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200192 based on TF-M NV counters implementation provided by the platform.
193
Kevin Pengc6d74502020-03-04 16:55:37 +0800194****************************
195PS Service Integration Guide
196****************************
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200197This section describes mandatory (i.e. **must** implement) or optional
198(i.e. **may** implement) interfaces which the system integrator have to take
Kevin Pengc6d74502020-03-04 16:55:37 +0800199in to account in order to integrate the protected storage service in a new
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200200platform.
201
202Maximum Asset Size
203==================
204An asset is stored in a contiguous space in a block/sector. The maximum
205size of an asset can be up-to the size of the data block/sector minus the object
Kevin Pengc6d74502020-03-04 16:55:37 +0800206header size (``PS_OBJECT_HEADER_SIZE``) which is defined in
207``ps_object_defs.h``. The ``PS_OBJECT_HEADER_SIZE`` changes based on the
208``PS_ENCRYPTION`` flag status.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200209
Kevin Pengc6d74502020-03-04 16:55:37 +0800210Protected Storage Service Definitions
211=====================================
212The PS service requires the following platform definitions:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200213
Kevin Pengc6d74502020-03-04 16:55:37 +0800214- ``PS_SECTOR_SIZE`` - Defines the size of the flash sectors (the smallest
Jamie Foxdd3de952019-11-25 17:45:40 +0000215 erasable unit) in bytes.
Kevin Pengc6d74502020-03-04 16:55:37 +0800216- ``PS_SECTORS_PER_BLOCK`` - Defines the number of contiguous PS_SECTOR_SIZE
Jamie Foxdd3de952019-11-25 17:45:40 +0000217 to form a logical block in the filesystem.
Kevin Pengc6d74502020-03-04 16:55:37 +0800218- ``PS_FLASH_DEV_NAME`` - Specifies the flash device used by PS to store the
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200219 data.
Kevin Pengc6d74502020-03-04 16:55:37 +0800220- ``PS_FLASH_PROGRAM_UNIT`` - Defines the smallest flash programmable unit in
221 bytes. Valid values are powers of two between 1 and ``PS_SECTOR_SIZE``
Jamie Foxd70da212019-11-28 14:41:45 +0000222 inclusive.
Kevin Pengc6d74502020-03-04 16:55:37 +0800223- ``PS_MAX_ASSET_SIZE`` - Defines the maximum asset size to be stored in the
224 PS area. This size is used to define the temporary buffers used by PS to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200225 read/write the asset content from/to flash. The memory used by the temporary
Kevin Pengc6d74502020-03-04 16:55:37 +0800226 buffers is allocated statically as PS does not use dynamic memory allocation.
227- ``PS_NUM_ASSETS`` - Defines the maximum number of assets to be stored in the
228 PS area. This number is used to dimension statically the object table size in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200229 RAM (fast access) and flash (persistent storage). The memory used by the
Kevin Pengc6d74502020-03-04 16:55:37 +0800230 object table is allocated statically as PS does not use dynamic memory
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200231 allocation.
232
Kevin Pengc6d74502020-03-04 16:55:37 +0800233The sectors reserved to be used as protected storage **must** be contiguous
234sectors starting at ``PS_FLASH_AREA_ADDR``.
Jamie Foxdd3de952019-11-25 17:45:40 +0000235
236The design requires either 2 blocks, or any number of blocks greater than or
237equal to 4. Total number of blocks can not be 0, 1 or 3. This is a design choice
238limitation to provide power failure safe update operations.
Vikas Katariya7d74ddb2019-09-19 11:59:57 +0100239
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200240Target must provide a header file, called ``flash_layout.h``, which defines the
241information explained above. The defines must be named as they are specified
242above.
243
Kevin Pengc6d74502020-03-04 16:55:37 +0800244More information about the ``flash_layout.h`` content, not PS related, is
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200245available in :doc:`platform readme </platform/ext/readme>` along with other
246platform information.
247
Chris Brandc47d7102020-02-20 11:12:18 -0800248The following optional platform definitions may also be defined in
249``flash_layout.h`` or set at build time in ``platform/ext/<TARGET_NAME>.cmake``:
250
251- ``PS_FLASH_AREA_ADDR`` - Defines the flash address where the protected storage
252 area starts.
253 If not defined, the platform must implement ``tfm_hal_ps_fs_info()``.
254- ``PS_FLASH_AREA_SIZE`` - Defines the size of the dedicated flash area
255 for protected storage in bytes.
256 If not defined, the platform must implement ``tfm_hal_ps_fs_info()``.
257
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200258TF-M NV Counter Interface
259=========================
260To have a platform independent way to access the NV counters, TF-M defines a
261platform NV counter interface. For API specification, please check:
262``platform/include/tfm_plat_nv_counters.h``
263
264The system integrators **may** implement this interface based on the target
Kevin Pengc6d74502020-03-04 16:55:37 +0800265capabilities and set the ``PS_ROLLBACK_PROTECTION`` flag to compile in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200266the rollback protection code.
267
268Secret Platform Unique Key
269==========================
270The encryption policy relies on a secret hardware unique key (HUK) per device.
271It is system integrator's responsibility to provide an implementation which
272**must** be a non-mutable target implementation.
273For API specification, please check:
274``platform/include/tfm_plat_crypto_keys.h``
275
276A stub implementation is provided in
David Hu31c574dc2019-12-05 18:25:44 +0800277``platform/ext/common/template/crypto_keys.c``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200278
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200279Non-Secure Identity Manager
280===========================
281TF-M core tracks the current client IDs running in the secure or non-secure
282processing environment. It provides a dedicated API to retrieve the client ID
283which performs the service request.
284
Minos Galanakise4094012020-06-12 14:25:34 +0100285:doc:`NS client identification documentation </docs/getting_started/tfm_ns_client_identification>`
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200286provides further details on how client identification works.
287
Kevin Pengc6d74502020-03-04 16:55:37 +0800288PS service uses that TF-M core API to retrieve the client ID and associate it
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200289as the owner of an asset. Only the owner can read, write or delete that asset
290based on the creation flags.
291
Minos Galanakise4094012020-06-12 14:25:34 +0100292The :doc:`integration guide </docs/getting_started/tfm_integration_guide>` provides further
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200293details of non-secure implementation requirements for TF-M.
294
295Cryptographic Interface
296=======================
297The reference encryption policy is built on AES-GCM, and it **may** be replaced
298by a vendor specific implementation.
299
Kevin Pengc6d74502020-03-04 16:55:37 +0800300The PS service abstracts all the cryptographic requirements and specifies the
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200301required cryptographic interface in
Kevin Pengc6d74502020-03-04 16:55:37 +0800302``secure_fw/partitions/protected_storage/crypto/ps_crypto_interface.h``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200303
Kevin Pengc6d74502020-03-04 16:55:37 +0800304The PS service cryptographic operations are implemented in
305``secure_fw/partitions/protected_storage/crypto/ps_crypto_interface.c``, using
306calls to the TF-M Crypto service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200307
Kevin Pengc6d74502020-03-04 16:55:37 +0800308PS Service Features Flags
309=========================
310PS service defines a set of flags that can be used to compile in/out certain
311PS service features. The ``CommonConfig.cmake`` file sets the default values
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200312of those flags. However, those flags values can be overwritten by setting them
313in ``platform/ext/<TARGET_NAME>.cmake`` based on the target capabilities or
Kevin Pengc6d74502020-03-04 16:55:37 +0800314needs. The list of PS services flags are:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200315
Kevin Pengc6d74502020-03-04 16:55:37 +0800316- ``PS_ENCRYPTION``- this flag allows to enable/disable encryption
317 option to encrypt the protected storage data.
318- ``PS_CREATE_FLASH_LAYOUT``- this flag indicates that it is required
319 to create a PS flash layout. If this flag is set, PS service will
320 generate an empty and valid PS flash layout to store assets. It will
321 erase all data located in the assigned PS memory area before generating
322 the PS layout. This flag is required to be set if the PS memory area
323 is located in a non-persistent memory. This flag can be set if the PS
324 memory area is located in a persistent memory without a valid PS flash
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200325 layout in it. That is the case when it is the first time in the device
Kevin Pengc6d74502020-03-04 16:55:37 +0800326 life that the PS service is executed.
327- ``PS_VALIDATE_METADATA_FROM_FLASH``- this flag allows to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200328 enable/disable the validation mechanism to check the metadata store in flash
329 every time the flash data is read from flash. This validation is required
330 if the flash is not hardware protected against malicious writes. In case
331 the flash is protected against malicious writes (i.e embedded flash, etc),
332 this validation can be disabled in order to reduce the validation overhead.
Kevin Pengc6d74502020-03-04 16:55:37 +0800333- ``PS_ROLLBACK_PROTECTION``- this flag allows to enable/disable
334 rollback protection in protected storage service. This flag takes effect only
335 if the target has non-volatile counters and ``PS_ENCRYPTION`` flag is on.
Jamie Foxf58bd222020-06-12 18:21:25 +0100336- ``PS_RAM_FS``- setting this flag to ``ON`` enables the use of RAM instead of
337 the persistent storage device to store the FS in the Protected Storage
338 service. This flag is ``OFF`` by default. The PS regression tests write/erase
339 storage multiple time, so enabling this flag can increase the life of flash
340 memory when testing.
Chris Brandc47d7102020-02-20 11:12:18 -0800341 If this flag is set to ``ON``, PS_RAM_FS_SIZE must also be provided. This
342 specifies the size of the block of RAM to be used to simulate the flash.
Soby Mathew728a20a2020-03-25 13:33:35 +0000343
344 .. Note::
Jamie Foxf58bd222020-06-12 18:21:25 +0100345 If this flag is disabled when running the regression tests, then it is
346 recommended that the persistent storage area is erased before running the
347 tests to ensure that all tests can run to completion. The type of persistent
348 storage area is platform specific (eFlash, MRAM, etc.) and it is described
349 in corresponding flash_layout.h
Soby Mathew728a20a2020-03-25 13:33:35 +0000350
Kevin Pengc6d74502020-03-04 16:55:37 +0800351- ``PS_TEST_NV_COUNTERS``- this flag enables the virtual
352 implementation of the PS NV counters interface in
353 ``test/suites/ps/secure/nv_counters``, which emulates NV counters in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200354 RAM, and disables the hardware implementation of NV counters provided by
355 the secure service. This flag is enabled by default when building the
356 regression tests and disabled by default otherwise. This flag can be
357 overridden to ``OFF`` when building the regression tests. In this case,
Kevin Pengc6d74502020-03-04 16:55:37 +0800358 the PS rollback protection test suite will not be built, as it relies
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200359 on extra functionality provided by the virtual NV counters to simulate
Kevin Pengc6d74502020-03-04 16:55:37 +0800360 different rollback scenarios. The remainder of the PS test suites will
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200361 run using the hardware NV counters. Please note that running the tests in
362 this configuration will quickly increase the hardware NV counter values,
363 which cannot be decreased again.
364 Overriding this flag from its default value of ``OFF`` when not
365 building the regression tests is not currently supported.
366
367--------------
368
Jamie Foxdd3de952019-11-25 17:45:40 +0000369*Copyright (c) 2018-2020, Arm Limited. All rights reserved.*
Chris Brandc47d7102020-02-20 11:12:18 -0800370*Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.*