Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sival, keymgr] State-agnostic chip_sw_key_derivation_test #24755

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

andrea-caforio
Copy link
Contributor

keymgr_key_derivation_test_fpga_cw310_sival_rom_ext test was marked as broken in #21706. This commit fixes this and addresses #21500.

The source of the bug is due to the nature of the ROM_EXT that runs through a CDI attestation flow advancing the key manager state to "OwnerRootKey" in the process. This was not accounted for in the test, which assumed an active "CreatorRootKey" state (this works for sim_dv tests but not with ROM_EXT). The solution to this issue lies in rendering the test state-agnostic, meaning it will execute its verifications independently of the current key manager state. This approach thus mimics the keymgr_sideload_{aes,kmac,otbn} tests which follow a similar strategy.

@andrea-caforio andrea-caforio force-pushed the sival-key-derivation-test-bugfix branch 2 times, most recently from 68a488a to 7033770 Compare October 9, 2024 17:39
@andrea-caforio andrea-caforio marked this pull request as ready for review October 9, 2024 19:24
@andrea-caforio andrea-caforio requested a review from a team as a code owner October 9, 2024 19:24
@andrea-caforio andrea-caforio requested review from engdoreis and removed request for a team October 9, 2024 19:24
@andrea-caforio andrea-caforio self-assigned this Oct 9, 2024
@andrea-caforio andrea-caforio requested review from vogelpi and a team October 9, 2024 19:25
Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andrea-caforio for working on this! The PR looks good, except that I would factor out the removal of unneeded includes into a separate commit. The reason is that even if the test code changes would need reverting in the future, we would want to keep the unneeded includes removed.

But you don't need to do this right now, I think this can be included with potential feedback from the software team. It would be great to also get this approved by e.g. @engdoreis (OoO today) or maybe @jwnrt . I'll ask him.

sw/device/tests/keymgr_key_derivation_test.c Show resolved Hide resolved
Copy link
Contributor

@jwnrt jwnrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks @andrea-caforio

Most includes in sw/device/tests/keymgr_key_derivation_test.c are
superfluous. This commit removes them and updates the corresponding
Bazel build directive.

Signed-off-by: Andrea Caforio <andrea.caforio@lowrisc.org>
keymgr_key_derivation_test_fpga_cw310_sival_rom_ext test was marked as
broken in lowRISC#21706. This commit fixes this and addresses lowRISC#21500.

The source of the bug is due to the nature of the ROM_EXT that runs
through a CDI attestation flow advancing the key manager state to
"OwnerRootKey" in the process. This was not accounted for in the test,
which assumed an active "CreatorRootKey" state (this works for sim_dv
tests but not with ROM_EXT). The solution to this issue lies in
rendering the test state-agnostic, meaning it will execute its
verifications independently of the current key manager state. This
approach thus mimics the keymgr_sideload_{aes,kmac,otbn} tests which
follow a similar strategy.

Signed-off-by: Andrea Caforio <andrea.caforio@lowrisc.org>
@andrea-caforio
Copy link
Contributor Author

Thank you for your reviews @vogelpi and @jwnrt. I split the commit into two parts to make the removal of the unused includes explicit.

@jwnrt
Copy link
Contributor

jwnrt commented Oct 10, 2024

Thanks, I'll merge once CI has finished

@jwnrt jwnrt merged commit 913c56f into lowRISC:master Oct 10, 2024
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants