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

Add debug unlock procedures in rom #1851

Open
wants to merge 5 commits into
base: main-2.x
Choose a base branch
from
Open

Conversation

ArthurHeymans
Copy link
Contributor

@ArthurHeymans ArthurHeymans commented Dec 13, 2024

This implements the debug unlock flow for both manufactoring and production flows, according to "https://github.com/chipsalliance/caliptra-sw/blob/main-2.x/rom/dev/README.md"
This requires Sha512 ops so those are also added alongside Sha384.

TODO Production tests depend on DMA Axi rework #1878

@ArthurHeymans ArthurHeymans changed the base branch from main to main-2.x December 13, 2024 16:18
@ArthurHeymans ArthurHeymans added the Caliptra v2.0 Items to be considered for v2.0 Release label Dec 13, 2024
@ArthurHeymans ArthurHeymans force-pushed the DebugUnlock branch 2 times, most recently from 9c26ad0 to 048ef3d Compare December 17, 2024 17:26
@ArthurHeymans ArthurHeymans marked this pull request as ready for review December 17, 2024 17:26
@ArthurHeymans ArthurHeymans force-pushed the DebugUnlock branch 3 times, most recently from 967489e to e863077 Compare December 19, 2024 14:11
@ArthurHeymans
Copy link
Contributor Author

I left writing the unit test for production for some later time. I understood the emulator for the Dma engine wrong (it does not operate on the root bus) and it needs to have a completely separate 64bit bus for AXI.

runtime/src/dpe_crypto.rs Outdated Show resolved Hide resolved
}

/// Trait for SHA-2 digest operations
pub trait Sha2DigestOpTrait<'a, V: Sha2Variant>: Sized {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% sure why we need this trait. Why not implement this method directly on the generic struct, and not have to boomerang back and forth through the OpTrait and the Op?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update and finalize are very similar. Using a trait with generics reduced the amount of code a bit.

drivers/src/soc_ifc.rs Outdated Show resolved Hide resolved
rom/dev/src/flow/debug_unlock.rs Outdated Show resolved Hide resolved
rom/dev/src/flow/debug_unlock.rs Outdated Show resolved Hide resolved
}
}

fn handle_manufactoring(env: &mut RomEnv) -> CaliptraResult<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: handle_manufacturing

rom/dev/src/flow/debug_unlock.rs Outdated Show resolved Hide resolved
rom/dev/src/flow/debug_unlock.rs Outdated Show resolved Hide resolved
digest_op.finalize(&mut request_digest)?;

// Verify that digest of keys match
if cfi_launder(request_digest) != fuse_digest {
Copy link
Contributor

Choose a reason for hiding this comment

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

It may not be strictly necessary to use constant-time equality for this digest, but I'd like to anyway.

@jhand2
Copy link
Collaborator

jhand2 commented Jan 6, 2025

Please add PR description always

@ArthurHeymans
Copy link
Contributor Author

Please add PR description always

Done

Reading the production debug fuses needs this.

Signed-off-by: Arthur Heymans <[email protected]>
Signed-off-by: Arthur Heymans <[email protected]>
This adds both the manufactoring and production debug unlock codepaths.

There are a few details that need to be resolved in TODOs that are
unclear from the documentation.

Signed-off-by: Arthur Heymans <[email protected]>
Signed-off-by: Arthur Heymans <[email protected]>
@mhatrevi mhatrevi changed the title Add debug unlock procudes in rom Add debug unlock procdures in rom Jan 8, 2025
@mhatrevi mhatrevi changed the title Add debug unlock procdures in rom Add debug unlock procedures in rom Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Caliptra v2.0 Items to be considered for v2.0 Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants