Skip to content

AArch64 vg_x25519_base: wipe only the 1024 bytes of scratch it writes - #2608

Merged
alex merged 1 commit into
mainfrom
claude/a64-x25519-base-written
Oct 17, 2026
Merged

alex merged 1 commit into
mainfrom
claude/a64-x25519-base-written

Conversation

@alex

@alex alex commented Oct 17, 2026

Copy link
Copy Markdown
Member

Part of #991. Stacked on #2606.

This is the first registration to use Artifact.written (#2568). On AArch64, vg_x25519_base writes only the first 1024 bytes of its 8 KiB scratch. Its artifact now says so with written := [("scratch", 1024)], and the emitter exports VG_X25519_BASE_SCRATCH_WRITTEN. x25519::base() then wipes just those bytes, where it used to wipe all 8 KiB. That saves about 80 ns of vg_zeroize per call on N2, about 1% of x25519_base.

Other targets still wipe the whole buffer.

Changes

  • Proof
    • x25519Base_correct (Proof/X25519/AArch64/Base/Main.lean) gains a ScratchTail conjunct: when out and scratch are disjoint, no byte of scratch at offset 1024..8191 changes.
    • It is proven from the Outside frames of the comb, the inversion and the final stores, through outside_tail.
    • Those frames' bounds in the base and comb engines are tightened from 7368 to 968. They are the bytes past the working area, which the proofs never used.
    • x25519Base_written (Base/Verified.lean) turns this into Sig.writtenWithin from the contract's precondition, using Exec.det.
  • Registration: written and writtenOk only; no tactics.
  • Rust: on aarch64, base() wipes VG_X25519_BASE_SCRATCH_WRITTEN bytes. Every other target keeps size_of::<[u64; 1024]>(). Each cfg arm runs on its own platform, so coverage is unchanged.

No changes to TCB/ or Spec/.

Testing

  • The touched modules and the X25519 artifact build. Emit.lean --check passes, with the audits.
  • check_lean_imports, check_lean_modules, check_registrations, check_lean_speed, check_variants, check_arch_gates and check_mcdt all pass.
  • cargo fmt --check and clippy pass on x86-64 and aarch64.
  • The X25519 Wycheproof and unit tests pass on x86-64, and on aarch64 under qemu.

Generated by Claude Code

Base automatically changed from claude/a64-25519-inv to main October 17, 2026 16:51
The comb's frame keeps the stack below 1024 bytes of scratch, so the
artifact states written := [("scratch", 1024)], proven from
x25519Base_correct's frame of the scratch's tail, and base() wipes only
VG_X25519_BASE_SCRATCH_WRITTEN bytes on AArch64 instead of 8 KiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ma2fA9rUTPXEEQjYyCMCRw
@alex
alex force-pushed the claude/a64-x25519-base-written branch from 05591f1 to 199e955 Compare October 17, 2026 16:53
@alex
alex added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit 5f3b389 Oct 17, 2026
34 checks passed
@alex
alex deleted the claude/a64-x25519-base-written branch October 17, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants