Skip to content

Backport SPDM/DPE certificate retrieval and AES-GCM fixes to caliptra-2.0#3851

Merged
swenson merged 5 commits into
chipsalliance:caliptra-2.0from
parvathib:cherry-pick-certify-key-chunks-3765-v2
Jun 12, 2026
Merged

Backport SPDM/DPE certificate retrieval and AES-GCM fixes to caliptra-2.0#3851
swenson merged 5 commits into
chipsalliance:caliptra-2.0from
parvathib:cherry-pick-certify-key-chunks-3765-v2

Conversation

@parvathib

@parvathib parvathib commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport SPDM/DPE certificate retrieval and AES-GCM fixes to caliptra-2.0.

This includes:

  • Add CERTIFY_KEY_CHUNKS for chunked DPE certificate retrieval.
  • Add PL0-only enforcement for X.509 requests through CERTIFY_KEY_CHUNKS.
  • Backport AES-GCM/SPDM mailbox cleanup.
  • Fix AES-GCM streaming GHASH save/restore handling.

zhalvorsen
zhalvorsen previously approved these changes Jun 11, 2026
Comment thread runtime/src/certify_key_chunks.rs
@parvathib
parvathib force-pushed the cherry-pick-certify-key-chunks-3765-v2 branch from 8c0e15f to fe1609f Compare June 11, 2026 21:05
@parvathib parvathib changed the title Cherry pick certify key chunks 3765 v2 Backport SPDM/DPE certificate retrieval and AES-GCM fixes to caliptra-2.0 Jun 11, 2026
@parvathib
parvathib marked this pull request as ready for review June 11, 2026 21:10

@swenson swenson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@swenson
swenson enabled auto-merge (rebase) June 11, 2026 23:00
zhalvorsen and others added 5 commits June 12, 2026 02:21
The old CertifyKey flow returns the complete DPE leaf certificate in a
single response, requiring the MCU SPDM responder to allocate a
relatively large buffer to hold it.

This adds a chunked retrieval mechanism which reduces memory pressure
while enabling more scalable certificate handling (e.g., for MLDSA and
number of contexts) and improving overall efficiency.

(cherry picked from commit 6430137)
…#3365)

There was some duplicate code in the AES GCM and SPDM cryptographic
mailbox commands that this consolidates a little to save space.

This also fixes a bug I noticed where the "reserved" space in the AES
GCM (non-SPDM) flags were being interpreted as the SPDM flags (i.e.,
version), which would trigger us to try to derived a key using HMAC.
I think this was left over from the initial implementation of AES SPDM
commands, but was never documented as being supported, so I just removed
that behavior.

(cherry picked from commit e2ef42a)
…3790)

The GHASH accumulator was incorrectly discarded on the first streaming
update call when no AAD had been provided, causing the final tag to omit
the authentication contribution of the first batch of data. Always save
the GHASH state after processing blocks in aes_256_gcm_update.

A second, complementary bug existed on the restore side: when no AAD
was provided and no full block of plaintext had been buffered yet, the
driver still issued a GcmPhase::Restore writing a zero GHASH state into
the hardware. This corrupts subsequent tag computation. Skip the
restore in that case: there is nothing to restore until the driver has
either ingested AAD or processed a full hardware block.

Update the sw-emulator AES peripheral to model the same hardware
behaviour: invoking GcmPhase::Restore with an all-zero GHASH state
poisons the accumulator with a deterministic non-zero value, so drivers
which improperly issue Restore in this state fail tag verification in
emulator-based tests.

Adds integration tests covering streaming AES-GCM with empty AAD across
a range of plaintext sizes and chunk splits.

(cherry picked from commit e5ced90)
…eq` (chipsalliance#3841)

This is blocked by `InvokeDpe`, but was missed while creating this
command. This adds the check here as well. It also adds a test to make
sure it is blocked from PL1 correctly.

(cherry picked from commit 0bc3c81)
@parvathib
parvathib force-pushed the cherry-pick-certify-key-chunks-3765-v2 branch from 8ffb8fa to 11488f9 Compare June 12, 2026 02:22
@swenson
swenson merged commit cda85a6 into chipsalliance:caliptra-2.0 Jun 12, 2026
17 of 18 checks passed
@parvathib
parvathib deleted the cherry-pick-certify-key-chunks-3765-v2 branch June 12, 2026 17:53
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