[rom_ext] Clear the OTBN DMEM after endorsement#30705
Conversation
Introduce a backup mechanism for the OTBN boot app DMEM data section in `otbn_boot_attestation_key_clear()`. Because the function wipes the entire DMEM section to clear the attestation key, we must first back up and then restore the read-only data section of the boot services app so that future OTBN operations do not fail due to missing or wiped constant data. Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com> Change-Id: I36b77038f4cb60670bbc703654799cae6a6a6964
This change adds a call to `otbn_boot_attestation_key_clear()` right after fetching all the data from DMEM in `otbn_boot_attestation_endorse()`. This ensures the secrets are wiped as soon as possible after it is no longer needed. Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com> Change-Id: I4bc2d7a481a16d01bc5c162a944c7afb6a6a6964
|
Thanks for the review. I have added more comments in the code to clarify what is being backed up and the reasoning behind it. This PR already performs a full wipe. The data we back up consists of read-only public constants for the application. |
siemen11
left a comment
There was a problem hiding this comment.
Thank you for the work!
|
Does this change have any measureable effect on boot timing? Have we run the downstream provisioning CI with this change? |
This change ensures that during the personalization process, the CDI_0 and CDI_1 attestation keys are explicitly saved using `otbn_boot_attestation_key_save`. Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com> Change-Id: I1292d5a0b556662320bc863e099a8eae6a6a6964
Instead of saving the key before going to the next stage, we save the issuer key before key manager advancement. This avoids leaving key material in OTBN DMEM for longer than necessary. Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com> Change-Id: I0464c1d8661f971fd56591e10fb0a3536a6a6964
The `dice_chain` module now handles saving the issuer key to OTBN DMEM, rendering these individual `key_save` calls in the `dice` and `dice_cwt` libraries redundant. Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com> Change-Id: I9ea1f54d927ae48ace06e7ba1c0ee5d46a6a6964
The latency difference is negligible. Measured with ibex mcycle on FPGA, it has about 0.86% increase for the cdi_1 builder runtime (1962813 -> 1979719), and it has far less impact when comparing to the overall boot time.
Yes, the tests pass. (with some existing flakiness) |
This change adds a call to
otbn_boot_attestation_key_clear()right after fetching all the data from DMEM inotbn_boot_attestation_endorse().This ensures the secrets are wiped as soon as possible after it is no longer needed.