blob: d1a5b9eb446615606d83b4a0100893cf0b00f354 [file] [log] [blame]
Tamas Ban624c9a02024-02-21 13:55:31 +01001Runtime Security Engine (RSE)
2=============================
Tamas Baneea607c2022-10-13 16:42:48 +02003
Tamas Ban624c9a02024-02-21 13:55:31 +01004This document focuses on the relationship between the Runtime Security Engine
5(RSE) and the application processor (AP). According to the ARM reference design
6the RSE is an independent core next to the AP and the SCP on the same die. It
Tamas Baneea607c2022-10-13 16:42:48 +02007provides fundamental security guarantees and runtime services for the rest of
8the system (e.g.: trusted boot, measured boot, platform attestation,
9key management, and key derivation).
10
Tamas Ban624c9a02024-02-21 13:55:31 +010011At power up RSE boots first from its private ROM code. It validates and loads
Tamas Baneea607c2022-10-13 16:42:48 +020012its own images and the initial images of SCP and AP. When AP and SCP are
13released from reset and their initial code is loaded then they continue their
Tamas Ban624c9a02024-02-21 13:55:31 +010014own boot process, which is the same as on non-RSE systems. Please refer to the
15``RSE documentation`` [1]_ for more details about the RSE boot flow.
Tamas Baneea607c2022-10-13 16:42:48 +020016
Tamas Ban624c9a02024-02-21 13:55:31 +010017The last stage of the RSE firmware is a persistent, runtime component. Much
Tamas Baneea607c2022-10-13 16:42:48 +020018like AP_BL31, this is a passive entity which has no periodical task to do and
Tamas Ban624c9a02024-02-21 13:55:31 +010019just waits for external requests from other subsystems. RSE and other
20subsystems can communicate with each other over message exchange. RSE waits
Tamas Baneea607c2022-10-13 16:42:48 +020021in idle for the incoming request, handles them, and sends a response then goes
22back to idle.
23
Tamas Ban624c9a02024-02-21 13:55:31 +010024RSE communication layer
Tamas Baneea607c2022-10-13 16:42:48 +020025-----------------------
26
Tamas Ban624c9a02024-02-21 13:55:31 +010027The communication between RSE and other subsystems are primarily relying on the
Yann Gautier36416b12024-09-23 14:00:01 +020028Message Handling Unit (MHU) module.
29
30However, this is possible to use this communication protocol with a different
31mailbox than MHU, by setting the flag ``PLAT_MHU=NO_MHU`` and implementing the
32APIs given in the file: ``include/drivers/arm/rse_comms.h``.
33
34The number of MHU interfaces between RSE and other cores is IMPDEF. Besides MHU
35other modules also could take part in the communication. RSE is capable of
36mapping the AP memory to its address space.
Tamas Ban624c9a02024-02-21 13:55:31 +010037Thereby either RSE core itself or a DMA engine if it is present, can move the
38data between memory belonging to RSE or AP. In this way, a bigger amount of data
Tamas Baneea607c2022-10-13 16:42:48 +020039can be transferred in a short time.
40
41The MHU comes in pairs. There is a sender and receiver side. They are connected
42to each other. An MHU interface consists of two pairs of MHUs, one sender and
43one receiver on both sides. Bidirectional communication is possible over an
Tamas Ban624c9a02024-02-21 13:55:31 +010044interface. One pair provides message sending from AP to RSE and the other pair
45from RSE to AP. The sender and receiver are connected via channels. There is an
Tamas Baneea607c2022-10-13 16:42:48 +020046IMPDEF number of channels (e.g: 4-16) between a sender and a receiver module.
47
Tamas Ban624c9a02024-02-21 13:55:31 +010048The RSE communication layer provides two ways for message exchange:
Tamas Baneea607c2022-10-13 16:42:48 +020049
50- ``Embedded messaging``: The full message, including header and payload, are
51 exchanged over the MHU channels. A channel is capable of delivering a single
52 word. The sender writes the data to the channel register on its side and the
53 receiver can read the data from the channel on the other side. One dedicated
54 channel is used for signalling. It does not deliver any payload it is just
55 meant for signalling that the sender loaded the data to the channel registers
56 so the receiver can read them. The receiver uses the same channel to signal
57 that data was read. Signalling happens via IRQ. If the message is longer than
58 the data fit to the channel registers then the message is sent over in
59 multiple rounds. Both, sender and receiver allocate a local buffer for the
60 messages. Data is copied from/to these buffers to/from the channel registers.
61- ``Pointer-access messaging``: The message header and the payload are
62 separated and they are conveyed in different ways. The header is sent
63 over the channels, similar to the embedded messaging but the payload is
Tamas Ban624c9a02024-02-21 13:55:31 +010064 copied over by RSE core (or by DMA) between the sender and the receiver. This
Tamas Baneea607c2022-10-13 16:42:48 +020065 could be useful in the case of long messages because transaction time is less
Tamas Ban624c9a02024-02-21 13:55:31 +010066 compared to the embedded messaging mode. Small payloads are copied by the RSE
Tamas Baneea607c2022-10-13 16:42:48 +020067 core because setting up DMA would require more CPU cycles. The payload is
Tamas Ban624c9a02024-02-21 13:55:31 +010068 either copied into an internal buffer or directly read-written by RSE. Actual
69 behavior depends on RSE setup, whether the partition supports memory-mapped
Tamas Baneea607c2022-10-13 16:42:48 +020070 ``iovec``. Therefore, the sender must handle both cases and prevent access to
Tamas Ban624c9a02024-02-21 13:55:31 +010071 the memory, where payload data lives, while the RSE handles the request.
Tamas Baneea607c2022-10-13 16:42:48 +020072
Tamas Ban624c9a02024-02-21 13:55:31 +010073The RSE communication layer supports both ways of messaging in parallel. It is
Tamas Baneea607c2022-10-13 16:42:48 +020074decided at runtime based on the message size which way to transfer the message.
75
76.. code-block:: bash
77
78 +----------------------------------------------+ +-------------------+
79 | | | |
80 | AP | | |
81 | | +--->| SRAM |
82 +----------------------------------------------| | | |
83 | BL1 / BL2 / BL31 | | | |
84 +----------------------------------------------+ | +-------------------+
85 | ^ | ^ ^
86 | send IRQ | receive |direct | |
87 V | |access | |
88 +--------------------+ +--------------------+ | | |
89 | MHU sender | | MHU receiver | | | Copy data |
90 +--------------------+ +--------------------+ | | |
91 | | | | | | | | | | |
92 | | channels | | | | channels | | | | |
93 | | e.g: 4-16 | | | | e.g: 4-16 | | | V |
94 +--------------------+ +--------------------+ | +-------+ |
95 | MHU receiver | | MHU sender | | +->| DMA | |
96 +--------------------+ +--------------------+ | | +-------+ |
97 | ^ | | ^ |
98 IRQ | receive | send | | | Copy data |
99 V | | | V V
100 +----------------------------------------------+ | | +-------------------+
101 | |--+-+ | |
Tamas Ban624c9a02024-02-21 13:55:31 +0100102 | RSE | | SRAM |
Tamas Baneea607c2022-10-13 16:42:48 +0200103 | | | |
104 +----------------------------------------------+ +-------------------+
105
106.. Note::
107
Tamas Ban624c9a02024-02-21 13:55:31 +0100108 The RSE communication layer is not prepared for concurrent execution. The
Tamas Baneea607c2022-10-13 16:42:48 +0200109 current use case only requires message exchange during the boot phase. In
110 the boot phase, only a single core is running and the rest of the cores are
111 in reset.
112
113Message structure
114^^^^^^^^^^^^^^^^^
Tamas Ban624c9a02024-02-21 13:55:31 +0100115A description of the message format can be found in the ``RSE communication
Tamas Baneea607c2022-10-13 16:42:48 +0200116design`` [2]_ document.
117
118Source files
119^^^^^^^^^^^^
Tamas Ban624c9a02024-02-21 13:55:31 +0100120- RSE comms: ``drivers/arm/rse``
Tamas Baneea607c2022-10-13 16:42:48 +0200121- MHU driver: ``drivers/arm/mhu``
122
123
124API for communication over MHU
125^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126The API is defined in these header files:
127
Tamas Ban624c9a02024-02-21 13:55:31 +0100128- ``include/drivers/arm/rse_comms.h``
Tamas Baneea607c2022-10-13 16:42:48 +0200129- ``include/drivers/arm/mhu.h``
130
Tamas Ban624c9a02024-02-21 13:55:31 +0100131RSE provided runtime services
Tamas Baneea607c2022-10-13 16:42:48 +0200132-----------------------------
133
Tamas Ban624c9a02024-02-21 13:55:31 +0100134RSE provides the following runtime services:
Tamas Baneea607c2022-10-13 16:42:48 +0200135
136- ``Measured boot``: Securely store the firmware measurements which were
137 computed during the boot process and the associated metadata (image
138 description, measurement algorithm, etc.). More info on measured boot service
Tamas Ban624c9a02024-02-21 13:55:31 +0100139 in RSE can be found in the ``measured_boot_integration_guide`` [3]_ .
Tamas Baneea607c2022-10-13 16:42:48 +0200140- ``Delegated attestation``: Query the platform attestation token and derive a
141 delegated attestation key. More info on the delegated attestation service
Tamas Ban624c9a02024-02-21 13:55:31 +0100142 in RSE can be found in the ``delegated_attestation_integration_guide`` [4]_ .
laurenw-arm5b006582023-06-30 17:03:03 -0500143- ``OTP assets management``: Public keys used by AP during the trusted boot
Tamas Ban624c9a02024-02-21 13:55:31 +0100144 process can be requested from RSE. Furthermore, AP can request RSE to
laurenw-arm5b006582023-06-30 17:03:03 -0500145 increase a non-volatile counter. Please refer to the
Tamas Ban624c9a02024-02-21 13:55:31 +0100146 ``RSE key management`` [5]_ document for more details.
Tamas Bane4582e42024-09-03 10:44:55 +0200147- ``DICE Protection Environment``: Securely store the firmware measurements
148 which were computed during the boot process and the associated metadata. It is
149 also capable of representing the boot measurements in the form of a
150 certificate chain, which is queriable. Please refer to the
151 ``DICE Protection Environment (DPE)`` [8]_ document for more details.
Tamas Baneea607c2022-10-13 16:42:48 +0200152
153Runtime service API
154^^^^^^^^^^^^^^^^^^^
Tamas Ban624c9a02024-02-21 13:55:31 +0100155The RSE provided runtime services implement a PSA aligned API. The parameter
Tamas Baneea607c2022-10-13 16:42:48 +0200156encoding follows the PSA client protocol described in the
157``Firmware Framework for M`` [6]_ document in chapter 4.4. The implementation is
158restricted to the static handle use case therefore only the ``psa_call`` API is
159implemented.
160
161
162Software and API layers
163^^^^^^^^^^^^^^^^^^^^^^^
164
165.. code-block:: bash
166
167 +----------------+ +---------------------+
168 | BL1 / BL2 | | BL31 |
169 +----------------+ +---------------------+
170 | |
171 | extend_measurement() | get_delegated_key()
172 | | get_platform_token()
173 V V
174 +----------------+ +---------------------+
175 | PSA protocol | | PSA protocol |
176 +----------------+ +---------------------+
177 | |
178 | psa_call() | psa_call()
179 | |
180 V V
181 +------------------------------------------------+
Tamas Ban624c9a02024-02-21 13:55:31 +0100182 | RSE communication protocol |
Tamas Baneea607c2022-10-13 16:42:48 +0200183 +------------------------------------------------+
184 | ^
185 | mhu_send_data() | mhu_receive_data()
186 | |
187 V |
188 +------------------------------------------------+
189 | MHU driver |
190 +------------------------------------------------+
191 | ^
192 | Register access | IRQ
193 V |
194 +------------------------------------------------+
195 | MHU HW on AP side |
196 +------------------------------------------------+
197 ^
198 | Physical wires
199 |
200 V
201 +------------------------------------------------+
Tamas Ban624c9a02024-02-21 13:55:31 +0100202 | MHU HW on RSE side |
Tamas Baneea607c2022-10-13 16:42:48 +0200203 +------------------------------------------------+
204 | ^
205 | IRQ | Register access
206 V |
207 +------------------------------------------------+
208 | MHU driver |
209 +------------------------------------------------+
210 | |
211 V V
212 +---------------+ +------------------------+
213 | Measured boot | | Delegated attestation |
214 | service | | service |
215 +---------------+ +------------------------+
216
217
Tamas Ban624c9a02024-02-21 13:55:31 +0100218RSE based Measured Boot
Tamas Baneea607c2022-10-13 16:42:48 +0200219-----------------------
220
221Measured Boot is the process of cryptographically measuring (computing the hash
222value of a binary) the code and critical data used at boot time. The
223measurement must be stored in a tamper-resistant way, so the security state
Tamas Ban624c9a02024-02-21 13:55:31 +0100224of the device can be attested later to an external party. RSE provides a runtime
Tamas Baneea607c2022-10-13 16:42:48 +0200225service which is meant to store measurements and associated metadata alongside.
226
227Data is stored in internal SRAM which is only accessible by the secure runtime
Tamas Ban624c9a02024-02-21 13:55:31 +0100228firmware of RSE. Data is stored in so-called measurement slots. A platform has
Tamas Baneea607c2022-10-13 16:42:48 +0200229IMPDEF number of measurement slots. The measurement storage follows extend
230semantics. This means that measurements are not stored directly (as it was
231taken) instead they contribute to the current value of the measurement slot.
232The extension implements this logic, where ``||`` stands for concatenation:
233
234.. code-block:: bash
235
236 new_value_of_measurement_slot = Hash(old_value_of_measurement_slot || measurement)
237
238Supported hash algorithms: sha-256, sha-512
239
240Measured Boot API
241^^^^^^^^^^^^^^^^^
242
243Defined here:
244
245- ``include/lib/psa/measured_boot.h``
246
247.. code-block:: c
248
249 psa_status_t
Tamas Ban624c9a02024-02-21 13:55:31 +0100250 rse_measured_boot_extend_measurement(uint8_t index,
Tamas Baneea607c2022-10-13 16:42:48 +0200251 const uint8_t *signer_id,
252 size_t signer_id_size,
253 const uint8_t *version,
254 size_t version_size,
255 uint32_t measurement_algo,
256 const uint8_t *sw_type,
257 size_t sw_type_size,
258 const uint8_t *measurement_value,
259 size_t measurement_value_size,
260 bool lock_measurement);
261
262Measured Boot Metadata
263^^^^^^^^^^^^^^^^^^^^^^
264
265The following metadata can be stored alongside the measurement:
266
267- ``Signer-id``: Mandatory. The hash of the firmware image signing public key.
268- ``Measurement algorithm``: Optional. The hash algorithm which was used to
269 compute the measurement (e.g.: sha-256, etc.).
270- ``Version info``: Optional. The firmware version info (e.g.: 2.7).
271- ``SW type``: Optional. Short text description (e.g.: BL1, BL2, BL31, etc.)
272
273.. Note::
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100274 Version info is not implemented in TF-A yet.
275
Tamas Baneea607c2022-10-13 16:42:48 +0200276
277The caller must specify in which measurement slot to extend a certain
278measurement and metadata. A measurement slot can be extended by multiple
279measurements. The default value is IMPDEF. All measurement slot is cleared at
280reset, there is no other way to clear them. In the reference implementation,
281the measurement slots are initialized to 0. At the first call to extend the
282measurement in a slot, the extend operation uses the default value of the
283measurement slot. All upcoming extend operation on the same slot contributes
284to the previous value of that measurement slot.
285
286The following rules are kept when a slot is extended multiple times:
287
288- ``Signer-id`` must be the same as the previous call(s), otherwise a
289 PSA_ERROR_NOT_PERMITTED error code is returned.
290
291- ``Measurement algorithm``: must be the same as the previous call(s),
292 otherwise, a PSA_ERROR_NOT_PERMITTED error code is returned.
293
294In case of error no further action is taken (slot is not locked). If there is
295a valid data in a sub-sequent call then measurement slot will be extended. The
296rest of the metadata is handled as follows when a measurement slot is extended
297multiple times:
298
299- ``SW type``: Cleared.
300- ``Version info``: Cleared.
301
302.. Note::
303
304 Extending multiple measurements in the same slot leads to some metadata
Tamas Ban624c9a02024-02-21 13:55:31 +0100305 information loss. Since RSE is not constrained on special HW resources to
Tamas Baneea607c2022-10-13 16:42:48 +0200306 store the measurements and metadata, therefore it is worth considering to
307 store all of them one by one in distinct slots. However, they are one-by-one
308 included in the platform attestation token. So, the number of distinct
309 firmware image measurements has an impact on the size of the attestation
310 token.
311
Tamas Ban624c9a02024-02-21 13:55:31 +0100312The allocation of the measurement slot among RSE, Root and Realm worlds is
Tamas Baneea607c2022-10-13 16:42:48 +0200313platform dependent. The platform must provide an allocation of the measurement
314slot at build time. An example can be found in
315``tf-a/plat/arm/board/tc/tc_bl1_measured_boot.c``
316Furthermore, the memory, which holds the metadata is also statically allocated
Tamas Ban624c9a02024-02-21 13:55:31 +0100317in RSE memory. Some of the fields have a static value (measurement algorithm),
Tamas Baneea607c2022-10-13 16:42:48 +0200318and some of the values have a dynamic value (measurement value) which is updated
319by the bootloaders when the firmware image is loaded and measured. The metadata
320structure is defined in
Tamas Ban624c9a02024-02-21 13:55:31 +0100321``include/drivers/measured_boot/rse/rse_measured_boot.h``.
Tamas Baneea607c2022-10-13 16:42:48 +0200322
323.. code-block:: c
324
Tamas Ban624c9a02024-02-21 13:55:31 +0100325 struct rse_mboot_metadata {
Tamas Baneea607c2022-10-13 16:42:48 +0200326 unsigned int id;
327 uint8_t slot;
328 uint8_t signer_id[SIGNER_ID_MAX_SIZE];
329 size_t signer_id_size;
330 uint8_t version[VERSION_MAX_SIZE];
331 size_t version_size;
332 uint8_t sw_type[SW_TYPE_MAX_SIZE];
333 size_t sw_type_size;
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100334 void *pk_oid;
Tamas Baneea607c2022-10-13 16:42:48 +0200335 bool lock_measurement;
336 };
337
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100338Signer-ID API
339^^^^^^^^^^^^^
340
341This function calculates the hash of a public key (signer-ID) using the
Tamas Ban624c9a02024-02-21 13:55:31 +0100342``Measurement algorithm`` and stores it in the ``rse_mboot_metadata`` field
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100343named ``signer_id``.
344Prior to calling this function, the caller must ensure that the ``signer_id``
345field points to the zero-filled buffer.
346
347Defined here:
348
Tamas Ban624c9a02024-02-21 13:55:31 +0100349- ``include/drivers/measured_boot/rse/rse_measured_boot.h``
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100350
351.. code-block:: c
352
Tamas Ban624c9a02024-02-21 13:55:31 +0100353 int rse_mboot_set_signer_id(struct rse_mboot_metadata *metadata_ptr,
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100354 const void *pk_oid,
355 const void *pk_ptr,
356 size_t pk_len)
357
358
Tamas Ban624c9a02024-02-21 13:55:31 +0100359- First parameter is the pointer to the ``rse_mboot_metadata`` structure.
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100360- Second parameter is the pointer to the key-OID of the public key.
361- Third parameter is the pointer to the public key buffer.
362- Fourth parameter is the size of public key buffer.
363- This function returns 0 on success, a signed integer error code
364 otherwise.
365
Tamas Baneea607c2022-10-13 16:42:48 +0200366Build time config options
367^^^^^^^^^^^^^^^^^^^^^^^^^
368
Tamas Bane4582e42024-09-03 10:44:55 +0200369- ``MEASURED_BOOT``: Enable measured boot.
Tamas Ban624c9a02024-02-21 13:55:31 +0100370- ``MBOOT_RSE_HASH_ALG``: Determine the hash algorithm to measure the images.
Tamas Baneea607c2022-10-13 16:42:48 +0200371 The default value is sha-256.
372
373Measured boot flow
374^^^^^^^^^^^^^^^^^^
375
Tamas Ban624c9a02024-02-21 13:55:31 +0100376.. figure:: ../resources/diagrams/rse_measured_boot_flow.svg
Tamas Baneea607c2022-10-13 16:42:48 +0200377 :align: center
378
379Sample console log
380^^^^^^^^^^^^^^^^^^
381
382.. code-block:: bash
383
384 INFO: Measured boot extend measurement:
385 INFO: - slot : 6
386 INFO: - signer_id : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
387 INFO: : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
388 INFO: - version :
389 INFO: - version_size: 0
390 INFO: - sw_type : FW_CONFIG
391 INFO: - sw_type_size: 10
392 INFO: - algorithm : 2000009
393 INFO: - measurement : aa ea d3 a7 a8 e2 ab 7d 13 a6 cb 34 99 10 b9 a1
394 INFO: : 1b 9f a0 52 c5 a8 b1 d7 76 f2 c1 c1 ef ca 1a df
395 INFO: - locking : true
396 INFO: FCONF: Config file with image ID:31 loaded at address = 0x4001010
397 INFO: Loading image id=24 at address 0x4001300
398 INFO: Image id=24 loaded: 0x4001300 - 0x400153a
399 INFO: Measured boot extend measurement:
400 INFO: - slot : 7
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100401 INFO: - signer_id : b0 f3 82 09 12 97 d8 3a 37 7a 72 47 1b ec 32 73
402 INFO: : e9 92 32 e2 49 59 f6 5e 8b 4a 4a 46 d8 22 9a da
Tamas Baneea607c2022-10-13 16:42:48 +0200403 INFO: - version :
404 INFO: - version_size: 0
405 INFO: - sw_type : TB_FW_CONFIG
406 INFO: - sw_type_size: 13
407 INFO: - algorithm : 2000009
408 INFO: - measurement : 05 b9 dc 98 62 26 a7 1c 2d e5 bb af f0 90 52 28
409 INFO: : f2 24 15 8a 3a 56 60 95 d6 51 3a 7a 1a 50 9b b7
410 INFO: - locking : true
411 INFO: FCONF: Config file with image ID:24 loaded at address = 0x4001300
412 INFO: BL1: Loading BL2
413 INFO: Loading image id=1 at address 0x404d000
414 INFO: Image id=1 loaded: 0x404d000 - 0x406412a
415 INFO: Measured boot extend measurement:
416 INFO: - slot : 8
Manish V Badarkhe137d9342023-07-17 09:56:13 +0100417 INFO: - signer_id : b0 f3 82 09 12 97 d8 3a 37 7a 72 47 1b ec 32 73
418 INFO: : e9 92 32 e2 49 59 f6 5e 8b 4a 4a 46 d8 22 9a da
Tamas Baneea607c2022-10-13 16:42:48 +0200419 INFO: - version :
420 INFO: - version_size: 0
421 INFO: - sw_type : BL_2
422 INFO: - sw_type_size: 5
423 INFO: - algorithm : 2000009
424 INFO: - measurement : 53 a1 51 75 25 90 fb a1 d9 b8 c8 34 32 3a 01 16
425 INFO: : c9 9e 74 91 7d 28 02 56 3f 5c 40 94 37 58 50 68
426 INFO: - locking : true
427
428Delegated Attestation
429---------------------
430
431Delegated Attestation Service was mainly developed to support the attestation
432flow on the ``ARM Confidential Compute Architecture`` (ARM CCA) [7]_.
433The detailed description of the delegated attestation service can be found in
434the ``Delegated Attestation Service Integration Guide`` [4]_ document.
435
436In the CCA use case, the Realm Management Monitor (RMM) relies on the delegated
Tamas Ban624c9a02024-02-21 13:55:31 +0100437attestation service of the RSE to get a realm attestation key and the CCA
Tamas Baneea607c2022-10-13 16:42:48 +0200438platform token. BL31 does not use the service for its own purpose, only calls
Tamas Ban624c9a02024-02-21 13:55:31 +0100439it on behalf of RMM. The access to MHU interface and thereby to RSE is
Tamas Baneea607c2022-10-13 16:42:48 +0200440restricted to BL31 only. Therefore, RMM does not have direct access, all calls
441need to go through BL31. The RMM dispatcher module of the BL31 is responsible
442for delivering the calls between the two parties.
443
Tamas Baneea607c2022-10-13 16:42:48 +0200444Delegated Attestation API
445^^^^^^^^^^^^^^^^^^^^^^^^^
446Defined here:
447
448- ``include/lib/psa/delegated_attestation.h``
449
450.. code-block:: c
451
452 psa_status_t
Tamas Ban624c9a02024-02-21 13:55:31 +0100453 rse_delegated_attest_get_delegated_key(uint8_t ecc_curve,
Tamas Baneea607c2022-10-13 16:42:48 +0200454 uint32_t key_bits,
455 uint8_t *key_buf,
456 size_t key_buf_size,
457 size_t *key_size,
458 uint32_t hash_algo);
459
460 psa_status_t
Tamas Ban624c9a02024-02-21 13:55:31 +0100461 rse_delegated_attest_get_token(const uint8_t *dak_pub_hash,
Tamas Baneea607c2022-10-13 16:42:48 +0200462 size_t dak_pub_hash_size,
463 uint8_t *token_buf,
464 size_t token_buf_size,
465 size_t *token_size);
466
467Attestation flow
468^^^^^^^^^^^^^^^^
469
Tamas Ban624c9a02024-02-21 13:55:31 +0100470.. figure:: ../resources/diagrams/rse_attestation_flow.svg
Tamas Baneea607c2022-10-13 16:42:48 +0200471 :align: center
472
473Sample attestation token
474^^^^^^^^^^^^^^^^^^^^^^^^
475
476Binary format:
477
478.. code-block:: bash
479
480 INFO: DELEGATED ATTEST TEST START
481 INFO: Get delegated attestation key start
482 INFO: Get delegated attest key succeeds, len: 48
483 INFO: Delegated attest key:
484 INFO: 0d 2a 66 61 d4 89 17 e1 70 c6 73 56 df f4 11 fd
485 INFO: 7d 1f 3b 8a a3 30 3d 70 4c d9 06 c3 c7 ef 29 43
486 INFO: 0f ee b5 e7 56 e0 71 74 1b c4 39 39 fd 85 f6 7b
487 INFO: Get platform token start
488 INFO: Get platform token succeeds, len: 1086
489 INFO: Platform attestation token:
Tamas Ban5c8b5f92024-09-05 10:11:23 +0200490 INFO: d2 84 44 a1 01 38 22 a0 59 05 81 a9 19 01 09 78
491 INFO: 23 74 61 67 3a 61 72 6d 2e 63 6f 6d 2c 32 30 32
492 INFO: 33 3a 63 63 61 5f 70 6c 61 74 66 6f 72 6d 23 31
493 INFO: 2e 30 2e 30 0a 58 20 0d 22 e0 8a 98 46 90 58 48
494 INFO: 63 18 28 34 89 bd b3 6f 09 db ef eb 18 64 df 43
495 INFO: 3f a6 e5 4e a2 d7 11 19 09 5c 58 20 7f 45 4c 46
496 INFO: 02 01 01 00 00 00 00 00 00 00 00 00 03 00 3e 00
497 INFO: 01 00 00 00 50 58 00 00 00 00 00 00 19 01 00 58
498 INFO: 21 01 07 06 05 04 03 02 01 00 0f 0e 0d 0c 0b 0a
499 INFO: 09 08 17 16 15 14 13 12 11 10 1f 1e 1d 1c 1b 1a
500 INFO: 19 18 19 09 61 44 cf cf cf cf 19 09 5b 19 30 03
501 INFO: 19 09 62 67 73 68 61 2d 32 35 36 19 09 60 78 3a
502 INFO: 68 74 74 70 73 3a 2f 2f 76 65 72 61 69 73 6f 6e
503 INFO: 2e 65 78 61 6d 70 6c 65 2f 2e 77 65 6c 6c 2d 6b
504 INFO: 6e 6f 77 6e 2f 76 65 72 61 69 73 6f 6e 2f 76 65
505 INFO: 72 69 66 69 63 61 74 69 6f 6e 19 09 5f 8d a4 01
506 INFO: 69 52 53 45 5f 42 4c 31 5f 32 05 58 20 53 78 79
507 INFO: 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc 56 41 41 9c
508 INFO: 3d 30 60 cf e3 22 38 c0 fa 97 3f 7a a3 02 58 20
509 INFO: 9a 27 1f 2a 91 6b 0b 6e e6 ce cb 24 26 f0 b3 20
510 INFO: 6e f0 74 57 8b e5 5d 9b c9 4f 6f 3f e3 ab 86 aa
511 INFO: 06 67 73 68 61 2d 32 35 36 a4 01 67 52 53 45 5f
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000512 INFO: 42 4c 32 05 58 20 53 78 79 63 07 53 5d f3 ec 8d
513 INFO: 8b 15 a2 e2 dc 56 41 41 9c 3d 30 60 cf e3 22 38
Tamas Ban5c8b5f92024-09-05 10:11:23 +0200514 INFO: c0 fa 97 3f 7a a3 02 58 20 53 c2 34 e5 e8 47 2b
515 INFO: 6a c5 1c 1a e1 ca b3 fe 06 fa d0 53 be b8 eb fd
516 INFO: 89 77 b0 10 65 5b fd d3 c3 06 67 73 68 61 2d 32
517 INFO: 35 36 a4 01 65 52 53 45 5f 53 05 58 20 53 78 79
518 INFO: 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc 56 41 41 9c
519 INFO: 3d 30 60 cf e3 22 38 c0 fa 97 3f 7a a3 02 58 20
520 INFO: 11 21 cf cc d5 91 3f 0a 63 fe c4 0a 6f fd 44 ea
521 INFO: 64 f9 dc 13 5c 66 63 4b a0 01 d1 0b cf 43 02 a2
522 INFO: 06 67 73 68 61 2d 32 35 36 a4 01 66 41 50 5f 42
523 INFO: 4c 31 05 58 20 53 78 79 63 07 53 5d f3 ec 8d 8b
524 INFO: 15 a2 e2 dc 56 41 41 9c 3d 30 60 cf e3 22 38 c0
525 INFO: fa 97 3f 7a a3 02 58 20 15 71 b5 ec 78 bd 68 51
526 INFO: 2b f7 83 0b b6 a2 a4 4b 20 47 c7 df 57 bc e7 9e
527 INFO: b8 a1 c0 e5 be a0 a5 01 06 67 73 68 61 2d 32 35
528 INFO: 36 a4 01 66 41 50 5f 42 4c 32 05 58 20 53 78 79
529 INFO: 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc 56 41 41 9c
530 INFO: 3d 30 60 cf e3 22 38 c0 fa 97 3f 7a a3 02 58 20
531 INFO: 10 15 9b af 26 2b 43 a9 2d 95 db 59 da e1 f7 2c
532 INFO: 64 51 27 30 16 61 e0 a3 ce 4e 38 b2 95 a9 7c 58
533 INFO: 06 67 73 68 61 2d 32 35 36 a4 01 67 53 43 50 5f
534 INFO: 42 4c 31 05 58 20 53 78 79 63 07 53 5d f3 ec 8d
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000535 INFO: 8b 15 a2 e2 dc 56 41 41 9c 3d 30 60 cf e3 22 38
Tamas Ban5c8b5f92024-09-05 10:11:23 +0200536 INFO: c0 fa 97 3f 7a a3 02 58 20 10 12 2e 85 6b 3f cd
537 INFO: 49 f0 63 63 63 17 47 61 49 cb 73 0a 1a a1 cf aa
538 INFO: d8 18 55 2b 72 f5 6d 6f 68 06 67 73 68 61 2d 32
539 INFO: 35 36 a4 01 67 53 43 50 5f 42 4c 32 05 58 20 f1
540 INFO: 4b 49 87 90 4b cb 58 14 e4 45 9a 05 7e d4 d2 0f
541 INFO: 58 a6 33 15 22 88 a7 61 21 4d cd 28 78 0b 56 02
542 INFO: 58 20 aa 67 a1 69 b0 bb a2 17 aa 0a a8 8a 65 34
543 INFO: 69 20 c8 4c 42 44 7c 36 ba 5f 7e a6 5f 42 2c 1f
544 INFO: e5 d8 06 67 73 68 61 2d 32 35 36 a4 01 67 41 50
545 INFO: 5f 42 4c 33 31 05 58 20 53 78 79 63 07 53 5d f3
546 INFO: ec 8d 8b 15 a2 e2 dc 56 41 41 9c 3d 30 60 cf e3
547 INFO: 22 38 c0 fa 97 3f 7a a3 02 58 20 2e 6d 31 a5 98
548 INFO: 3a 91 25 1b fa e5 ae fa 1c 0a 19 d8 ba 3c f6 01
549 INFO: d0 e8 a7 06 b4 cf a9 66 1a 6b 8a 06 67 73 68 61
550 INFO: 2d 32 35 36 a4 01 63 52 4d 4d 05 58 20 53 78 79
551 INFO: 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc 56 41 41 9c
552 INFO: 3d 30 60 cf e3 22 38 c0 fa 97 3f 7a a3 02 58 20
553 INFO: a1 fb 50 e6 c8 6f ae 16 79 ef 33 51 29 6f d6 71
554 INFO: 34 11 a0 8c f8 dd 17 90 a4 fd 05 fa e8 68 81 64
555 INFO: 06 67 73 68 61 2d 32 35 36 a4 01 69 48 57 5f 43
556 INFO: 4f 4e 46 49 47 05 58 20 53 78 79 63 07 53 5d f3
557 INFO: ec 8d 8b 15 a2 e2 dc 56 41 41 9c 3d 30 60 cf e3
558 INFO: 22 38 c0 fa 97 3f 7a a3 02 58 20 1a 25 24 02 97
559 INFO: 2f 60 57 fa 53 cc 17 2b 52 b9 ff ca 69 8e 18 31
560 INFO: 1f ac d0 f3 b0 6e ca ae f7 9e 17 06 67 73 68 61
561 INFO: 2d 32 35 36 a4 01 69 46 57 5f 43 4f 4e 46 49 47
562 INFO: 05 58 20 53 78 79 63 07 53 5d f3 ec 8d 8b 15 a2
563 INFO: e2 dc 56 41 41 9c 3d 30 60 cf e3 22 38 c0 fa 97
564 INFO: 3f 7a a3 02 58 20 9a 92 ad bc 0c ee 38 ef 65 8c
565 INFO: 71 ce 1b 1b f8 c6 56 68 f1 66 bf b2 13 64 4c 89
566 INFO: 5c cb 1a d0 7a 25 06 67 73 68 61 2d 32 35 36 a4
567 INFO: 01 6c 54 42 5f 46 57 5f 43 4f 4e 46 49 47 05 58
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000568 INFO: 20 53 78 79 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc
569 INFO: 56 41 41 9c 3d 30 60 cf e3 22 38 c0 fa 97 3f 7a
Tamas Ban5c8b5f92024-09-05 10:11:23 +0200570 INFO: a3 02 58 20 23 89 03 18 0c c1 04 ec 2c 5d 8b 3f
571 INFO: 20 c5 bc 61 b3 89 ec 0a 96 7d f8 cc 20 8c dc 7c
572 INFO: d4 54 17 4f 06 67 73 68 61 2d 32 35 36 a4 01 6d
573 INFO: 53 4f 43 5f 46 57 5f 43 4f 4e 46 49 47 05 58 20
574 INFO: 53 78 79 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc 56
575 INFO: 41 41 9c 3d 30 60 cf e3 22 38 c0 fa 97 3f 7a a3
576 INFO: 02 58 20 e6 c2 1e 8d 26 0f e7 18 82 de bd b3 39
577 INFO: d2 40 2a 2c a7 64 85 29 bc 23 03 f4 86 49 bc e0
578 INFO: 38 00 17 06 67 73 68 61 2d 32 35 36 58 60 31 d0
579 INFO: 4d 52 cc de 95 2c 1e 32 cb a1 81 88 5a 40 b8 cc
580 INFO: 38 e0 52 8c 1e 89 58 98 07 64 2a a5 e3 f2 bc 37
581 INFO: f9 53 74 50 6b ff 4d 2e 4b e7 06 3c 4d 72 41 92
582 INFO: 70 c7 22 e8 d4 d9 3e e8 b6 c9 fa ce 3b 43 c9 76
583 INFO: 1a 49 94 1a b6 f3 8f fd ff 49 6a d4 63 b4 cb fa
584 INFO: 11 d8 3e 23 e3 1f 7f 62 32 9d e3 0c 1c c8
Tamas Baneea607c2022-10-13 16:42:48 +0200585 INFO: DELEGATED ATTEST TEST END
586
587JSON format:
588
589.. code-block:: JSON
590
591 {
Tamas Ban5c8b5f92024-09-05 10:11:23 +0200592 "CCA_ATTESTATION_PROFILE": "tag:arm.com,2023:cca_platform#1.0.0",
593 "CCA_PLATFORM_CHALLENGE": "b'0D22E08A98469058486318283489BDB36F09DBEFEB1864DF433FA6E54EA2D711'",
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000594 "CCA_PLATFORM_IMPLEMENTATION_ID": "b'7F454C4602010100000000000000000003003E00010000005058000000000000'",
595 "CCA_PLATFORM_INSTANCE_ID": "b'0107060504030201000F0E0D0C0B0A090817161514131211101F1E1D1C1B1A1918'",
596 "CCA_PLATFORM_CONFIG": "b'CFCFCFCF'",
597 "CCA_PLATFORM_LIFECYCLE": "secured_3003",
598 "CCA_PLATFORM_HASH_ALGO_ID": "sha-256",
599 "CCA_PLATFORM_VERIFICATION_SERVICE": "https://veraison.example/.well-known/veraison/verification",
Tamas Baneea607c2022-10-13 16:42:48 +0200600 "CCA_PLATFORM_SW_COMPONENTS": [
601 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000602 "SW_COMPONENT_TYPE": "RSE_BL1_2",
603 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
604 "MEASUREMENT_VALUE": "b'9A271F2A916B0B6EE6CECB2426F0B3206EF074578BE55D9BC94F6F3FE3AB86AA'",
605 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200606 },
607 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000608 "SW_COMPONENT_TYPE": "RSE_BL2",
609 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
610 "MEASUREMENT_VALUE": "b'53C234E5E8472B6AC51C1AE1CAB3FE06FAD053BEB8EBFD8977B010655BFDD3C3'",
611 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200612 },
613 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000614 "SW_COMPONENT_TYPE": "RSE_S",
615 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
616 "MEASUREMENT_VALUE": "b'1121CFCCD5913F0A63FEC40A6FFD44EA64F9DC135C66634BA001D10BCF4302A2'",
617 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200618 },
619 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000620 "SW_COMPONENT_TYPE": "AP_BL1",
621 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
622 "MEASUREMENT_VALUE": "b'1571B5EC78BD68512BF7830BB6A2A44B2047C7DF57BCE79EB8A1C0E5BEA0A501'",
623 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200624 },
625 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000626 "SW_COMPONENT_TYPE": "AP_BL2",
627 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
628 "MEASUREMENT_VALUE": "b'10159BAF262B43A92D95DB59DAE1F72C645127301661E0A3CE4E38B295A97C58'",
629 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200630 },
631 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000632 "SW_COMPONENT_TYPE": "SCP_BL1",
633 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
634 "MEASUREMENT_VALUE": "b'10122E856B3FCD49F063636317476149CB730A1AA1CFAAD818552B72F56D6F68'",
635 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200636 },
637 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000638 "SW_COMPONENT_TYPE": "SCP_BL2",
639 "SIGNER_ID": "b'F14B4987904BCB5814E4459A057ED4D20F58A633152288A761214DCD28780B56'",
640 "MEASUREMENT_VALUE": "b'AA67A169B0BBA217AA0AA88A65346920C84C42447C36BA5F7EA65F422C1FE5D8'",
641 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200642 },
643 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000644 "SW_COMPONENT_TYPE": "AP_BL31",
645 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
646 "MEASUREMENT_VALUE": "b'2E6D31A5983A91251BFAE5AEFA1C0A19D8BA3CF601D0E8A706B4CFA9661A6B8A'",
647 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200648 },
649 {
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000650 "SW_COMPONENT_TYPE": "RMM",
651 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
652 "MEASUREMENT_VALUE": "b'A1FB50E6C86FAE1679EF3351296FD6713411A08CF8DD1790A4FD05FAE8688164'",
653 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
654 },
655 {
656 "SW_COMPONENT_TYPE": "HW_CONFIG",
657 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
658 "MEASUREMENT_VALUE": "b'1A252402972F6057FA53CC172B52B9FFCA698E18311FACD0F3B06ECAAEF79E17'",
659 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
660 },
661 {
662 "SW_COMPONENT_TYPE": "FW_CONFIG",
663 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
664 "MEASUREMENT_VALUE": "b'9A92ADBC0CEE38EF658C71CE1B1BF8C65668F166BFB213644C895CCB1AD07A25'",
665 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
666 },
667 {
668 "SW_COMPONENT_TYPE": "TB_FW_CONFIG",
669 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
670 "MEASUREMENT_VALUE": "b'238903180CC104EC2C5D8B3F20C5BC61B389EC0A967DF8CC208CDC7CD454174F'",
671 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
672 },
673 {
674 "SW_COMPONENT_TYPE": "SOC_FW_CONFIG",
675 "SIGNER_ID": "b'5378796307535DF3EC8D8B15A2E2DC5641419C3D3060CFE32238C0FA973F7AA3'",
676 "MEASUREMENT_VALUE": "b'E6C21E8D260FE71882DEBDB339D2402A2CA7648529BC2303F48649BCE0380017'",
677 "CCA_SW_COMPONENT_HASH_ID": "sha-256"
Tamas Baneea607c2022-10-13 16:42:48 +0200678 }
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000679 ]
Tamas Baneea607c2022-10-13 16:42:48 +0200680 }
681
Tamas Bane4582e42024-09-03 10:44:55 +0200682RSE based DICE Protection Environment
683-------------------------------------
684
685The ``DICE Protection Environment (DPE)`` [8]_ service makes it possible to
686execute |DICE| commands within an isolated execution environment. It provides
687clients with an interface to send DICE commands, encoded as CBOR objects,
688that act on opaque context handles. The |DPE| service performs |DICE|
689derivations and certification on its internal contexts, without exposing the
690|DICE| secrets (private keys and CDIs) outside of the isolated execution
691environment.
692
693|DPE| API
694^^^^^^^^^
695
696Defined here:
697
698- ``include/lib/psa/dice_protection_environment.h``
699
700.. code-block:: c
701
702 dpe_error_t
703 dpe_derive_context(int context_handle,
704 uint32_t cert_id,
705 bool retain_parent_context,
706 bool allow_new_context_to_derive,
707 bool create_certificate,
708 const DiceInputValues *dice_inputs,
709 int32_t target_locality,
710 bool return_certificate,
711 bool allow_new_context_to_export,
712 bool export_cdi,
713 int *new_context_handle,
714 int *new_parent_context_handle,
715 uint8_t *new_certificate_buf,
716 size_t new_certificate_buf_size,
717 size_t *new_certificate_actual_size,
718 uint8_t *exported_cdi_buf,
719 size_t exported_cdi_buf_size,
720 size_t *exported_cdi_actual_size);
721
722Build time config options
723^^^^^^^^^^^^^^^^^^^^^^^^^
724
725- ``MEASURED_BOOT``: Enable measured boot.
726- ``DICE_PROTECTION_ENVIRONMENT``: Boolean flag to specify the measured boot
727 backend when |RSE| based ``MEASURED_BOOT`` is enabled. The default value is
728 ``0``. When set to ``1`` then measurements and additional metadata collected
729 during the measured boot process are sent to the |DPE| for storage and
730 processing.
731- ``DPE_ALG_ID``: Determine the hash algorithm to measure the images. The
732 default value is sha-256.
733
734Example certificate chain
735^^^^^^^^^^^^^^^^^^^^^^^^^
736
737``plat/arm/board/tc/tc_dpe.h``
738
Tamas Ban624c9a02024-02-21 13:55:31 +0100739RSE OTP Assets Management
laurenw-arm5b006582023-06-30 17:03:03 -0500740-------------------------
741
Tamas Ban624c9a02024-02-21 13:55:31 +0100742RSE provides access for AP to assets in OTP, which include keys for image
laurenw-arm5b006582023-06-30 17:03:03 -0500743signature verification and non-volatile counters for anti-rollback protection.
744
745Non-Volatile Counter API
746^^^^^^^^^^^^^^^^^^^^^^^^
747
Tamas Ban624c9a02024-02-21 13:55:31 +0100748AP/RSE interface for retrieving and incrementing non-volatile counters API is
laurenw-arm5b006582023-06-30 17:03:03 -0500749as follows.
750
751Defined here:
752
Tamas Ban624c9a02024-02-21 13:55:31 +0100753- ``include/lib/psa/rse_platform_api.h``
laurenw-arm5b006582023-06-30 17:03:03 -0500754
755.. code-block:: c
756
Tamas Ban624c9a02024-02-21 13:55:31 +0100757 psa_status_t rse_platform_nv_counter_increment(uint32_t counter_id)
laurenw-arm5b006582023-06-30 17:03:03 -0500758
Tamas Ban624c9a02024-02-21 13:55:31 +0100759 psa_status_t rse_platform_nv_counter_read(uint32_t counter_id,
laurenw-arm5b006582023-06-30 17:03:03 -0500760 uint32_t size, uint8_t *val)
761
762Through this service, we can read/increment any of the 3 non-volatile
763counters used on an Arm CCA platform:
764
765- ``Non-volatile counter for CCA firmware (BL2, BL31, RMM).``
766- ``Non-volatile counter for secure firmware.``
767- ``Non-volatile counter for non-secure firmware.``
768
769Public Key API
770^^^^^^^^^^^^^^
771
Tamas Ban624c9a02024-02-21 13:55:31 +0100772AP/RSE interface for reading the ROTPK is as follows.
laurenw-arm5b006582023-06-30 17:03:03 -0500773
774Defined here:
775
Tamas Ban624c9a02024-02-21 13:55:31 +0100776- ``include/lib/psa/rse_platform_api.h``
laurenw-arm5b006582023-06-30 17:03:03 -0500777
778.. code-block:: c
779
Tamas Ban624c9a02024-02-21 13:55:31 +0100780 psa_status_t rse_platform_key_read(enum rse_key_id_builtin_t key,
laurenw-arm5b006582023-06-30 17:03:03 -0500781 uint8_t *data, size_t data_size, size_t *data_length)
782
783Through this service, we can read any of the 3 ROTPKs used on an
784Arm CCA platform:
785
786- ``ROTPK for CCA firmware (BL2, BL31, RMM).``
787- ``ROTPK for secure firmware.``
788- ``ROTPK for non-secure firmware.``
789
Leo Yan1147a472025-01-31 10:07:51 +0000790Get entropy API
791^^^^^^^^^^^^^^^
792
793AP/RSE interface for reading the entropy is as follows.
794
795Defined here:
796
797- ``include/lib/psa/rse_platform_api.h``
798
799.. code-block:: c
800
801 psa_status_t rse_platform_get_entropy(uint8_t *data, size_t data_size)
802
803Through this service, we can read an entropy generated from RSE.
804
Tamas Baneea607c2022-10-13 16:42:48 +0200805References
806----------
807
Tamas Bane4582e42024-09-03 10:44:55 +0200808.. [1] https://trustedfirmware-m.readthedocs.io/en/latest/platform/arm/rse/index.html
809.. [2] https://trustedfirmware-m.readthedocs.io/en/latest/platform/arm/rse/rse_comms.html
810.. [3] https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/partitions/measured_boot_integration_guide.html
811.. [4] https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/partitions/delegated_attestation/delegated_attest_integration_guide.html
812.. [5] https://trustedfirmware-m.readthedocs.io/en/latest/platform/arm/rse/rse_key_management.html
Tamas Baneea607c2022-10-13 16:42:48 +0200813.. [6] https://developer.arm.com/-/media/Files/pdf/PlatformSecurityArchitecture/Architect/DEN0063-PSA_Firmware_Framework-1.0.0-2.pdf?revision=2d1429fa-4b5b-461a-a60e-4ef3d8f7f4b4&hash=3BFD6F3E687F324672F18E5BE9F08EDC48087C93
814.. [7] https://developer.arm.com/documentation/DEN0096/A_a/?lang=en
Tamas Bane4582e42024-09-03 10:44:55 +0200815.. [8] https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/partitions/dice_protection_environment/dice_protection_environment.html
Tamas Baneea607c2022-10-13 16:42:48 +0200816
817--------------
818
Tamas Ban5c8b5f92024-09-05 10:11:23 +0200819*Copyright (c) 2023-2024, Arm Limited. All rights reserved.*
Thomas Fossati6dfeb602024-05-22 17:25:07 +0000820*Copyright (c) 2024, Linaro Limited. All rights reserved.*
Yann Gautier36416b12024-09-23 14:00:01 +0200821*Copyright (c) 2025, STMicroelectronics - All Rights Reserved*