Repository navigation
AArch64: AES-GCM's powers of H from the key context, verified (vg_aes_gcm_store_powers_aes) - #4338
Merged
Merged
Conversation
…rified Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFkei8WwGgosqeREs4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #4139 (finding 5: AES-GCM on AArch64: the powers of H)
This implements
vg_aes_gcm_store_powers(spec #4317) on AArch64 and deletes the Rust that did its work. There are noSpec/or TCB changes.Before
AesGcm::store_powers(src/aead/aes_gcm.rs) read the hash subkey out of the key context at a fixed offset (self.key()[30..]). It then calledvg_ghash_store_powers_aes(h, &mut y, h, 0, scratch, &mut self.powers)over zero blocks, with a dummyyand a scratch buffer, only to get the powers. The_with_powersseal/open functions require those powers for their key context, and that held only because the Rust's offset arithmetic was right.After
Impl/Gcm/AArch64/Pmull.lean: a newkeyPowers,vg_aes_gcm_store_powers_aes(ctx, pw). It is straight-line and built from the existing PMULL pieces ofvg_ghash_store_powers_aes:ctxH);twistit into H';powersS;pwatpwOff.Proof/Gcm/AArch64/Pmull/Ghash.lean:keyPowers_verified, againstSpec.Gcm.storePowersContract, including constant time (taint_decide). It followsghashS's proof, with a smaller invariantKPfor the powers, since no GHASH state is involved.Ghash.leanrather than a new module: a new module importingPmull/Ghashwould be the 41st importer ofProof/Gcm/Poly.lean's algebra (check_lean_speed.py's limit is 40).Artifacts/Gcm/AArch64.lean: registers it with suffix_aesand features["aes"]. Every AArch64 backend with_with_powersinstances has those features; the backend feature test now checksVG_AES_GCM_STORE_POWERS_AES_FEATURESinstead ofVG_GHASH_STORE_POWERS_AES_FEATURES.store_powersis now a single call,vg_aes_gcm_store_powers_aes(ctx, &mut self.powers). The offset read of H, the zero-block GHASH call, the dummyy, the scratch buffer and theSCRATCH_WRITTENassertion are deleted.vg_ghash_store_powers_aesstays, because the verified*_store_powersseal/open still call it.vg_aes_gcm_prepare*)._with_powerspath.The only generated change is the new function in
crates/verified-garbage-asm-aarch64/{src,assembly}/gcm.*.Checks
Lean:
lake buildofArtifacts.Gcm.AArch64and every module that importsPmull/Ghash(theGenericAES-GCM, AES-GCM-SIV and SM4-GCM AArch64 files); no warnings.Emit.lean.EmitOne --check Gcm.AArch64.check_lean_public_imports.pyon the edited modules.Rust:
cargo fmt --check.cargo clippy --target aarch64-unknown-linux-gnu --all-targets -D warnings.VG_CPU_FEATURESunset,none,aesandaes,sha3.Benchmark: a scoped manual run on AArch64 (
aes_gcm, default features andaes, against Spec: vg_aes_gcm_store_powers, GCM's eight powers of H from a key context #4317's merge commit): https://github.com/pyca/verified-garbage/actions/runs/42256280331. The change only affects key setup (AesGcm::new), and its speed is unchanged:aesaes-128-gcm-new/16aes-256-gcm-new/32Seal and open moved by at most 0.4%.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHFkei8WwGgosqeREs4