blob: 049f4b6d3a2353ac20f44809247f65883c362bff [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 Foxa7e73b72021-01-15 13:39:31 +0000163The ITS service implementation in
164``secure_fw/partitions/internal_trusted_storage/tfm_internal_trusted_storage.c``,
165constructs a filesystem configuration for Protected Storage based on
166target-specific definitions from the Protected Storage HAL. Please see the
167`Protected Storage Service HAL` section for details of these.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200168
169Cryptographic Interface
170=======================
Kevin Pengc6d74502020-03-04 16:55:37 +0800171- ``crypto/ps_crypto_interface.h`` - Abstracts the cryptographic operations for
172 the protected storage service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200173
Kevin Pengc6d74502020-03-04 16:55:37 +0800174- ``crypto/ps_crypto_interface.c`` - Implements the PS service cryptographic
Antonio de Angelisee774c22019-05-03 13:44:01 +0100175 operations with calls to the TF-M Crypto service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200176
177Non-volatile (NV) Counters Interface
178====================================
Kevin Pengc6d74502020-03-04 16:55:37 +0800179The current PS service provides rollback protection based on NV
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200180counters.
Kevin Pengc6d74502020-03-04 16:55:37 +0800181PS defines and implements the following NV counters functionalities:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200182
Kevin Pengc6d74502020-03-04 16:55:37 +0800183- ``nv_counters/ps_nv_counters.h`` - Abstracts PS non-volatile
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200184 counters operations. This API detaches the use of NV counters from the TF-M NV
185 counters implementation, provided by the platform, and provides a mechanism to
Kevin Pengc6d74502020-03-04 16:55:37 +0800186 compile in a different API implementation for test purposes. A PS test suite
187 **may** provide its own custom implementation to be able to test different PS
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200188 service use cases.
189
Kevin Pengc6d74502020-03-04 16:55:37 +0800190- ``nv_counters/ps_nv_counters.c`` - Implements the PS NV counters interfaces
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200191 based on TF-M NV counters implementation provided by the platform.
192
Kevin Pengc6d74502020-03-04 16:55:37 +0800193****************************
194PS Service Integration Guide
195****************************
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200196This section describes mandatory (i.e. **must** implement) or optional
197(i.e. **may** implement) interfaces which the system integrator have to take
Kevin Pengc6d74502020-03-04 16:55:37 +0800198in to account in order to integrate the protected storage service in a new
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200199platform.
200
201Maximum Asset Size
202==================
203An asset is stored in a contiguous space in a block/sector. The maximum
204size of an asset can be up-to the size of the data block/sector minus the object
Kevin Pengc6d74502020-03-04 16:55:37 +0800205header size (``PS_OBJECT_HEADER_SIZE``) which is defined in
206``ps_object_defs.h``. The ``PS_OBJECT_HEADER_SIZE`` changes based on the
207``PS_ENCRYPTION`` flag status.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200208
Jamie Foxa7e73b72021-01-15 13:39:31 +0000209Protected Storage Service HAL
210=============================
211The PS service requires the platform to implement the PS HAL, defined in
212``platform/include/tfm_hal_ps.h``.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200213
Jamie Foxa7e73b72021-01-15 13:39:31 +0000214The following C definitions in the HAL are mandatory, and must be defined by the
215platform in a header named ``flash_layout.h``:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200216
Jamie Foxa7e73b72021-01-15 13:39:31 +0000217- ``TFM_HAL_PS_FLASH_DRIVER`` - Defines the identifier of the CMSIS Flash
218 ARM_DRIVER_FLASH object to use for PS. It must have been allocated by the
219 platform and will be declared extern in the HAL header.
220
221- ``TFM_HAL_PS_PROGRAM_UNIT`` - Defines the size of the PS flash device's
222 physical program unit (the smallest unit of data that can be individually
223 programmed to flash). It must be equal to
224 ``TFM_HAL_PS_FLASH_DRIVER.GetInfo()->program_unit``, but made available at
225 compile time so that filesystem structures can be statically sized. Valid
226 values are powers of two between 1 and the flash sector size, inclusive.
227
228The following C definitions in the HAL may optionally be defined by the platform
229in the ``flash_layout.h`` header:
230
231- ``TFM_HAL_PS_FLASH_AREA_ADDR`` - Defines the base address of the dedicated
232 flash area for PS.
233
234- ``TFM_HAL_PS_FLASH_AREA_SIZE`` - Defines the size of the dedicated flash area
235 for PS in bytes.
236
237- ``TFM_HAL_PS_SECTORS_PER_BLOCK`` - Defines the number of contiguous physical
238 flash erase sectors that form a logical erase block in the filesystem. The
239 typical value is ``1``, but it may be increased so that the maximum required
240 asset size will fit in one logical block.
241
242If any of the above definitions are not provided by the platform, then the
243``tfm_hal_ps_fs_info()`` HAL API must be implemented instead. This function is
244documented in ``tfm_hal_ps.h``.
245
246The sectors reserved to be used for Protected Storage **must** be contiguous
247sectors starting at ``TFM_HAL_PS_FLASH_AREA_ADDR``.
Jamie Foxdd3de952019-11-25 17:45:40 +0000248
249The design requires either 2 blocks, or any number of blocks greater than or
250equal to 4. Total number of blocks can not be 0, 1 or 3. This is a design choice
251limitation to provide power failure safe update operations.
Vikas Katariya7d74ddb2019-09-19 11:59:57 +0100252
Jamie Foxa7e73b72021-01-15 13:39:31 +0000253Protected Storage Service Optional Platform Definitions
254=======================================================
255The following optional platform definitions may be defined in
256``flash_layout.h``:
257
258- ``PS_RAM_FS_SIZE`` - Defines the size of the RAM FS buffer when using the
259 RAM FS emulated flash implementation. The buffer must be at least as large as
260 the area earmarked for the filesystem by the HAL.
261- ``PS_FLASH_NAND_BUF_SIZE`` - Defines the size of the write buffer when using
262 the NAND flash implementation. The buffer must be at least as large as a
263 logical filesystem block.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200264
Kevin Pengc6d74502020-03-04 16:55:37 +0800265More information about the ``flash_layout.h`` content, not PS related, is
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200266available in :doc:`platform readme </platform/ext/readme>` along with other
267platform information.
268
269TF-M NV Counter Interface
270=========================
271To have a platform independent way to access the NV counters, TF-M defines a
272platform NV counter interface. For API specification, please check:
273``platform/include/tfm_plat_nv_counters.h``
274
275The system integrators **may** implement this interface based on the target
Kevin Pengc6d74502020-03-04 16:55:37 +0800276capabilities and set the ``PS_ROLLBACK_PROTECTION`` flag to compile in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200277the rollback protection code.
278
279Secret Platform Unique Key
280==========================
281The encryption policy relies on a secret hardware unique key (HUK) per device.
282It is system integrator's responsibility to provide an implementation which
283**must** be a non-mutable target implementation.
284For API specification, please check:
285``platform/include/tfm_plat_crypto_keys.h``
286
287A stub implementation is provided in
David Hu31c574dc2019-12-05 18:25:44 +0800288``platform/ext/common/template/crypto_keys.c``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200289
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200290Non-Secure Identity Manager
291===========================
292TF-M core tracks the current client IDs running in the secure or non-secure
293processing environment. It provides a dedicated API to retrieve the client ID
294which performs the service request.
295
Minos Galanakise4094012020-06-12 14:25:34 +0100296:doc:`NS client identification documentation </docs/getting_started/tfm_ns_client_identification>`
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200297provides further details on how client identification works.
298
Kevin Pengc6d74502020-03-04 16:55:37 +0800299PS service uses that TF-M core API to retrieve the client ID and associate it
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200300as the owner of an asset. Only the owner can read, write or delete that asset
301based on the creation flags.
302
Jamie Foxa7e73b72021-01-15 13:39:31 +0000303The :doc:`integration guide </docs/getting_started/tfm_integration_guide>`
304provides further details of non-secure implementation requirements for TF-M.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200305
306Cryptographic Interface
307=======================
308The reference encryption policy is built on AES-GCM, and it **may** be replaced
309by a vendor specific implementation.
310
Kevin Pengc6d74502020-03-04 16:55:37 +0800311The PS service abstracts all the cryptographic requirements and specifies the
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200312required cryptographic interface in
Kevin Pengc6d74502020-03-04 16:55:37 +0800313``secure_fw/partitions/protected_storage/crypto/ps_crypto_interface.h``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200314
Kevin Pengc6d74502020-03-04 16:55:37 +0800315The PS service cryptographic operations are implemented in
316``secure_fw/partitions/protected_storage/crypto/ps_crypto_interface.c``, using
317calls to the TF-M Crypto service.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200318
Jamie Fox865778b2020-10-23 19:52:51 +0100319PS Service Build Definitions
320============================
321The PS service uses a set of C definitions to compile in/out certain features,
322as well as to configure certain service parameters. When using the TF-M build
323system, these definitions are controlled by build flags of the same name. The
324``config/config_default.cmake`` file sets the default values of those flags, but
325they can be overwritten based on platform capabilities by setting them in
326``platform/ext/target/<TARGET_NAME>/config.cmake``. The list of PS service build
327definitions is:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200328
Kevin Pengc6d74502020-03-04 16:55:37 +0800329- ``PS_ENCRYPTION``- this flag allows to enable/disable encryption
330 option to encrypt the protected storage data.
331- ``PS_CREATE_FLASH_LAYOUT``- this flag indicates that it is required
332 to create a PS flash layout. If this flag is set, PS service will
333 generate an empty and valid PS flash layout to store assets. It will
334 erase all data located in the assigned PS memory area before generating
335 the PS layout. This flag is required to be set if the PS memory area
336 is located in a non-persistent memory. This flag can be set if the PS
337 memory area is located in a persistent memory without a valid PS flash
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200338 layout in it. That is the case when it is the first time in the device
Kevin Pengc6d74502020-03-04 16:55:37 +0800339 life that the PS service is executed.
340- ``PS_VALIDATE_METADATA_FROM_FLASH``- this flag allows to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200341 enable/disable the validation mechanism to check the metadata store in flash
342 every time the flash data is read from flash. This validation is required
343 if the flash is not hardware protected against malicious writes. In case
344 the flash is protected against malicious writes (i.e embedded flash, etc),
345 this validation can be disabled in order to reduce the validation overhead.
Kevin Pengc6d74502020-03-04 16:55:37 +0800346- ``PS_ROLLBACK_PROTECTION``- this flag allows to enable/disable
347 rollback protection in protected storage service. This flag takes effect only
348 if the target has non-volatile counters and ``PS_ENCRYPTION`` flag is on.
Jamie Foxf58bd222020-06-12 18:21:25 +0100349- ``PS_RAM_FS``- setting this flag to ``ON`` enables the use of RAM instead of
350 the persistent storage device to store the FS in the Protected Storage
351 service. This flag is ``OFF`` by default. The PS regression tests write/erase
352 storage multiple time, so enabling this flag can increase the life of flash
353 memory when testing.
Chris Brandc47d7102020-02-20 11:12:18 -0800354 If this flag is set to ``ON``, PS_RAM_FS_SIZE must also be provided. This
355 specifies the size of the block of RAM to be used to simulate the flash.
Soby Mathew728a20a2020-03-25 13:33:35 +0000356
357 .. Note::
Jamie Foxf58bd222020-06-12 18:21:25 +0100358 If this flag is disabled when running the regression tests, then it is
359 recommended that the persistent storage area is erased before running the
360 tests to ensure that all tests can run to completion. The type of persistent
361 storage area is platform specific (eFlash, MRAM, etc.) and it is described
362 in corresponding flash_layout.h
Soby Mathew728a20a2020-03-25 13:33:35 +0000363
Jamie Fox865778b2020-10-23 19:52:51 +0100364- ``PS_MAX_ASSET_SIZE`` - Defines the maximum asset size to be stored in the
365 PS area. This size is used to define the temporary buffers used by PS to
366 read/write the asset content from/to flash. The memory used by the temporary
367 buffers is allocated statically as PS does not use dynamic memory allocation.
368- ``PS_NUM_ASSETS`` - Defines the maximum number of assets to be stored in the
369 PS area. This number is used to dimension statically the object table size in
370 RAM (fast access) and flash (persistent storage). The memory used by the
371 object table is allocated statically as PS does not use dynamic memory
372 allocation.
Kevin Peng95b55062020-11-09 11:27:25 +0800373- ``PS_TEST_NV_COUNTERS``- this flag enables the virtual implementation of the
374 PS NV counters interface in ``test/suites/ps/secure/nv_counters`` of the
375 ``tf-m-tests`` repo, which emulates NV counters in
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200376 RAM, and disables the hardware implementation of NV counters provided by
Kevin Peng95b55062020-11-09 11:27:25 +0800377 the secure service. This flag is enabled by default, but has no effect when
David Hu3a923bd2020-11-14 19:34:39 +0800378 the secure regression test is disabled. This flag can be
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200379 overridden to ``OFF`` when building the regression tests. In this case,
Kevin Pengc6d74502020-03-04 16:55:37 +0800380 the PS rollback protection test suite will not be built, as it relies
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200381 on extra functionality provided by the virtual NV counters to simulate
Kevin Pengc6d74502020-03-04 16:55:37 +0800382 different rollback scenarios. The remainder of the PS test suites will
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200383 run using the hardware NV counters. Please note that running the tests in
384 this configuration will quickly increase the hardware NV counter values,
385 which cannot be decreased again.
386 Overriding this flag from its default value of ``OFF`` when not
387 building the regression tests is not currently supported.
388
389--------------
390
Jamie Foxa7e73b72021-01-15 13:39:31 +0000391*Copyright (c) 2018-2021, Arm Limited. All rights reserved.*
Chris Brandc47d7102020-02-20 11:12:18 -0800392*Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.*