Skip to content

AES block functions are internal: no Api, contracts in Proof - #4873

Merged
alex merged 1 commit into
mainfrom
claude/vg-internal-specs
Nov 9, 2026
Merged

alex merged 1 commit into
mainfrom
claude/vg-internal-specs

Conversation

@alex

@alex alex commented Nov 9, 2026

Copy link
Copy Markdown
Member

Part of #4548. Rust never calls vg_aes_encrypt_blocks or vg_aes_decrypt_blocks. Only verified code calls them: the AES modes, CMAC and CCM. So they stop being public Apis, and the emitter writes them as internal functions of their callers.

What changes

Registrations (Artifacts/Aes/<Target>.lean, all six targets).

  • The encryptBlocksApi and decryptBlocksApi entries are removed; only expandKeyApi is left.
  • The imports only those entries used are removed.

Proofs.

  • Proof/Aes/Rounds.lean gets Proof.Aes.encryptBlocksContract and decryptBlocksContract, unchanged copies of the Spec.Aes ones.
  • encryptBlocks_keyed and decryptBlocks_keyed now conclude those copies.
  • So does Proof/AesEcb/Wipe.lean.

Generated crates. Regenerated:

  • The block functions' code moves to internal/vg_aes_{en,de}crypt_blocks*.rs (and assembly/internal/*.s).
  • Their dispatchers and public declarations are gone.
  • Their callers' code is unchanged, except that it now refers to the internal files.

CI data.

  • ci/residue_allowlist.txt loses the six x86_64 vg_aes_{en,de}crypt_blocks* lines. The emitter refuses them now that they name no public function, and the list only shrinks.
  • docs/algorithms/aes-ecb.toml lists the aes_ecb module, where ECB's code is. Its row used to pick up the block functions' VAES/AVX2 variants from aes, and now reads them from ECB's own variants. Its README cell is unchanged.
  • In the README table, the AES-CCM x86-64 cell now reads "AES-NI", not "AES-NI, VAES, AVX2". CCM has only an AES-NI variant; the VAES and AVX2 features came from the block functions in aes.

No Spec/ or TCB/ change. The follow-up Spec PR deletes Spec.Aes.encryptBlocksContract, decryptBlocksContract, encryptBlocksApi and decryptBlocksApi, and keeps blocksSig, which AES-ECB's contract uses.

Checks

  • Run locally before the rebase onto main:
    • lake build (all modules), Emit.lean, and Emit.lean --check after trimming the registration files' imports
    • the Static checks job's scripts
    • check_lean_public_imports.py on each edited module
    • cargo fmt --check, cargo clippy --all-targets -D warnings
    • cargo test with Wycheproof, and the AES tests with VG_CPU_FEATURES=none
  • The rebase onto main was clean; main changed only PPC64LE EC code.

Generated by Claude Code

Rust never calls vg_aes_encrypt_blocks or vg_aes_decrypt_blocks; only
verified code (ECB, CBC, CTR, XTS, OCB, CFB, OFB, GCM-SIV, CCM, CMAC) does.
Their registrations go, so the emitter writes them as internal functions
of their callers, and their contracts move to Proof/Aes/Rounds.lean
(copies of the Spec ones, which a follow-up Spec PR deletes).

The residue allowlist loses the six functions' lines, which name no
public function any more, and the AES-ECB row of the algorithms table
now reads its own module, aes_ecb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHFjAR7Byf513R4zuFy
@alex
alex enabled auto-merge November 9, 2026 22:15
@alex
alex added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 79ff93e Nov 9, 2026
45 checks passed
@alex
alex deleted the claude/vg-internal-specs branch November 9, 2026 22:26
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