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