Skip to content

feature/SP-5357, calc mrenclave with hashes#1

Merged
Villain88 merged 3 commits into
sp-mainfrom
feature/SP-5357
Jun 2, 2026
Merged

feature/SP-5357, calc mrenclave with hashes#1
Villain88 merged 3 commits into
sp-mainfrom
feature/SP-5357

Conversation

@Villain88

@Villain88 Villain88 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • New Features
    • Added new measurement calculation methods supporting direct precomputed hash inputs
    • Enables flexible launch digest computation workflows bypassing file-based input processing
    • Extends measurement capabilities for advanced operational scenarios

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 176633b9-2a5d-43db-a889-5ab126bca82d

📥 Commits

Reviewing files that changed from the base of the PR and between 8914fd3 and 8f08de1.

📒 Files selected for processing (2)
  • src/measurement/sev_hashes.rs
  • src/measurement/snp.rs

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

This PR adds precomputed hash support to SNP measurement calculations by exposing a public Sha256Hash type, implementing a raw-hash constructor in SevHashes, and introducing a new high-level snp_calc_launch_digest_with_hashes function that accepts kernel, initrd, and cmdline hashes directly rather than file paths.

Changes

Raw hash support for SNP measurement

Layer / File(s) Summary
Sha256Hash type and SevHashes raw constructor
src/measurement/sev_hashes.rs
Sha256Hash is exposed as a public type alias for 32-byte SHA-256 arrays, and SevHashes::new_raw constructor is added to build instances directly from precomputed hashes without file I/O or hashing operations.
SNP digest calculation with precomputed hashes
src/measurement/snp.rs
SnpMeasurementWithHashesArgs struct and snp_calc_launch_digest_with_hashes function are added to compute SNP launch digests from precomputed kernel, initrd, and cmdline hashes by delegating to the new SevHashes::new_raw constructor and following the standard Gctx measurement flow.

Sequence Diagram

sequenceDiagram
  participant Caller
  participant snp_calc_launch_digest_with_hashes
  participant SevHashes
  participant Gctx
  Caller->>snp_calc_launch_digest_with_hashes: SnpMeasurementWithHashesArgs (kernel_hash, initrd_hash, cmdline_hash)
  snp_calc_launch_digest_with_hashes->>Gctx: construct from OVMF hash or file
  snp_calc_launch_digest_with_hashes->>SevHashes: new_raw (precomputed hashes)
  SevHashes-->>snp_calc_launch_digest_with_hashes: SevHashes instance
  snp_calc_launch_digest_with_hashes->>Gctx: update metadata pages with hashes
  snp_calc_launch_digest_with_hashes->>Gctx: build VMSA pages
  snp_calc_launch_digest_with_hashes->>Gctx: finalize
  Gctx-->>snp_calc_launch_digest_with_hashes: SnpLaunchDigest
  snp_calc_launch_digest_with_hashes-->>Caller: SnpLaunchDigest result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 With hashes precomputed, no files to read,
The SEV and SNP now move with speed!
Raw constructors bloom, digests take flight,
A measured approach shining bright.
Hop along, the measurement's tight! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/SP-5357

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Villain88 Villain88 merged commit 730b0c9 into sp-main Jun 2, 2026
72 of 123 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.

1 participant