rse.rst 38 KB

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