1*91f16700SchasingluluRuntime Security Subsystem (RSS) 2*91f16700Schasinglulu================================ 3*91f16700Schasinglulu 4*91f16700SchasingluluThis document focuses on the relationship between the Runtime Security Subsystem 5*91f16700Schasinglulu(RSS) and the application processor (AP). According to the ARM reference design 6*91f16700Schasingluluthe RSS is an independent core next to the AP and the SCP on the same die. It 7*91f16700Schasingluluprovides fundamental security guarantees and runtime services for the rest of 8*91f16700Schasingluluthe system (e.g.: trusted boot, measured boot, platform attestation, 9*91f16700Schasinglulukey management, and key derivation). 10*91f16700Schasinglulu 11*91f16700SchasingluluAt power up RSS boots first from its private ROM code. It validates and loads 12*91f16700Schasingluluits own images and the initial images of SCP and AP. When AP and SCP are 13*91f16700Schasinglulureleased from reset and their initial code is loaded then they continue their 14*91f16700Schasingluluown boot process, which is the same as on non-RSS systems. Please refer to the 15*91f16700Schasinglulu``RSS documentation`` [1]_ for more details about the RSS boot flow. 16*91f16700Schasinglulu 17*91f16700SchasingluluThe last stage of the RSS firmware is a persistent, runtime component. Much 18*91f16700Schasinglululike AP_BL31, this is a passive entity which has no periodical task to do and 19*91f16700Schasinglulujust waits for external requests from other subsystems. RSS and other 20*91f16700Schasinglulusubsystems can communicate with each other over message exchange. RSS waits 21*91f16700Schasingluluin idle for the incoming request, handles them, and sends a response then goes 22*91f16700Schasingluluback to idle. 23*91f16700Schasinglulu 24*91f16700SchasingluluRSS communication layer 25*91f16700Schasinglulu----------------------- 26*91f16700Schasinglulu 27*91f16700SchasingluluThe communication between RSS and other subsystems are primarily relying on the 28*91f16700SchasingluluMessage Handling Unit (MHU) module. The number of MHU interfaces between RSS 29*91f16700Schasingluluand other cores is IMPDEF. Besides MHU other modules also could take part in 30*91f16700Schasingluluthe communication. RSS is capable of mapping the AP memory to its address space. 31*91f16700SchasingluluThereby either RSS core itself or a DMA engine if it is present, can move the 32*91f16700Schasingluludata between memory belonging to RSS or AP. In this way, a bigger amount of data 33*91f16700Schasinglulucan be transferred in a short time. 34*91f16700Schasinglulu 35*91f16700SchasingluluThe MHU comes in pairs. There is a sender and receiver side. They are connected 36*91f16700Schasingluluto each other. An MHU interface consists of two pairs of MHUs, one sender and 37*91f16700Schasingluluone receiver on both sides. Bidirectional communication is possible over an 38*91f16700Schasingluluinterface. One pair provides message sending from AP to RSS and the other pair 39*91f16700Schasinglulufrom RSS to AP. The sender and receiver are connected via channels. There is an 40*91f16700SchasingluluIMPDEF number of channels (e.g: 4-16) between a sender and a receiver module. 41*91f16700Schasinglulu 42*91f16700SchasingluluThe RSS communication layer provides two ways for message exchange: 43*91f16700Schasinglulu 44*91f16700Schasinglulu- ``Embedded messaging``: The full message, including header and payload, are 45*91f16700Schasinglulu exchanged over the MHU channels. A channel is capable of delivering a single 46*91f16700Schasinglulu word. The sender writes the data to the channel register on its side and the 47*91f16700Schasinglulu receiver can read the data from the channel on the other side. One dedicated 48*91f16700Schasinglulu channel is used for signalling. It does not deliver any payload it is just 49*91f16700Schasinglulu meant for signalling that the sender loaded the data to the channel registers 50*91f16700Schasinglulu so the receiver can read them. The receiver uses the same channel to signal 51*91f16700Schasinglulu that data was read. Signalling happens via IRQ. If the message is longer than 52*91f16700Schasinglulu the data fit to the channel registers then the message is sent over in 53*91f16700Schasinglulu multiple rounds. Both, sender and receiver allocate a local buffer for the 54*91f16700Schasinglulu messages. Data is copied from/to these buffers to/from the channel registers. 55*91f16700Schasinglulu- ``Pointer-access messaging``: The message header and the payload are 56*91f16700Schasinglulu separated and they are conveyed in different ways. The header is sent 57*91f16700Schasinglulu over the channels, similar to the embedded messaging but the payload is 58*91f16700Schasinglulu copied over by RSS core (or by DMA) between the sender and the receiver. This 59*91f16700Schasinglulu could be useful in the case of long messages because transaction time is less 60*91f16700Schasinglulu compared to the embedded messaging mode. Small payloads are copied by the RSS 61*91f16700Schasinglulu core because setting up DMA would require more CPU cycles. The payload is 62*91f16700Schasinglulu either copied into an internal buffer or directly read-written by RSS. Actual 63*91f16700Schasinglulu behavior depends on RSS setup, whether the partition supports memory-mapped 64*91f16700Schasinglulu ``iovec``. Therefore, the sender must handle both cases and prevent access to 65*91f16700Schasinglulu the memory, where payload data lives, while the RSS handles the request. 66*91f16700Schasinglulu 67*91f16700SchasingluluThe RSS communication layer supports both ways of messaging in parallel. It is 68*91f16700Schasingluludecided at runtime based on the message size which way to transfer the message. 69*91f16700Schasinglulu 70*91f16700Schasinglulu.. code-block:: bash 71*91f16700Schasinglulu 72*91f16700Schasinglulu +----------------------------------------------+ +-------------------+ 73*91f16700Schasinglulu | | | | 74*91f16700Schasinglulu | AP | | | 75*91f16700Schasinglulu | | +--->| SRAM | 76*91f16700Schasinglulu +----------------------------------------------| | | | 77*91f16700Schasinglulu | BL1 / BL2 / BL31 | | | | 78*91f16700Schasinglulu +----------------------------------------------+ | +-------------------+ 79*91f16700Schasinglulu | ^ | ^ ^ 80*91f16700Schasinglulu | send IRQ | receive |direct | | 81*91f16700Schasinglulu V | |access | | 82*91f16700Schasinglulu +--------------------+ +--------------------+ | | | 83*91f16700Schasinglulu | MHU sender | | MHU receiver | | | Copy data | 84*91f16700Schasinglulu +--------------------+ +--------------------+ | | | 85*91f16700Schasinglulu | | | | | | | | | | | 86*91f16700Schasinglulu | | channels | | | | channels | | | | | 87*91f16700Schasinglulu | | e.g: 4-16 | | | | e.g: 4-16 | | | V | 88*91f16700Schasinglulu +--------------------+ +--------------------+ | +-------+ | 89*91f16700Schasinglulu | MHU receiver | | MHU sender | | +->| DMA | | 90*91f16700Schasinglulu +--------------------+ +--------------------+ | | +-------+ | 91*91f16700Schasinglulu | ^ | | ^ | 92*91f16700Schasinglulu IRQ | receive | send | | | Copy data | 93*91f16700Schasinglulu V | | | V V 94*91f16700Schasinglulu +----------------------------------------------+ | | +-------------------+ 95*91f16700Schasinglulu | |--+-+ | | 96*91f16700Schasinglulu | RSS | | SRAM | 97*91f16700Schasinglulu | | | | 98*91f16700Schasinglulu +----------------------------------------------+ +-------------------+ 99*91f16700Schasinglulu 100*91f16700Schasinglulu.. Note:: 101*91f16700Schasinglulu 102*91f16700Schasinglulu The RSS communication layer is not prepared for concurrent execution. The 103*91f16700Schasinglulu current use case only requires message exchange during the boot phase. In 104*91f16700Schasinglulu the boot phase, only a single core is running and the rest of the cores are 105*91f16700Schasinglulu in reset. 106*91f16700Schasinglulu 107*91f16700SchasingluluMessage structure 108*91f16700Schasinglulu^^^^^^^^^^^^^^^^^ 109*91f16700SchasingluluA description of the message format can be found in the ``RSS communication 110*91f16700Schasingluludesign`` [2]_ document. 111*91f16700Schasinglulu 112*91f16700SchasingluluSource files 113*91f16700Schasinglulu^^^^^^^^^^^^ 114*91f16700Schasinglulu- RSS comms: ``drivers/arm/rss`` 115*91f16700Schasinglulu- MHU driver: ``drivers/arm/mhu`` 116*91f16700Schasinglulu 117*91f16700Schasinglulu 118*91f16700SchasingluluAPI for communication over MHU 119*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 120*91f16700SchasingluluThe API is defined in these header files: 121*91f16700Schasinglulu 122*91f16700Schasinglulu- ``include/drivers/arm/rss_comms.h`` 123*91f16700Schasinglulu- ``include/drivers/arm/mhu.h`` 124*91f16700Schasinglulu 125*91f16700SchasingluluRSS provided runtime services 126*91f16700Schasinglulu----------------------------- 127*91f16700Schasinglulu 128*91f16700SchasingluluRSS provides the following runtime services: 129*91f16700Schasinglulu 130*91f16700Schasinglulu- ``Measured boot``: Securely store the firmware measurements which were 131*91f16700Schasinglulu computed during the boot process and the associated metadata (image 132*91f16700Schasinglulu description, measurement algorithm, etc.). More info on measured boot service 133*91f16700Schasinglulu in RSS can be found in the ``measured_boot_integration_guide`` [3]_ . 134*91f16700Schasinglulu- ``Delegated attestation``: Query the platform attestation token and derive a 135*91f16700Schasinglulu delegated attestation key. More info on the delegated attestation service 136*91f16700Schasinglulu in RSS can be found in the ``delegated_attestation_integration_guide`` [4]_ . 137*91f16700Schasinglulu- ``OTP assets management``: Public keys used by AP during the trusted boot 138*91f16700Schasinglulu process can be requested from RSS. Furthermore, AP can request RSS to 139*91f16700Schasinglulu increase a non-volatile counter. Please refer to the 140*91f16700Schasinglulu ``RSS key management`` [5]_ document for more details. 141*91f16700Schasinglulu 142*91f16700SchasingluluRuntime service API 143*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^ 144*91f16700SchasingluluThe RSS provided runtime services implement a PSA aligned API. The parameter 145*91f16700Schasingluluencoding follows the PSA client protocol described in the 146*91f16700Schasinglulu``Firmware Framework for M`` [6]_ document in chapter 4.4. The implementation is 147*91f16700Schasinglulurestricted to the static handle use case therefore only the ``psa_call`` API is 148*91f16700Schasingluluimplemented. 149*91f16700Schasinglulu 150*91f16700Schasinglulu 151*91f16700SchasingluluSoftware and API layers 152*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^^ 153*91f16700Schasinglulu 154*91f16700Schasinglulu.. code-block:: bash 155*91f16700Schasinglulu 156*91f16700Schasinglulu +----------------+ +---------------------+ 157*91f16700Schasinglulu | BL1 / BL2 | | BL31 | 158*91f16700Schasinglulu +----------------+ +---------------------+ 159*91f16700Schasinglulu | | 160*91f16700Schasinglulu | extend_measurement() | get_delegated_key() 161*91f16700Schasinglulu | | get_platform_token() 162*91f16700Schasinglulu V V 163*91f16700Schasinglulu +----------------+ +---------------------+ 164*91f16700Schasinglulu | PSA protocol | | PSA protocol | 165*91f16700Schasinglulu +----------------+ +---------------------+ 166*91f16700Schasinglulu | | 167*91f16700Schasinglulu | psa_call() | psa_call() 168*91f16700Schasinglulu | | 169*91f16700Schasinglulu V V 170*91f16700Schasinglulu +------------------------------------------------+ 171*91f16700Schasinglulu | RSS communication protocol | 172*91f16700Schasinglulu +------------------------------------------------+ 173*91f16700Schasinglulu | ^ 174*91f16700Schasinglulu | mhu_send_data() | mhu_receive_data() 175*91f16700Schasinglulu | | 176*91f16700Schasinglulu V | 177*91f16700Schasinglulu +------------------------------------------------+ 178*91f16700Schasinglulu | MHU driver | 179*91f16700Schasinglulu +------------------------------------------------+ 180*91f16700Schasinglulu | ^ 181*91f16700Schasinglulu | Register access | IRQ 182*91f16700Schasinglulu V | 183*91f16700Schasinglulu +------------------------------------------------+ 184*91f16700Schasinglulu | MHU HW on AP side | 185*91f16700Schasinglulu +------------------------------------------------+ 186*91f16700Schasinglulu ^ 187*91f16700Schasinglulu | Physical wires 188*91f16700Schasinglulu | 189*91f16700Schasinglulu V 190*91f16700Schasinglulu +------------------------------------------------+ 191*91f16700Schasinglulu | MHU HW on RSS side | 192*91f16700Schasinglulu +------------------------------------------------+ 193*91f16700Schasinglulu | ^ 194*91f16700Schasinglulu | IRQ | Register access 195*91f16700Schasinglulu V | 196*91f16700Schasinglulu +------------------------------------------------+ 197*91f16700Schasinglulu | MHU driver | 198*91f16700Schasinglulu +------------------------------------------------+ 199*91f16700Schasinglulu | | 200*91f16700Schasinglulu V V 201*91f16700Schasinglulu +---------------+ +------------------------+ 202*91f16700Schasinglulu | Measured boot | | Delegated attestation | 203*91f16700Schasinglulu | service | | service | 204*91f16700Schasinglulu +---------------+ +------------------------+ 205*91f16700Schasinglulu 206*91f16700Schasinglulu 207*91f16700SchasingluluRSS based Measured Boot 208*91f16700Schasinglulu----------------------- 209*91f16700Schasinglulu 210*91f16700SchasingluluMeasured Boot is the process of cryptographically measuring (computing the hash 211*91f16700Schasingluluvalue of a binary) the code and critical data used at boot time. The 212*91f16700Schasinglulumeasurement must be stored in a tamper-resistant way, so the security state 213*91f16700Schasingluluof the device can be attested later to an external party. RSS provides a runtime 214*91f16700Schasingluluservice which is meant to store measurements and associated metadata alongside. 215*91f16700Schasinglulu 216*91f16700SchasingluluData is stored in internal SRAM which is only accessible by the secure runtime 217*91f16700Schasinglulufirmware of RSS. Data is stored in so-called measurement slots. A platform has 218*91f16700SchasingluluIMPDEF number of measurement slots. The measurement storage follows extend 219*91f16700Schasinglulusemantics. This means that measurements are not stored directly (as it was 220*91f16700Schasinglulutaken) instead they contribute to the current value of the measurement slot. 221*91f16700SchasingluluThe extension implements this logic, where ``||`` stands for concatenation: 222*91f16700Schasinglulu 223*91f16700Schasinglulu.. code-block:: bash 224*91f16700Schasinglulu 225*91f16700Schasinglulu new_value_of_measurement_slot = Hash(old_value_of_measurement_slot || measurement) 226*91f16700Schasinglulu 227*91f16700SchasingluluSupported hash algorithms: sha-256, sha-512 228*91f16700Schasinglulu 229*91f16700SchasingluluMeasured Boot API 230*91f16700Schasinglulu^^^^^^^^^^^^^^^^^ 231*91f16700Schasinglulu 232*91f16700SchasingluluDefined here: 233*91f16700Schasinglulu 234*91f16700Schasinglulu- ``include/lib/psa/measured_boot.h`` 235*91f16700Schasinglulu 236*91f16700Schasinglulu.. code-block:: c 237*91f16700Schasinglulu 238*91f16700Schasinglulu psa_status_t 239*91f16700Schasinglulu rss_measured_boot_extend_measurement(uint8_t index, 240*91f16700Schasinglulu const uint8_t *signer_id, 241*91f16700Schasinglulu size_t signer_id_size, 242*91f16700Schasinglulu const uint8_t *version, 243*91f16700Schasinglulu size_t version_size, 244*91f16700Schasinglulu uint32_t measurement_algo, 245*91f16700Schasinglulu const uint8_t *sw_type, 246*91f16700Schasinglulu size_t sw_type_size, 247*91f16700Schasinglulu const uint8_t *measurement_value, 248*91f16700Schasinglulu size_t measurement_value_size, 249*91f16700Schasinglulu bool lock_measurement); 250*91f16700Schasinglulu 251*91f16700SchasingluluMeasured Boot Metadata 252*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^ 253*91f16700Schasinglulu 254*91f16700SchasingluluThe following metadata can be stored alongside the measurement: 255*91f16700Schasinglulu 256*91f16700Schasinglulu- ``Signer-id``: Mandatory. The hash of the firmware image signing public key. 257*91f16700Schasinglulu- ``Measurement algorithm``: Optional. The hash algorithm which was used to 258*91f16700Schasinglulu compute the measurement (e.g.: sha-256, etc.). 259*91f16700Schasinglulu- ``Version info``: Optional. The firmware version info (e.g.: 2.7). 260*91f16700Schasinglulu- ``SW type``: Optional. Short text description (e.g.: BL1, BL2, BL31, etc.) 261*91f16700Schasinglulu 262*91f16700Schasinglulu.. Note:: 263*91f16700Schasinglulu Version info is not implemented in TF-A yet. 264*91f16700Schasinglulu 265*91f16700Schasinglulu 266*91f16700SchasingluluThe caller must specify in which measurement slot to extend a certain 267*91f16700Schasinglulumeasurement and metadata. A measurement slot can be extended by multiple 268*91f16700Schasinglulumeasurements. The default value is IMPDEF. All measurement slot is cleared at 269*91f16700Schasinglulureset, there is no other way to clear them. In the reference implementation, 270*91f16700Schasingluluthe measurement slots are initialized to 0. At the first call to extend the 271*91f16700Schasinglulumeasurement in a slot, the extend operation uses the default value of the 272*91f16700Schasinglulumeasurement slot. All upcoming extend operation on the same slot contributes 273*91f16700Schasingluluto the previous value of that measurement slot. 274*91f16700Schasinglulu 275*91f16700SchasingluluThe following rules are kept when a slot is extended multiple times: 276*91f16700Schasinglulu 277*91f16700Schasinglulu- ``Signer-id`` must be the same as the previous call(s), otherwise a 278*91f16700Schasinglulu PSA_ERROR_NOT_PERMITTED error code is returned. 279*91f16700Schasinglulu 280*91f16700Schasinglulu- ``Measurement algorithm``: must be the same as the previous call(s), 281*91f16700Schasinglulu otherwise, a PSA_ERROR_NOT_PERMITTED error code is returned. 282*91f16700Schasinglulu 283*91f16700SchasingluluIn case of error no further action is taken (slot is not locked). If there is 284*91f16700Schasinglulua valid data in a sub-sequent call then measurement slot will be extended. The 285*91f16700Schasinglulurest of the metadata is handled as follows when a measurement slot is extended 286*91f16700Schasinglulumultiple times: 287*91f16700Schasinglulu 288*91f16700Schasinglulu- ``SW type``: Cleared. 289*91f16700Schasinglulu- ``Version info``: Cleared. 290*91f16700Schasinglulu 291*91f16700Schasinglulu.. Note:: 292*91f16700Schasinglulu 293*91f16700Schasinglulu Extending multiple measurements in the same slot leads to some metadata 294*91f16700Schasinglulu information loss. Since RSS is not constrained on special HW resources to 295*91f16700Schasinglulu store the measurements and metadata, therefore it is worth considering to 296*91f16700Schasinglulu store all of them one by one in distinct slots. However, they are one-by-one 297*91f16700Schasinglulu included in the platform attestation token. So, the number of distinct 298*91f16700Schasinglulu firmware image measurements has an impact on the size of the attestation 299*91f16700Schasinglulu token. 300*91f16700Schasinglulu 301*91f16700SchasingluluThe allocation of the measurement slot among RSS, Root and Realm worlds is 302*91f16700Schasingluluplatform dependent. The platform must provide an allocation of the measurement 303*91f16700Schasingluluslot at build time. An example can be found in 304*91f16700Schasinglulu``tf-a/plat/arm/board/tc/tc_bl1_measured_boot.c`` 305*91f16700SchasingluluFurthermore, the memory, which holds the metadata is also statically allocated 306*91f16700Schasingluluin RSS memory. Some of the fields have a static value (measurement algorithm), 307*91f16700Schasingluluand some of the values have a dynamic value (measurement value) which is updated 308*91f16700Schasingluluby the bootloaders when the firmware image is loaded and measured. The metadata 309*91f16700Schasinglulustructure is defined in 310*91f16700Schasinglulu``include/drivers/measured_boot/rss/rss_measured_boot.h``. 311*91f16700Schasinglulu 312*91f16700Schasinglulu.. code-block:: c 313*91f16700Schasinglulu 314*91f16700Schasinglulu struct rss_mboot_metadata { 315*91f16700Schasinglulu unsigned int id; 316*91f16700Schasinglulu uint8_t slot; 317*91f16700Schasinglulu uint8_t signer_id[SIGNER_ID_MAX_SIZE]; 318*91f16700Schasinglulu size_t signer_id_size; 319*91f16700Schasinglulu uint8_t version[VERSION_MAX_SIZE]; 320*91f16700Schasinglulu size_t version_size; 321*91f16700Schasinglulu uint8_t sw_type[SW_TYPE_MAX_SIZE]; 322*91f16700Schasinglulu size_t sw_type_size; 323*91f16700Schasinglulu void *pk_oid; 324*91f16700Schasinglulu bool lock_measurement; 325*91f16700Schasinglulu }; 326*91f16700Schasinglulu 327*91f16700SchasingluluSigner-ID API 328*91f16700Schasinglulu^^^^^^^^^^^^^ 329*91f16700Schasinglulu 330*91f16700SchasingluluThis function calculates the hash of a public key (signer-ID) using the 331*91f16700Schasinglulu``Measurement algorithm`` and stores it in the ``rss_mboot_metadata`` field 332*91f16700Schasinglulunamed ``signer_id``. 333*91f16700SchasingluluPrior to calling this function, the caller must ensure that the ``signer_id`` 334*91f16700Schasinglulufield points to the zero-filled buffer. 335*91f16700Schasinglulu 336*91f16700SchasingluluDefined here: 337*91f16700Schasinglulu 338*91f16700Schasinglulu- ``include/drivers/measured_boot/rss/rss_measured_boot.h`` 339*91f16700Schasinglulu 340*91f16700Schasinglulu.. code-block:: c 341*91f16700Schasinglulu 342*91f16700Schasinglulu int rss_mboot_set_signer_id(struct rss_mboot_metadata *metadata_ptr, 343*91f16700Schasinglulu const void *pk_oid, 344*91f16700Schasinglulu const void *pk_ptr, 345*91f16700Schasinglulu size_t pk_len) 346*91f16700Schasinglulu 347*91f16700Schasinglulu 348*91f16700Schasinglulu- First parameter is the pointer to the ``rss_mboot_metadata`` structure. 349*91f16700Schasinglulu- Second parameter is the pointer to the key-OID of the public key. 350*91f16700Schasinglulu- Third parameter is the pointer to the public key buffer. 351*91f16700Schasinglulu- Fourth parameter is the size of public key buffer. 352*91f16700Schasinglulu- This function returns 0 on success, a signed integer error code 353*91f16700Schasinglulu otherwise. 354*91f16700Schasinglulu 355*91f16700SchasingluluBuild time config options 356*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^^^^ 357*91f16700Schasinglulu 358*91f16700Schasinglulu- ``MEASURED_BOOT``: Enable measured boot. It depends on the platform 359*91f16700Schasinglulu implementation whether RSS or TPM (or both) backend based measured boot is 360*91f16700Schasinglulu enabled. 361*91f16700Schasinglulu- ``MBOOT_RSS_HASH_ALG``: Determine the hash algorithm to measure the images. 362*91f16700Schasinglulu The default value is sha-256. 363*91f16700Schasinglulu 364*91f16700SchasingluluMeasured boot flow 365*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^ 366*91f16700Schasinglulu 367*91f16700Schasinglulu.. figure:: ../resources/diagrams/rss_measured_boot_flow.svg 368*91f16700Schasinglulu :align: center 369*91f16700Schasinglulu 370*91f16700SchasingluluSample console log 371*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^ 372*91f16700Schasinglulu 373*91f16700Schasinglulu.. code-block:: bash 374*91f16700Schasinglulu 375*91f16700Schasinglulu INFO: Measured boot extend measurement: 376*91f16700Schasinglulu INFO: - slot : 6 377*91f16700Schasinglulu INFO: - signer_id : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 378*91f16700Schasinglulu INFO: : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 379*91f16700Schasinglulu INFO: - version : 380*91f16700Schasinglulu INFO: - version_size: 0 381*91f16700Schasinglulu INFO: - sw_type : FW_CONFIG 382*91f16700Schasinglulu INFO: - sw_type_size: 10 383*91f16700Schasinglulu INFO: - algorithm : 2000009 384*91f16700Schasinglulu INFO: - measurement : aa ea d3 a7 a8 e2 ab 7d 13 a6 cb 34 99 10 b9 a1 385*91f16700Schasinglulu INFO: : 1b 9f a0 52 c5 a8 b1 d7 76 f2 c1 c1 ef ca 1a df 386*91f16700Schasinglulu INFO: - locking : true 387*91f16700Schasinglulu INFO: FCONF: Config file with image ID:31 loaded at address = 0x4001010 388*91f16700Schasinglulu INFO: Loading image id=24 at address 0x4001300 389*91f16700Schasinglulu INFO: Image id=24 loaded: 0x4001300 - 0x400153a 390*91f16700Schasinglulu INFO: Measured boot extend measurement: 391*91f16700Schasinglulu INFO: - slot : 7 392*91f16700Schasinglulu INFO: - signer_id : b0 f3 82 09 12 97 d8 3a 37 7a 72 47 1b ec 32 73 393*91f16700Schasinglulu INFO: : e9 92 32 e2 49 59 f6 5e 8b 4a 4a 46 d8 22 9a da 394*91f16700Schasinglulu INFO: - version : 395*91f16700Schasinglulu INFO: - version_size: 0 396*91f16700Schasinglulu INFO: - sw_type : TB_FW_CONFIG 397*91f16700Schasinglulu INFO: - sw_type_size: 13 398*91f16700Schasinglulu INFO: - algorithm : 2000009 399*91f16700Schasinglulu INFO: - measurement : 05 b9 dc 98 62 26 a7 1c 2d e5 bb af f0 90 52 28 400*91f16700Schasinglulu INFO: : f2 24 15 8a 3a 56 60 95 d6 51 3a 7a 1a 50 9b b7 401*91f16700Schasinglulu INFO: - locking : true 402*91f16700Schasinglulu INFO: FCONF: Config file with image ID:24 loaded at address = 0x4001300 403*91f16700Schasinglulu INFO: BL1: Loading BL2 404*91f16700Schasinglulu INFO: Loading image id=1 at address 0x404d000 405*91f16700Schasinglulu INFO: Image id=1 loaded: 0x404d000 - 0x406412a 406*91f16700Schasinglulu INFO: Measured boot extend measurement: 407*91f16700Schasinglulu INFO: - slot : 8 408*91f16700Schasinglulu INFO: - signer_id : b0 f3 82 09 12 97 d8 3a 37 7a 72 47 1b ec 32 73 409*91f16700Schasinglulu INFO: : e9 92 32 e2 49 59 f6 5e 8b 4a 4a 46 d8 22 9a da 410*91f16700Schasinglulu INFO: - version : 411*91f16700Schasinglulu INFO: - version_size: 0 412*91f16700Schasinglulu INFO: - sw_type : BL_2 413*91f16700Schasinglulu INFO: - sw_type_size: 5 414*91f16700Schasinglulu INFO: - algorithm : 2000009 415*91f16700Schasinglulu INFO: - measurement : 53 a1 51 75 25 90 fb a1 d9 b8 c8 34 32 3a 01 16 416*91f16700Schasinglulu INFO: : c9 9e 74 91 7d 28 02 56 3f 5c 40 94 37 58 50 68 417*91f16700Schasinglulu INFO: - locking : true 418*91f16700Schasinglulu 419*91f16700SchasingluluDelegated Attestation 420*91f16700Schasinglulu--------------------- 421*91f16700Schasinglulu 422*91f16700SchasingluluDelegated Attestation Service was mainly developed to support the attestation 423*91f16700Schasingluluflow on the ``ARM Confidential Compute Architecture`` (ARM CCA) [7]_. 424*91f16700SchasingluluThe detailed description of the delegated attestation service can be found in 425*91f16700Schasingluluthe ``Delegated Attestation Service Integration Guide`` [4]_ document. 426*91f16700Schasinglulu 427*91f16700SchasingluluIn the CCA use case, the Realm Management Monitor (RMM) relies on the delegated 428*91f16700Schasingluluattestation service of the RSS to get a realm attestation key and the CCA 429*91f16700Schasingluluplatform token. BL31 does not use the service for its own purpose, only calls 430*91f16700Schasingluluit on behalf of RMM. The access to MHU interface and thereby to RSS is 431*91f16700Schasinglulurestricted to BL31 only. Therefore, RMM does not have direct access, all calls 432*91f16700Schasingluluneed to go through BL31. The RMM dispatcher module of the BL31 is responsible 433*91f16700Schasinglulufor delivering the calls between the two parties. 434*91f16700Schasinglulu 435*91f16700Schasinglulu.. Note:: 436*91f16700Schasinglulu Currently the connection between the RMM dispatcher and the PSA/RSS layer 437*91f16700Schasinglulu is not yet implemented. RMM dispatcher just returns hard coded data. 438*91f16700Schasinglulu 439*91f16700SchasingluluDelegated Attestation API 440*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^^^^ 441*91f16700SchasingluluDefined here: 442*91f16700Schasinglulu 443*91f16700Schasinglulu- ``include/lib/psa/delegated_attestation.h`` 444*91f16700Schasinglulu 445*91f16700Schasinglulu.. code-block:: c 446*91f16700Schasinglulu 447*91f16700Schasinglulu psa_status_t 448*91f16700Schasinglulu rss_delegated_attest_get_delegated_key(uint8_t ecc_curve, 449*91f16700Schasinglulu uint32_t key_bits, 450*91f16700Schasinglulu uint8_t *key_buf, 451*91f16700Schasinglulu size_t key_buf_size, 452*91f16700Schasinglulu size_t *key_size, 453*91f16700Schasinglulu uint32_t hash_algo); 454*91f16700Schasinglulu 455*91f16700Schasinglulu psa_status_t 456*91f16700Schasinglulu rss_delegated_attest_get_token(const uint8_t *dak_pub_hash, 457*91f16700Schasinglulu size_t dak_pub_hash_size, 458*91f16700Schasinglulu uint8_t *token_buf, 459*91f16700Schasinglulu size_t token_buf_size, 460*91f16700Schasinglulu size_t *token_size); 461*91f16700Schasinglulu 462*91f16700SchasingluluAttestation flow 463*91f16700Schasinglulu^^^^^^^^^^^^^^^^ 464*91f16700Schasinglulu 465*91f16700Schasinglulu.. figure:: ../resources/diagrams/rss_attestation_flow.svg 466*91f16700Schasinglulu :align: center 467*91f16700Schasinglulu 468*91f16700SchasingluluSample attestation token 469*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^^^ 470*91f16700Schasinglulu 471*91f16700SchasingluluBinary format: 472*91f16700Schasinglulu 473*91f16700Schasinglulu.. code-block:: bash 474*91f16700Schasinglulu 475*91f16700Schasinglulu INFO: DELEGATED ATTEST TEST START 476*91f16700Schasinglulu INFO: Get delegated attestation key start 477*91f16700Schasinglulu INFO: Get delegated attest key succeeds, len: 48 478*91f16700Schasinglulu INFO: Delegated attest key: 479*91f16700Schasinglulu INFO: 0d 2a 66 61 d4 89 17 e1 70 c6 73 56 df f4 11 fd 480*91f16700Schasinglulu INFO: 7d 1f 3b 8a a3 30 3d 70 4c d9 06 c3 c7 ef 29 43 481*91f16700Schasinglulu INFO: 0f ee b5 e7 56 e0 71 74 1b c4 39 39 fd 85 f6 7b 482*91f16700Schasinglulu INFO: Get platform token start 483*91f16700Schasinglulu INFO: Get platform token succeeds, len: 1086 484*91f16700Schasinglulu INFO: Platform attestation token: 485*91f16700Schasinglulu INFO: d2 84 44 a1 01 38 22 a0 59 03 d1 a9 0a 58 20 00 486*91f16700Schasinglulu INFO: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 487*91f16700Schasinglulu INFO: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 488*91f16700Schasinglulu INFO: 01 00 58 21 01 cb 8c 79 f7 a0 0a 6c ce 12 66 f8 489*91f16700Schasinglulu INFO: 64 45 48 42 0e c5 10 bf 84 ee 22 18 b9 8f 11 04 490*91f16700Schasinglulu INFO: c7 22 31 9d fb 19 09 5c 58 20 aa aa aa aa aa aa 491*91f16700Schasinglulu INFO: aa aa bb bb bb bb bb bb bb bb cc cc cc cc cc cc 492*91f16700Schasinglulu INFO: cc cc dd dd dd dd dd dd dd dd 19 09 5b 19 30 00 493*91f16700Schasinglulu INFO: 19 09 5f 89 a4 05 58 20 bf e6 d8 6f 88 26 f4 ff 494*91f16700Schasinglulu INFO: 97 fb 96 c4 e6 fb c4 99 3e 46 19 fc 56 5d a2 6a 495*91f16700Schasinglulu INFO: df 34 c3 29 48 9a dc 38 04 67 31 2e 36 2e 30 2b 496*91f16700Schasinglulu INFO: 30 01 64 52 54 5f 30 02 58 20 90 27 f2 46 ab 31 497*91f16700Schasinglulu INFO: 85 36 46 c4 d7 c6 60 ed 31 0d 3c f0 14 de f0 6c 498*91f16700Schasinglulu INFO: 24 0b de b6 7a 84 fc 3f 5b b7 a4 05 58 20 b3 60 499*91f16700Schasinglulu INFO: ca f5 c9 8c 6b 94 2a 48 82 fa 9d 48 23 ef b1 66 500*91f16700Schasinglulu INFO: a9 ef 6a 6e 4a a3 7c 19 19 ed 1f cc c0 49 04 67 501*91f16700Schasinglulu INFO: 30 2e 30 2e 30 2b 30 01 64 52 54 5f 31 02 58 20 502*91f16700Schasinglulu INFO: 52 13 15 d4 9d b2 cf 54 e4 99 37 44 40 68 f0 70 503*91f16700Schasinglulu INFO: 7d 73 64 ae f7 08 14 b0 f7 82 ad c6 17 db a3 91 504*91f16700Schasinglulu INFO: a4 05 58 20 bf e6 d8 6f 88 26 f4 ff 97 fb 96 c4 505*91f16700Schasinglulu INFO: e6 fb c4 99 3e 46 19 fc 56 5d a2 6a df 34 c3 29 506*91f16700Schasinglulu INFO: 48 9a dc 38 04 67 31 2e 35 2e 30 2b 30 01 64 52 507*91f16700Schasinglulu INFO: 54 5f 32 02 58 20 8e 5d 64 7e 6f 6c c6 6f d4 4f 508*91f16700Schasinglulu INFO: 54 b6 06 e5 47 9a cc 1b f3 7f ce 87 38 49 c5 92 509*91f16700Schasinglulu INFO: d8 2f 85 2e 85 42 a4 05 58 20 bf e6 d8 6f 88 26 510*91f16700Schasinglulu INFO: f4 ff 97 fb 96 c4 e6 fb c4 99 3e 46 19 fc 56 5d 511*91f16700Schasinglulu INFO: a2 6a df 34 c3 29 48 9a dc 38 04 67 31 2e 35 2e 512*91f16700Schasinglulu INFO: 30 2b 30 01 60 02 58 20 b8 01 65 a7 78 8b c6 59 513*91f16700Schasinglulu INFO: 42 8d 33 10 85 d1 49 0a dc 9e c3 ee df 85 1b d2 514*91f16700Schasinglulu INFO: f0 73 73 6a 0c 07 11 b8 a4 05 58 20 b0 f3 82 09 515*91f16700Schasinglulu INFO: 12 97 d8 3a 37 7a 72 47 1b ec 32 73 e9 92 32 e2 516*91f16700Schasinglulu INFO: 49 59 f6 5e 8b 4a 4a 46 d8 22 9a da 04 60 01 6a 517*91f16700Schasinglulu INFO: 46 57 5f 43 4f 4e 46 49 47 00 02 58 20 21 9e a0 518*91f16700Schasinglulu INFO: 13 82 e6 d7 97 5a 11 13 a3 5f 45 39 68 b1 d9 a3 519*91f16700Schasinglulu INFO: ea 6a ab 84 23 3b 8c 06 16 98 20 ba b9 a4 05 58 520*91f16700Schasinglulu INFO: 20 b0 f3 82 09 12 97 d8 3a 37 7a 72 47 1b ec 32 521*91f16700Schasinglulu INFO: 73 e9 92 32 e2 49 59 f6 5e 8b 4a 4a 46 d8 22 9a 522*91f16700Schasinglulu INFO: da 04 60 01 6d 54 42 5f 46 57 5f 43 4f 4e 46 49 523*91f16700Schasinglulu INFO: 47 00 02 58 20 41 39 f6 c2 10 84 53 c5 17 ae 9a 524*91f16700Schasinglulu INFO: e5 be c1 20 7b cc 24 24 f3 9d 20 a8 fb c7 b3 10 525*91f16700Schasinglulu INFO: e3 ee af 1b 05 a4 05 58 20 b0 f3 82 09 12 97 d8 526*91f16700Schasinglulu INFO: 3a 37 7a 72 47 1b ec 32 73 e9 92 32 e2 49 59 f6 527*91f16700Schasinglulu INFO: 5e 8b 4a 4a 46 d8 22 9a da 04 60 01 65 42 4c 5f 528*91f16700Schasinglulu INFO: 32 00 02 58 20 5c 96 20 e1 e3 3b 0f 2c eb c1 8e 529*91f16700Schasinglulu INFO: 1a 02 a6 65 86 dd 34 97 a7 4c 98 13 bf 74 14 45 530*91f16700Schasinglulu INFO: 2d 30 28 05 c3 a4 05 58 20 b0 f3 82 09 12 97 d8 531*91f16700Schasinglulu INFO: 3a 37 7a 72 47 1b ec 32 73 e9 92 32 e2 49 59 f6 532*91f16700Schasinglulu INFO: 5e 8b 4a 4a 46 d8 22 9a da 04 60 01 6e 53 45 43 533*91f16700Schasinglulu INFO: 55 52 45 5f 52 54 5f 45 4c 33 00 02 58 20 f6 fb 534*91f16700Schasinglulu INFO: 62 99 a5 0c df db 02 0b 72 5b 1c 0b 63 6e 94 ee 535*91f16700Schasinglulu INFO: 66 50 56 3a 29 9c cb 38 f0 ec 59 99 d4 2e a4 05 536*91f16700Schasinglulu INFO: 58 20 b0 f3 82 09 12 97 d8 3a 37 7a 72 47 1b ec 537*91f16700Schasinglulu INFO: 32 73 e9 92 32 e2 49 59 f6 5e 8b 4a 4a 46 d8 22 538*91f16700Schasinglulu INFO: 9a da 04 60 01 6a 48 57 5f 43 4f 4e 46 49 47 00 539*91f16700Schasinglulu INFO: 02 58 20 98 5d 87 21 84 06 33 9d c3 1f 91 f5 68 540*91f16700Schasinglulu INFO: 8d a0 5a f0 d7 7e 20 51 ce 3b f2 a5 c3 05 2e 3c 541*91f16700Schasinglulu INFO: 8b 52 31 19 01 09 78 1c 68 74 74 70 3a 2f 2f 61 542*91f16700Schasinglulu INFO: 72 6d 2e 63 6f 6d 2f 43 43 41 2d 53 53 44 2f 31 543*91f16700Schasinglulu INFO: 2e 30 2e 30 19 09 62 71 6e 6f 74 2d 68 61 73 68 544*91f16700Schasinglulu INFO: 2d 65 78 74 65 6e 64 65 64 19 09 61 44 ef be ad 545*91f16700Schasinglulu INFO: de 19 09 60 77 77 77 77 2e 74 72 75 73 74 65 64 546*91f16700Schasinglulu INFO: 66 69 72 6d 77 61 72 65 2e 6f 72 67 58 60 29 4e 547*91f16700Schasinglulu INFO: 4a d3 98 1e 3b 70 9f b6 66 ed 47 33 0e 99 f0 b1 548*91f16700Schasinglulu INFO: c3 f2 bc b2 1d b0 ae 90 0c c4 82 ff a2 6f ae 45 549*91f16700Schasinglulu INFO: f6 87 09 4a 09 21 77 ec 36 1c 53 b8 a7 9b 8e f7 550*91f16700Schasinglulu INFO: 27 eb 7a 09 da 6f fb bf cb fd b3 e5 e9 36 91 b1 551*91f16700Schasinglulu INFO: 92 13 c1 30 16 b4 5c 49 5e c0 c1 b9 01 5c 88 2c 552*91f16700Schasinglulu INFO: f8 2f 3e a4 a2 6d e4 9d 31 6a 06 f7 a7 73 553*91f16700Schasinglulu INFO: DELEGATED ATTEST TEST END 554*91f16700Schasinglulu 555*91f16700SchasingluluJSON format: 556*91f16700Schasinglulu 557*91f16700Schasinglulu.. code-block:: JSON 558*91f16700Schasinglulu 559*91f16700Schasinglulu { 560*91f16700Schasinglulu "CCA_PLATFORM_CHALLENGE": "b'0000000000000000000000000000000000000000000000000000000000000000'", 561*91f16700Schasinglulu "CCA_PLATFORM_INSTANCE_ID": "b'01CB8C79F7A00A6CCE1266F8644548420EC510BF84EE2218B98F1104C722319DFB'", 562*91f16700Schasinglulu "CCA_PLATFORM_IMPLEMENTATION_ID": "b'AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDD'", 563*91f16700Schasinglulu "CCA_PLATFORM_LIFECYCLE": "secured_3000", 564*91f16700Schasinglulu "CCA_PLATFORM_SW_COMPONENTS": [ 565*91f16700Schasinglulu { 566*91f16700Schasinglulu "SIGNER_ID": "b'BFE6D86F8826F4FF97FB96C4E6FBC4993E4619FC565DA26ADF34C329489ADC38'", 567*91f16700Schasinglulu "SW_COMPONENT_VERSION": "1.6.0+0", 568*91f16700Schasinglulu "SW_COMPONENT_TYPE": "RT_0", 569*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'9027F246AB31853646C4D7C660ED310D3CF014DEF06C240BDEB67A84FC3F5BB7'" 570*91f16700Schasinglulu }, 571*91f16700Schasinglulu { 572*91f16700Schasinglulu "SIGNER_ID": "b'B360CAF5C98C6B942A4882FA9D4823EFB166A9EF6A6E4AA37C1919ED1FCCC049'", 573*91f16700Schasinglulu "SW_COMPONENT_VERSION": "0.0.0+0", 574*91f16700Schasinglulu "SW_COMPONENT_TYPE": "RT_1", 575*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'521315D49DB2CF54E49937444068F0707D7364AEF70814B0F782ADC617DBA391'" 576*91f16700Schasinglulu }, 577*91f16700Schasinglulu { 578*91f16700Schasinglulu "SIGNER_ID": "b'BFE6D86F8826F4FF97FB96C4E6FBC4993E4619FC565DA26ADF34C329489ADC38'", 579*91f16700Schasinglulu "SW_COMPONENT_VERSION": "1.5.0+0", 580*91f16700Schasinglulu "SW_COMPONENT_TYPE": "RT_2", 581*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'8E5D647E6F6CC66FD44F54B606E5479ACC1BF37FCE873849C592D82F852E8542'" 582*91f16700Schasinglulu }, 583*91f16700Schasinglulu { 584*91f16700Schasinglulu "SIGNER_ID": "b'BFE6D86F8826F4FF97FB96C4E6FBC4993E4619FC565DA26ADF34C329489ADC38'", 585*91f16700Schasinglulu "SW_COMPONENT_VERSION": "1.5.0+0", 586*91f16700Schasinglulu "SW_COMPONENT_TYPE": "", 587*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'B80165A7788BC659428D331085D1490ADC9EC3EEDF851BD2F073736A0C0711B8'" 588*91f16700Schasinglulu }, 589*91f16700Schasinglulu { 590*91f16700Schasinglulu "SIGNER_ID": "b'b0f382091297d83a377a72471bec3273e99232e24959f65e8b4a4a46d8229ada'", 591*91f16700Schasinglulu "SW_COMPONENT_VERSION": "", 592*91f16700Schasinglulu "SW_COMPONENT_TYPE": "FW_CONFIG\u0000", 593*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'219EA01382E6D7975A1113A35F453968B1D9A3EA6AAB84233B8C06169820BAB9'" 594*91f16700Schasinglulu }, 595*91f16700Schasinglulu { 596*91f16700Schasinglulu "SIGNER_ID": "b'b0f382091297d83a377a72471bec3273e99232e24959f65e8b4a4a46d8229ada'", 597*91f16700Schasinglulu "SW_COMPONENT_VERSION": "", 598*91f16700Schasinglulu "SW_COMPONENT_TYPE": "TB_FW_CONFIG\u0000", 599*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'4139F6C2108453C517AE9AE5BEC1207BCC2424F39D20A8FBC7B310E3EEAF1B05'" 600*91f16700Schasinglulu }, 601*91f16700Schasinglulu { 602*91f16700Schasinglulu "SIGNER_ID": "b'b0f382091297d83a377a72471bec3273e99232e24959f65e8b4a4a46d8229ada'", 603*91f16700Schasinglulu "SW_COMPONENT_VERSION": "", 604*91f16700Schasinglulu "SW_COMPONENT_TYPE": "BL_2\u0000", 605*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'5C9620E1E33B0F2CEBC18E1A02A66586DD3497A74C9813BF7414452D302805C3'" 606*91f16700Schasinglulu }, 607*91f16700Schasinglulu { 608*91f16700Schasinglulu "SIGNER_ID": "b'b0f382091297d83a377a72471bec3273e99232e24959f65e8b4a4a46d8229ada'", 609*91f16700Schasinglulu "SW_COMPONENT_VERSION": "", 610*91f16700Schasinglulu "SW_COMPONENT_TYPE": "SECURE_RT_EL3\u0000", 611*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'F6FB6299A50CDFDB020B725B1C0B636E94EE6650563A299CCB38F0EC5999D42E'" 612*91f16700Schasinglulu }, 613*91f16700Schasinglulu { 614*91f16700Schasinglulu "SIGNER_ID": "b'b0f382091297d83a377a72471bec3273e99232e24959f65e8b4a4a46d8229ada'", 615*91f16700Schasinglulu "SW_COMPONENT_VERSION": "", 616*91f16700Schasinglulu "SW_COMPONENT_TYPE": "HW_CONFIG\u0000", 617*91f16700Schasinglulu "MEASUREMENT_VALUE": "b'985D87218406339DC31F91F5688DA05AF0D77E2051CE3BF2A5C3052E3C8B5231'" 618*91f16700Schasinglulu } 619*91f16700Schasinglulu ], 620*91f16700Schasinglulu "CCA_ATTESTATION_PROFILE": "http://arm.com/CCA-SSD/1.0.0", 621*91f16700Schasinglulu "CCA_PLATFORM_HASH_ALGO_ID": "not-hash-extended", 622*91f16700Schasinglulu "CCA_PLATFORM_CONFIG": "b'EFBEADDE'", 623*91f16700Schasinglulu "CCA_PLATFORM_VERIFICATION_SERVICE": "www.trustedfirmware.org" 624*91f16700Schasinglulu } 625*91f16700Schasinglulu 626*91f16700SchasingluluRSS OTP Assets Management 627*91f16700Schasinglulu------------------------- 628*91f16700Schasinglulu 629*91f16700SchasingluluRSS provides access for AP to assets in OTP, which include keys for image 630*91f16700Schasinglulusignature verification and non-volatile counters for anti-rollback protection. 631*91f16700Schasinglulu 632*91f16700SchasingluluNon-Volatile Counter API 633*91f16700Schasinglulu^^^^^^^^^^^^^^^^^^^^^^^^ 634*91f16700Schasinglulu 635*91f16700SchasingluluAP/RSS interface for retrieving and incrementing non-volatile counters API is 636*91f16700Schasingluluas follows. 637*91f16700Schasinglulu 638*91f16700SchasingluluDefined here: 639*91f16700Schasinglulu 640*91f16700Schasinglulu- ``include/lib/psa/rss_platform_api.h`` 641*91f16700Schasinglulu 642*91f16700Schasinglulu.. code-block:: c 643*91f16700Schasinglulu 644*91f16700Schasinglulu psa_status_t rss_platform_nv_counter_increment(uint32_t counter_id) 645*91f16700Schasinglulu 646*91f16700Schasinglulu psa_status_t rss_platform_nv_counter_read(uint32_t counter_id, 647*91f16700Schasinglulu uint32_t size, uint8_t *val) 648*91f16700Schasinglulu 649*91f16700SchasingluluThrough this service, we can read/increment any of the 3 non-volatile 650*91f16700Schasinglulucounters used on an Arm CCA platform: 651*91f16700Schasinglulu 652*91f16700Schasinglulu- ``Non-volatile counter for CCA firmware (BL2, BL31, RMM).`` 653*91f16700Schasinglulu- ``Non-volatile counter for secure firmware.`` 654*91f16700Schasinglulu- ``Non-volatile counter for non-secure firmware.`` 655*91f16700Schasinglulu 656*91f16700SchasingluluPublic Key API 657*91f16700Schasinglulu^^^^^^^^^^^^^^ 658*91f16700Schasinglulu 659*91f16700SchasingluluAP/RSS interface for reading the ROTPK is as follows. 660*91f16700Schasinglulu 661*91f16700SchasingluluDefined here: 662*91f16700Schasinglulu 663*91f16700Schasinglulu- ``include/lib/psa/rss_platform_api.h`` 664*91f16700Schasinglulu 665*91f16700Schasinglulu.. code-block:: c 666*91f16700Schasinglulu 667*91f16700Schasinglulu psa_status_t rss_platform_key_read(enum rss_key_id_builtin_t key, 668*91f16700Schasinglulu uint8_t *data, size_t data_size, size_t *data_length) 669*91f16700Schasinglulu 670*91f16700SchasingluluThrough this service, we can read any of the 3 ROTPKs used on an 671*91f16700SchasingluluArm CCA platform: 672*91f16700Schasinglulu 673*91f16700Schasinglulu- ``ROTPK for CCA firmware (BL2, BL31, RMM).`` 674*91f16700Schasinglulu- ``ROTPK for secure firmware.`` 675*91f16700Schasinglulu- ``ROTPK for non-secure firmware.`` 676*91f16700Schasinglulu 677*91f16700SchasingluluReferences 678*91f16700Schasinglulu---------- 679*91f16700Schasinglulu 680*91f16700Schasinglulu.. [1] https://tf-m-user-guide.trustedfirmware.org/platform/arm/rss/readme.html 681*91f16700Schasinglulu.. [2] https://tf-m-user-guide.trustedfirmware.org/platform/arm/rss/rss_comms.html 682*91f16700Schasinglulu.. [3] https://git.trustedfirmware.org/TF-M/tf-m-extras.git/tree/partitions/measured_boot/measured_boot_integration_guide.rst 683*91f16700Schasinglulu.. [4] https://git.trustedfirmware.org/TF-M/tf-m-extras.git/tree/partitions/delegated_attestation/delegated_attest_integration_guide.rst 684*91f16700Schasinglulu.. [5] https://tf-m-user-guide.trustedfirmware.org/platform/arm/rss/rss_key_management.html 685*91f16700Schasinglulu.. [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 686*91f16700Schasinglulu.. [7] https://developer.arm.com/documentation/DEN0096/A_a/?lang=en 687*91f16700Schasinglulu 688*91f16700Schasinglulu-------------- 689*91f16700Schasinglulu 690*91f16700Schasinglulu*Copyright (c) 2023, Arm Limited. All rights reserved.* 691