Skip to content

Add DPE ML-DSA support to Caliptra 2.0#3622

Merged
mhatrevi merged 1 commit into
chipsalliance:caliptra-2.0from
ArthurHeymans:fix-dpe-stack-overflow
Apr 30, 2026
Merged

Add DPE ML-DSA support to Caliptra 2.0#3622
mhatrevi merged 1 commit into
chipsalliance:caliptra-2.0from
ArthurHeymans:fix-dpe-stack-overflow

Conversation

@ArthurHeymans
Copy link
Copy Markdown
Contributor

@ArthurHeymans ArthurHeymans commented Apr 15, 2026

Squashed backport of:

DPE rev: a26db5b — last rev bumped by PRs in this list (#3371).

caliptra-2.0 adaptations:

  • DpeMldsaCrypto uses MldsaReg (2.0 has dedicated ML-DSA HW register;
    main uses AbrReg shared Adams Bridge register for ML-DSA and ML-KEM)
  • SignData::Mu returns CryptoError::NotImplemented (no external-mu on 2.0)
  • Removed ML-KEM commands (no ML-KEM HW on 2.0)
  • Removed main-only commands (ocp_lock, shake256)
  • Flat PersistentData paths (2.0 uses single struct, not rom/fw split)
  • Kept 2.0 caliptra-cfi-*-git package names to avoid ROM recompilation
  • STACK_SIZE=136KB (main uses 154KB; 2.0 has ~30KB more PersistentData)
  • RUNTIME_SIZE=176KB (main uses 210KB; 2.0 has fewer runtime features)

Additional fixes on top:

  • Fix stack overflow in initialize_dpe by using execute_serialized
  • Split InvokeDpe and CertifyKeyExtended into per-profile dispatch
  • Defer common response buffer allocation to reduce stack usage
  • Remove external AXI response support (unnecessary in 2.0)
  • Remove subsystem mailbox size limit handling (mailbox not smaller in 2.0)
  • Reduce MAX_HANDLES to preserve ROM layout
  • Derive DPE context thresholds from MAX_HANDLES
  • Fix tests for 32/64 context configurations

zhalvorsen
zhalvorsen previously approved these changes Apr 23, 2026
Comment thread runtime/src/invoke_dpe.rs Outdated
Comment thread runtime/src/certify_key_extended.rs Outdated
@ArthurHeymans ArthurHeymans marked this pull request as draft April 23, 2026 16:01
@parvathib parvathib force-pushed the fix-dpe-stack-overflow branch 2 times, most recently from 46643df to 2d84048 Compare April 29, 2026 22:06
@parvathib parvathib marked this pull request as ready for review April 29, 2026 22:07
Comment thread runtime/src/invoke_dpe.rs Outdated
@parvathib parvathib force-pushed the fix-dpe-stack-overflow branch from 6899806 to 04af3c1 Compare April 30, 2026 14:39
@parvathib parvathib changed the title Fix stack overflow in initialize_dpe by using execute_serialized Add DPE support to Caliptra 2.0 Apr 30, 2026
Squashed backport of:
- [dpe] Enable hybrid DPE feature (chipsalliance#3243)
- [dpe] Add ML-DSA DPE Crypto trait (chipsalliance#3315)
- [dpe] Add support for 64 DPE contexts (chipsalliance#3246)
- [dpe] Add ML-DSA DPE command (chipsalliance#3326)
- [dpe] Test ML-DSA CertifyKey (chipsalliance#3357)
- [dpe] Test using external mu with ML-DSA profile (chipsalliance#3371)
- [dpe] reduce nesting of InvokeDpeCmd::execute (chipsalliance#3386)
- [dpe] Add optional ML-DSA response over DMA (chipsalliance#3391)
- [dpe] Add HW model support for large DPE responses (chipsalliance#3403)
- [dpe] Support both DPE profiles in more tests (chipsalliance#3407)
- [dpe] Add a test for worst case scenario certs and CSRs (chipsalliance#3417)
- [dpe] Fail early for response sizing (chipsalliance#3415)
- [dpe] Add ML-DSA support to CertifyKeyExtended (chipsalliance#3426)
- [dpe] Test ML-DSA profile with golang verification (chipsalliance#3454)
- [dpe] Add comment that initialization is profile agnostic (chipsalliance#3460)

DPE rev: a26db5b — last rev bumped by PRs in this list (chipsalliance#3371).

caliptra-2.0 adaptations:
- DpeMldsaCrypto uses MldsaReg (2.0 has dedicated ML-DSA HW register;
  main uses AbrReg shared Adams Bridge register for ML-DSA and ML-KEM)
- SignData::Mu returns CryptoError::NotImplemented (no external-mu on 2.0)
- Removed ML-KEM commands (no ML-KEM HW on 2.0)
- Removed main-only commands (ocp_lock, shake256)
- Flat PersistentData paths (2.0 uses single struct, not rom/fw split)
- Kept 2.0 caliptra-cfi-*-git package names to avoid ROM recompilation
- STACK_SIZE=136KB (main uses 154KB; 2.0 has ~30KB more PersistentData)
- RUNTIME_SIZE=176KB (main uses 210KB; 2.0 has fewer runtime features)

Additional fixes on top:
- Fix stack overflow in initialize_dpe by using execute_serialized
- Split InvokeDpe and CertifyKeyExtended into per-profile dispatch
- Defer common response buffer allocation to reduce stack usage
- Remove external AXI response support (unnecessary in 2.0)
- Remove subsystem mailbox size limit handling (mailbox not smaller in 2.0)
- Reduce MAX_HANDLES to preserve ROM layout
- Derive DPE context thresholds from MAX_HANDLES
- Fix tests for 32/64 context configurations
@parvathib parvathib force-pushed the fix-dpe-stack-overflow branch from 04af3c1 to 5e317d7 Compare April 30, 2026 18:46
@parvathib parvathib changed the title Add DPE support to Caliptra 2.0 Add DPE ML-DSA support to Caliptra 2.0 Apr 30, 2026
@mhatrevi mhatrevi enabled auto-merge (squash) April 30, 2026 20:51
@mhatrevi mhatrevi merged commit 2e734c1 into chipsalliance:caliptra-2.0 Apr 30, 2026
14 checks passed
@mhatrevi mhatrevi deleted the fix-dpe-stack-overflow branch April 30, 2026 20:54
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.

4 participants