blob: 01d2b51df113dde0f55b6a67019d2b83d6d61135 [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
Jamie Fox865778b2020-10-23 19:52:51 +0100210Protected Storage Service Platform Definitions
211==============================================
Kevin Pengc6d74502020-03-04 16:55:37 +0800212The 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.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200223
Kevin Pengc6d74502020-03-04 16:55:37 +0800224The sectors reserved to be used as protected storage **must** be contiguous
225sectors starting at ``PS_FLASH_AREA_ADDR``.
Jamie Foxdd3de952019-11-25 17:45:40 +0000226
227The design requires either 2 blocks, or any number of blocks greater than or
228equal to 4. Total number of blocks can not be 0, 1 or 3. This is a design choice
229limitation to provide power failure safe update operations.
Vikas Katariya7d74ddb2019-09-19 11:59:57 +0100230
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200231Target must provide a header file, called ``flash_layout.h``, which defines the
232information explained above. The defines must be named as they are specified
233above.
234
Kevin Pengc6d74502020-03-04 16:55:37 +0800235More information about the ``flash_layout.h`` content, not PS related, is
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200236available in :doc:`platform readme </platform/ext/readme>` along with other
237platform information.
238
Chris Brandc47d7102020-02-20 11:12:18 -0800239The following optional platform definitions may also be defined in
240``flash_layout.h`` or set at build time in ``platform/ext/<TARGET_NAME>.cmake``:
241
242- ``PS_FLASH_AREA_ADDR`` - Defines the flash address where the protected storage
243 area starts.
244 If not defined, the platform must implement ``tfm_hal_ps_fs_info()``.
245- ``PS_FLASH_AREA_SIZE`` - Defines the size of the dedicated flash area
246 for protected storage in bytes.
247 If not defined, the platform must implement ``tfm_hal_ps_fs_info()``.
248
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200249TF-M NV Counter Interface
250=========================
251To have a platform independent way to access the NV counters, TF-M defines a
252platform NV counter interface. For API specification, please check:
253``platform/include/tfm_plat_nv_counters.h``
254
255The system integrators **may** implement this interface based on the target
Kevin Pengc6d74502020-03-04 16:55:37 +0800256capabilities and set the ``PS_ROLLBACK_PROTECTION`` flag to compile in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200257the rollback protection code.
258
259Secret Platform Unique Key
260==========================
261The encryption policy relies on a secret hardware unique key (HUK) per device.
262It is system integrator's responsibility to provide an implementation which
263**must** be a non-mutable target implementation.
264For API specification, please check:
265``platform/include/tfm_plat_crypto_keys.h``
266
267A stub implementation is provided in
David Hu31c574dc2019-12-05 18:25:44 +0800268``platform/ext/common/template/crypto_keys.c``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200269
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200270Non-Secure Identity Manager
271===========================
272TF-M core tracks the current client IDs running in the secure or non-secure
273processing environment. It provides a dedicated API to retrieve the client ID
274which performs the service request.
275
Minos Galanakise4094012020-06-12 14:25:34 +0100276:doc:`NS client identification documentation </docs/getting_started/tfm_ns_client_identification>`
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200277provides further details on how client identification works.
278
Kevin Pengc6d74502020-03-04 16:55:37 +0800279PS service uses that TF-M core API to retrieve the client ID and associate it
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200280as the owner of an asset. Only the owner can read, write or delete that asset
281based on the creation flags.
282
Minos Galanakise4094012020-06-12 14:25:34 +0100283The :doc:`integration guide </docs/getting_started/tfm_integration_guide>` provides further
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200284details of non-secure implementation requirements for TF-M.
285
286Cryptographic Interface
287=======================
288The reference encryption policy is built on AES-GCM, and it **may** be replaced
289by a vendor specific implementation.
290
Kevin Pengc6d74502020-03-04 16:55:37 +0800291The PS service abstracts all the cryptographic requirements and specifies the
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200292required cryptographic interface in
Kevin Pengc6d74502020-03-04 16:55:37 +0800293``secure_fw/partitions/protected_storage/crypto/ps_crypto_interface.h``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200294
Kevin Pengc6d74502020-03-04 16:55:37 +0800295The PS service cryptographic operations are implemented in
296``secure_fw/partitions/protected_storage/crypto/ps_crypto_interface.c``, using
297calls to the TF-M Crypto service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200298
Jamie Fox865778b2020-10-23 19:52:51 +0100299PS Service Build Definitions
300============================
301The PS service uses a set of C definitions to compile in/out certain features,
302as well as to configure certain service parameters. When using the TF-M build
303system, these definitions are controlled by build flags of the same name. The
304``config/config_default.cmake`` file sets the default values of those flags, but
305they can be overwritten based on platform capabilities by setting them in
306``platform/ext/target/<TARGET_NAME>/config.cmake``. The list of PS service build
307definitions is:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200308
Kevin Pengc6d74502020-03-04 16:55:37 +0800309- ``PS_ENCRYPTION``- this flag allows to enable/disable encryption
310 option to encrypt the protected storage data.
311- ``PS_CREATE_FLASH_LAYOUT``- this flag indicates that it is required
312 to create a PS flash layout. If this flag is set, PS service will
313 generate an empty and valid PS flash layout to store assets. It will
314 erase all data located in the assigned PS memory area before generating
315 the PS layout. This flag is required to be set if the PS memory area
316 is located in a non-persistent memory. This flag can be set if the PS
317 memory area is located in a persistent memory without a valid PS flash
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200318 layout in it. That is the case when it is the first time in the device
Kevin Pengc6d74502020-03-04 16:55:37 +0800319 life that the PS service is executed.
320- ``PS_VALIDATE_METADATA_FROM_FLASH``- this flag allows to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200321 enable/disable the validation mechanism to check the metadata store in flash
322 every time the flash data is read from flash. This validation is required
323 if the flash is not hardware protected against malicious writes. In case
324 the flash is protected against malicious writes (i.e embedded flash, etc),
325 this validation can be disabled in order to reduce the validation overhead.
Kevin Pengc6d74502020-03-04 16:55:37 +0800326- ``PS_ROLLBACK_PROTECTION``- this flag allows to enable/disable
327 rollback protection in protected storage service. This flag takes effect only
328 if the target has non-volatile counters and ``PS_ENCRYPTION`` flag is on.
Jamie Foxf58bd222020-06-12 18:21:25 +0100329- ``PS_RAM_FS``- setting this flag to ``ON`` enables the use of RAM instead of
330 the persistent storage device to store the FS in the Protected Storage
331 service. This flag is ``OFF`` by default. The PS regression tests write/erase
332 storage multiple time, so enabling this flag can increase the life of flash
333 memory when testing.
Chris Brandc47d7102020-02-20 11:12:18 -0800334 If this flag is set to ``ON``, PS_RAM_FS_SIZE must also be provided. This
335 specifies the size of the block of RAM to be used to simulate the flash.
Soby Mathew728a20a2020-03-25 13:33:35 +0000336
337 .. Note::
Jamie Foxf58bd222020-06-12 18:21:25 +0100338 If this flag is disabled when running the regression tests, then it is
339 recommended that the persistent storage area is erased before running the
340 tests to ensure that all tests can run to completion. The type of persistent
341 storage area is platform specific (eFlash, MRAM, etc.) and it is described
342 in corresponding flash_layout.h
Soby Mathew728a20a2020-03-25 13:33:35 +0000343
Jamie Fox865778b2020-10-23 19:52:51 +0100344- ``PS_MAX_ASSET_SIZE`` - Defines the maximum asset size to be stored in the
345 PS area. This size is used to define the temporary buffers used by PS to
346 read/write the asset content from/to flash. The memory used by the temporary
347 buffers is allocated statically as PS does not use dynamic memory allocation.
348- ``PS_NUM_ASSETS`` - Defines the maximum number of assets to be stored in the
349 PS area. This number is used to dimension statically the object table size in
350 RAM (fast access) and flash (persistent storage). The memory used by the
351 object table is allocated statically as PS does not use dynamic memory
352 allocation.
Kevin Peng95b55062020-11-09 11:27:25 +0800353- ``PS_TEST_NV_COUNTERS``- this flag enables the virtual implementation of the
354 PS NV counters interface in ``test/suites/ps/secure/nv_counters`` of the
355 ``tf-m-tests`` repo, which emulates NV counters in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200356 RAM, and disables the hardware implementation of NV counters provided by
Kevin Peng95b55062020-11-09 11:27:25 +0800357 the secure service. This flag is enabled by default, but has no effect when
David Hu3a923bd2020-11-14 19:34:39 +0800358 the secure regression test is disabled. This flag can be
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200359 overridden to ``OFF`` when building the regression tests. In this case,
Kevin Pengc6d74502020-03-04 16:55:37 +0800360 the PS rollback protection test suite will not be built, as it relies
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200361 on extra functionality provided by the virtual NV counters to simulate
Kevin Pengc6d74502020-03-04 16:55:37 +0800362 different rollback scenarios. The remainder of the PS test suites will
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200363 run using the hardware NV counters. Please note that running the tests in
364 this configuration will quickly increase the hardware NV counter values,
365 which cannot be decreased again.
366 Overriding this flag from its default value of ``OFF`` when not
367 building the regression tests is not currently supported.
368
369--------------
370
Jamie Foxdd3de952019-11-25 17:45:40 +0000371*Copyright (c) 2018-2020, Arm Limited. All rights reserved.*
Chris Brandc47d7102020-02-20 11:12:18 -0800372*Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.*