Repository navigation
Conversation
…tions for KEMScheme Key-privacy (recipient-anonymity) notions for KEMScheme, mirroring the existing IND-CPA/IND-CCA architecture in KeyEncapMech.lean: adversary structure, hidden-bit games over OracleComp, advantage as Measure.boolBias of runtime.evalDist, dual-key decapsulation oracle union with per-branch challenge masking, and the oracle-ignoring CPA-to-CCA embedding with its game-equality theorem. Follows up on Verified-zkEVM#848; naming per Verified-zkEVM#801. Co-authored-by: Skas <108791624+Skanislav@users.noreply.github.com>
🤖 PR SummaryOverview written in Markdown as requested, with no meta prefaces. Statistics
Lean Declarations ✏️ Added: 14 declaration(s)
📋 **Additional Analysis**Findings on
|
- Name the CPA adversary `ANO_CPA_Adversary`, so the notion has one token in every name (docs/agents/crypto.md, Naming). - Prove the CPA-to-CCA lift lemmas from the generic `QueryImpl.simulateQ_add_simulateQ_toQueryImpl_left`. This removes `KEMScheme.simulateQ_add_liftM_left`, which shadowed the root `QueryImpl.simulateQ_add_liftM_left` with a different statement, and its unused instance `simulateQ_toANO_CCA`. - State the notion in the module docstring and cite Bellare, Boldyreva, Desai and Pointcheval. - Import only `KeyEncapMech`, which re-exports the other modules; drop the unused universe; prove the advantage equations by `rfl`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dtumad
left a comment
There was a problem hiding this comment.
Thanks! This is VCVio's first anonymity notion, and it fits the KeyEncapMech games closely. Before the challenge, the decapsulation oracle answers freely under either key. Afterwards it refuses the challenge ciphertext under both keys, as in the IK-CCA game of Bellare–Boldyreva–Desai–Pointcheval. The bit is drawn after preChallenge, as in IND_CCA_Game. The CPA-to-CCA equality names its embedding, and the typeclass arguments are only what is used.
I pushed one commit with mechanical cleanups, plus a merge of current main so CI runs against the new PolyFun pin:
ANO_Adversaryis nowANO_CPA_Adversary, so the notion has one token in every name (docs/agents/crypto.md, Naming).- The lift lemmas now come from the generic
QueryImpl.simulateQ_add_simulateQ_toQueryImpl_left. This removesKEMScheme.simulateQ_add_liftM_left, which shadowed the rootQueryImpl.simulateQ_add_liftM_left(a different statement), and the unusedsimulateQ_toANO_CCA. - The module docstring now states the notion and cites Bellare–Boldyreva–Desai–Pointcheval. The imports are just
KeyEncapMech, which re-exports the rest. The unused universe is gone, and the advantage equations are proved byrfl.
One design question before merging. Here the adversary sees only the challenge ciphertext, never the encapsulated key. As I read Grubbs–Maram–Paterson (EUROCRYPT 2022), whose KEM-DEM result is what makes KEM anonymity useful for hybrid encryption, their KEM ANO-CCA game gives the adversary the whole encapsulation (c*, K*). The ciphertext-only game is weaker on its own: it follows from the key-revealing one, but the converse also needs IND-CCA. Would you be up for passing K* to postChallenge to match that definition? If the ciphertext-only form is what you need for the stealth-address application, keeping it is fine too. In that case it would help to say so in the names or the docstring, and to cite which definition it follows, so that a later "ML-KEM is ANO-CCA" statement means what readers expect.
Optional, and fine as a follow-up: a small test showing the game is not vacuous, for example a KEM that appends a public-key tag to its ciphertext having ANO-CPA advantage 1.
Summary
Adds key-privacy (recipient-anonymity) notions for
KEMSchemein a newVCVio/CryptoFoundations/KeyEncapMech/ANO.lean, mirroring the existingIND-CPA/IND-CCA architecture in
KeyEncapMech.lean: an adversary structure,hidden-bit games over
OracleComp, advantage asMeasure.boolBiasofruntime.evalDist, a dual-key decapsulation oracle unionspec + ((Bool × C) →ₒ Option K)answered throughQueryImpl.addwithspec.passthrough, the challenge ciphertext excluded per branch, and aCPA-to-CCA embedding with the corresponding game-equality theorem.
IND-CCA protects the encapsulated shared key; recipient anonymity hides which
public key a ciphertext was encapsulated under. They are independent:
registered public keys and announcements are public, so IND-CCA alone does not
give recipient privacy. This matters wherever ciphertexts are publicly
scanable, e.g. post-quantum stealth-address protocols (ERC-8441), whose draft
assumes ML-KEM provides both properties as separate claims.
Follows up on #848 (tempcheck; no objections were raised). Naming follows
#801's settled conventions; composition with the FO work remains #785's orbit
and is not touched here. No Mathlib, core, or Batteries lemma or idiom is being
replaced, so no
docs/reading/upstream-alignment.mdrow applies.The change is one new file plus the umbrella line
public import VCVio.CryptoFoundations.KeyEncapMech.ANOinVCVio.lean(alphabetically directly after
KeyEncapMech). No existing declaration ismodified.
Contents:
ANO_Adversary— two-phase ciphertext-only anonymity adversaryANO_CPA_Experiment(fixed branch),ANO_CPA_Game(hidden bit, returnsb == b'),ANO_CPA_Advantage(boolBiasof the single game'sevalDist,as for
IND_CPA_Advantage), plusANO_CPA_Advantage_eq_game_biasANO_CCA_oracleSpec = spec + ((Bool × C) →ₒ Option K)with pre/post-challengehandlers: real decapsulation under the queried key; the challenge ciphertext
is rejected by both post-challenge oracles
ANO_CCA_Adversary,ANO_CCA_Game,ANO_CCA_Advantage— both decapsulationoracles stay live throughout, plus
ANO_CCA_Advantage_eq_game_biasANO_Adversary.toANO_CCA(anonymity analogue oftoIND_CCA), the general collapse lemmasimulateQ_add_liftM_left, the phaselemmas
toANO_CCA_preChallenge/toANO_CCA_postChallenge, andANO_CPA_Game_eq_ANO_CCA_Game_toANO_CCA(mirroringIND_CPA_Game_eq_IND_CCA_Game_toIND_CCA)Design decisions:
never the encapsulated key. Tempcheck of KEM ANO-CCA game for ERC-8441 (pq-sap) verification? #848 also sketched a key-revealing variant; it is
deliberately left out so this PR carries one self-contained notion — the
key-revealing variant plus the implication theorem would be a natural
follow-up if wanted.
bc.2 = cStar → none; failure semantics of the KEM are preserved for everynon-challenge ciphertext.
boolBiasof thesingle game's
evalDist, with totality noted in the docstrings.KEMScheme; no ERC-specific definitions, no ML-KEM claims.Verification
Run against head
31c07870on basef1e63c78, with the toolchain the branchpins (Lean/Mathlib
v4.36.0):lake env lean VCVio/CryptoFoundations/KeyEncapMech/ANO.lean→ exit 0, noerrors, no warnings, no
sorry.#print axiomsonANO_CPA_Game_eq_ANO_CCA_Game_toANO_CCA,ANO_CCA_Advantage_eq_game_bias,toANO_CCA_preChallenge, andsimulateQ_add_liftM_left→propext,Classical.choice,Quot.soundonly;no
sorryAx.lake build VCVio→ Build completed successfully (9457 jobs).lake exe axiomsweep --check→ passed: 32478 declarations across 1336modules, 0
sorryAx-tainted, 0 non-standard-axiom-tainted.lake lint -- --style-only→ passes across all 1741 sources.scripts/check-extern-isolation.sh→ OK;scripts/check-interop-isolation.sh→ OK;
scripts/check-comment-fences.py→ OK (1768 sources);scripts/check-expose-boundary.sh→ OK.lake exe mk_all --lib VCVio --module --check→ "No update necessary", so theumbrella line for the new module is already in its generated position.
test-agent-docs.py,check-agent-docs.py,extract-doc-fragments.py --check, andcheck-doc-names.py.has a declaration docstring.
Checklist
CONTRIBUTING.md, AttributionAnd File Headers); docstrings are intrinsic, with no change history or "renamed from" wording.
public sectionwith per-declaration@[expose](Module Scopes), andthe expose-boundary baseline was lowered in this PR if a file was converted.
./scripts/update-lib.shleaves the umbrella files unchanged, andlake exe axiomsweep --checkpasses: nosorryand no non-standard axiom.(
mk_all --checkreports "No update necessary" for the new module's umbrella line;the sweep passed with 0
sorryAx-tainted and 0 non-standard-axiom-tainted declarationsacross 32478 declarations in 1336 modules.)
set_option linter.* false, no deprecated aliases (docs/agents/gotchas.md§18, §23),and no native FFI test executables on the PR path.
uv run --no-project --python 3.12 python scripts/check-agent-docs.pypasses.
VCVioTest/gained one-callentries, no proof gained a second tactic call outside a dated gap pair, and the before/after
line counts of the touched proofs are listed above.