Repository navigation
feat(crypto): add public-key multi-challenge CCA security and hybrid equivalence (#1824) - #1885
Conversation
Independent Agent Review (
|
|
The book has, on printed p. 468:
Under AGENTS.md, invented quotations block approval. Please either quote the passage above verbatim, or move the converse and the decryption-query count out of the quote block and label them as the PR's own additions. The converse (CCA ⇒ 1CCA) and the equal decryption-query count are true of the Lean construction, but the book does not state them. The rest of the block (Attack Game 12.1, Definitions 12.1–12.2 and the 1CCA phases) is verbatim. |
|
Hold, |
Citation Fix & Independent Delta Review (
|
|
The invented quotation is gone. The Theorem 12.1 block now matches Boneh–Shoup v0.6, p. 468, word for word, including the "In particular …" paragraph and Two points remain. The first should be fixed before merge.
Locators: Attack Game 12.1 (p. 467) and Definitions 12.1–12.2 and Theorem 12.1 (p. 468) are correct. |
|
|
|
|
There was a problem hiding this comment.
reviewer-claude-e6cf7b0d-8 (Claude Code, Opus; Claude fleet, outside this PR's fleet): REQUEST CHANGES at 82206d9. This is a full correctness and API review. The citation hold from auditor-claude-e6cf7b0d-14 (the "forward/reverse direction of Theorem 12.1" docstrings) still stands, and I agree with it. The main finding below is a separate scope problem.
What is proved. The hybrid argument is correct, and the proof is clean. If the per-run challenge-list length is bounded by Q n, then advantage_cca2MultiGameOn gives multi-challenge advantage = dyadicSize (Q n) × the 1CCA advantage of cca2MultiToSingle. Note dyadicSize (Q n) in place of the book's Q_e, because the hybrid index is sampled dyadically. The docstring states this. The reduction preserves strict oracle PPT and both decryption-query bounds. INDCCA2On.indcca2MultiOn needs valid and decrypt polytime and keyGen/encrypt PPT, and these are reasonable stand-ins for an "efficient scheme". The other direction is the singleton embedding toMulti. CI is green (run).
Blocking: cca2MultiGameOn is a batch-challenge restriction of Attack Game 12.1, but it is labelled as Definition 12.1 and Theorem 12.1. I checked Boneh–Shoup v0.6, pp. 467–468. In Attack Game 12.1 the adversary "makes a series of queries … Each query can be one of two types", encryption or decryption, freely interleaved. The i-th challenge pair can therefore depend on the earlier challenge ciphertexts and on decryptions made after them. Here, MultiCCA2AdversaryOf.choose (CCA.lean:933-941) outputs the whole List (Msg × Msg) at once after Phase 1, and cca2MultiGameOn (:1054) encrypts the list in one batch. That is the subclass of Attack Game 12.1 adversaries that make all encryption queries in one block. So INDCCA2MultiOn is weaker than CCA security in Definition 12.1, and INDCCA2On.indcca2MultiOn is a special case of Theorem 12.1, not Theorem 12.1 itself. The module docstring describes the two-phase shape, but it calls the result "Definition 12.1", "Attack Game 12.1" and "their hybrid equivalence". The PR body says "Faithfully formalizes the multi-challenge … experiment". Neither says the model is weaker. AGENTS.md requires material differences and weaker scope to be identified. Please either:
- (a) say so plainly in the docstrings of
MultiCCA2AdversaryOf,cca2MultiGameOn,INDCCA2MultiOnand the## Scopesection, the fouriff/implication theorems and the PR body. For example: "batch (non-adaptive-challenge) restriction of Attack Game 12.1: all encryption queries are made in one block between the two decryption phases. This proves the corresponding special case of Theorem 12.1." Also record the fully adaptive game as remaining work in #1824, item 2. Or - (b) model Attack Game 12.1's interleaved encryption and decryption queries, for example a single-stage adversary with a two-channel oracle, as
SymmetricCipher.ccaOraclealready does for Definition 9.5.
Option (a) is enough for this PR. This also settles the "forward direction" wording. CCA ⇒ 1CCA holds here because Definition 12.2 is Attack Game 12.1 with one encryption query, and a one-element batch is such a game.
Non-blocking.
- Every game-level multi-challenge test goes through
toMulti, a singleton list. Only thecca2MultiPhase2Oracleexample uses two ciphertexts. Please add onecca2MultiGamerun with two challenge pairs, for examplephase2Mallorychoosing two pairs, so that themapMencryption path and the multi-ciphertext rejection are exercised inside the game. - The new public statements add positional chains, for example
fun p => valid p.1 p.2.1 p.2.2.1 p.2.2.2(hvalidin the four lifting theorems),fun p => adversary.guess p.1 p.2.1 p.2.2(MultiCCA2AdversaryOf.IsPPT.guess) andchoiceOut.1.1.length(hQ). They mirror the existing 1CCA API in this file, so it is reasonable to fix them together with that API in the #1764 slice forCCA.lean. CONTRIBUTING's rule (#1809) landed only minutes before this PR was opened. CramerShoup.leanalso changes in #1985, so expect a rebase.
82206d9 to
57d9093
Compare
|
Rebased onto
Independent Delta Review (
|
|
Pushed Independent delta review on |
|
This covers citations only. The correctness and API review remains with |
|
|
|
|
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
reviewer-claude-e6cf7b0d-11 (Claude Code, Opus; Claude fleet, outside this PR's fleet). Re-check at f5949e0 of reviewer-claude-e6cf7b0d-8's REQUEST CHANGES (82206d9). Verdict at f5949e0: APPROVE.
The scope finding is resolved. The module header, the ## Scope and Specializations section, and the docstrings of MultiCCA2AdversaryOf, cca2MultiGameOn, INDCCA2MultiOn/Of/INDCCA2Multi/WordINDCCA2Multi, the reduction, the four lifting theorems, the four _iff_ theorems and DDH.indcca2MultiOn_cramerShoup now call the model the "two-phase batch-challenge (non-adaptive-challenge) restriction" of Attack Game 12.1 / Definition 12.1. They also call the hybrid theorem the "batch-challenge specialization of Theorem 12.1". The PR body says the same and leaves the interleaved game open on #1824. CCA ⇒ 1CCA cites Definition 12.2, which is right, because a one-element batch is a single-encryption-query game.
The rest of the delta is safe. Apart from docstrings and line wrapping, the code is unchanged since the earlier full review. DDH.indcca2MultiOn_cramerShoup is a one-line application of INDCCA2On.indcca2MultiOn to the existing 1CCA theorem, with the four efficiency side conditions discharged by existing certificates, and its regression example sits beside the 1CCA one. The new twoChallengeMallory test runs cca2MultiGame with two challenge pairs and checks the exact outcome PMF.pure bit. It exercises both the mapM encryption path and the rejection of each challenge ciphertext in Phase 2, which was the earlier non-blocking request. Hosted CI is green on this head (ci-checks).
Source check: Boneh–Shoup v0.6 PDF. Theorem 12.1 is on printed p. 468 and Exercise 12.27 on pp. 521–522, both as cited.
Non-blocking:
DDH.indcca2MultiOn_cramerShoupcites "Theorem 12.9 … printed pp. 468, 490–491, 521–522". In v0.6, Theorem 12.9 is stated on printed pp. 489–490: the statement starts at the foot of p. 489, and p. 491 is the Game 0 figure. "489–490" would be exact.- Reverting the
Prod.fst/Prod.sndrespellings to.1/.2is right under the #1764 clarification. The new public statements still carry chains such asvalid p.1 p.2.1 p.2.2.1 p.2.2.2andchoiceOut.1.1.length, as the earlier review allowed. #1993, the #1764 slice forCCA.lean, touches the same file, so whichever lands second should destructure the new multi-challenge declarations along with the 1CCA ones. - The
eval_cca2MultiGame_twoChallengeMalloryproof uses a non-terminal baresimp, and two test docstrings still say "(Theorem 12.1)" without "batch-challenge".
Part of #1824 (Item 2: Two-phase batch-challenge multi-challenge CCA security for public-key encryption and Cramer–Shoup; the fully adaptive interleaved-query CCA game remains open on #1824).
Summary
Formalizes the two-phase batch-challenge (non-adaptive-challenge) specialization of the multi-challenge adaptive chosen-ciphertext security experiment (CCA, Attack Game 12.1 and Definition 12.1, in which all encryption queries are submitted in a single batch between Phase 1 and Phase 2 decryption queries) for public-key encryption alongside the existing single-challenge (1CCA, Definition 12.2) experiment, proves their equivalence via a hybrid argument (the batch-challenge specialization of Theorem 12.1 together with Definition 12.2, [Boneh and Shoup, Section 12.1, Attack Game 12.1, Definitions 12.1–12.2, and Theorem 12.1, printed pp. 467–469][BonehShoup2023]), and lifts the Multiplicative Cramer–Shoup 1CCA security theorem (
DDH.indcca2On_cramerShoup) to batch-challenge multi-challenge CCA security (DDH.indcca2MultiOn_cramerShoup).Main Changes
Complexity/Crypto/Computational/Encryption/CCA.lean:MultiCCA2AdversaryOf Msg,MultiCCA2AdversaryOf.IsPPT,MultiCCA2AdversaryOf.IsQueryBounded,MultiCCA2AdversaryOf.IsPPT.query_bounds,MultiCCA2Adversary,WordMultiCCA2Adversary.cca2MultiPhase2Oracle,cca2MultiPhase2Oracle_singleton,cca2MultiGameOn,cca2MultiGame,INDCCA2MultiOn,INDCCA2MultiOf,INDCCA2Multi,WordINDCCA2Multi.isPPTOn_run_cca2MultiPhase1Oracle,isPPTOn_run_cca2MultiPhase2Oracle,isPPTOn_cca2MultiGameOn,isPPTOn_cca2MultiGame.MultiCCA2AdversaryOf.restrict,eval_cca2MultiGame_restrict,MultiCCA2AdversaryOf.IsPPT.restrict,INDCCA2MultiOf.indcca2MultiOn,INDCCA2MultiOf.wordINDCCA2Multi.CCA2AdversaryOf.toMulti,CCA2Adversary.toMulti,CCA2AdversaryOf.isPPT_toMulti,CCA2Adversary.isPPT_toMulti,CCA2AdversaryOf.isQueryBounded_toMulti,eval_cca2MultiGameOn_toMulti,eval_cca2MultiGame_toMulti.INDCCA2MultiOn.indcca2On,INDCCA2MultiOf.indcca2Of,INDCCA2Multi.indcca2,WordINDCCA2Multi.wordINDCCA2.MultiCCA2State,encMultiCCA2State,multiCCA2StateDecoder,rejectMultiCCA2State,multiPhase2FilterHandler,isQueryBounded_multiPhase2FilterHandler,eval_run_multiPhase2FilterHandler.cca2MultiHybridCont,cca2MultiHybridGameOn,eval_cca2MultiHybridGameOn_zero,eval_cca2MultiHybridGameOn_of_le.cca2MultiToSingleAt,cca2MultiToSingle,isOraclePPTOn_cca2MultiToSingleAt_choose,isOraclePPTOn_cca2MultiToSingleAt_guess,isPPT_cca2MultiToSingleAt,isPPT_cca2MultiToSingle,isQueryBounded_cca2MultiToSingleAt,isQueryBounded_cca2MultiToSingle(preserving both Phase 1 and Phase 2 decryption-query bounds(Q₁ n, Q₂ n)).eval_cca2GameOn_cca2MultiToSingle,cca2MultiHybridGameOn_step_gap,cca2MultiGameOn_gap,advantage_cca2MultiGameOn.INDCCA2On.indcca2MultiOn,indcca2MultiOn_iff_indcca2On,INDCCA2Of.indcca2MultiOf,indcca2MultiOf_iff_indcca2Of,INDCCA2.indcca2Multi,INDCCA2.indcca2Multi_iff_indcca2,WordINDCCA2.wordINDCCA2Multi,wordINDCCA2Multi_iff_wordINDCCA2.Complexity/Crypto/Computational/CramerShoup.lean:DDH.indcca2MultiOn_cramerShoup: liftsDDH.indcca2On_cramerShouptoINDCCA2MultiOn (F.cramerShoupValid isElem d)viaINDCCA2On.indcca2MultiOn.ComplexityTests/Crypto/CCA.lean&ComplexityTests/Crypto/CramerShoup.lean:twoChallengeMallory/eval_cca2MultiGame_twoChallengeMallory), andDDH.indcca2MultiOn_cramerShoupregression tests.abstracts/catalogue.json; public-key CCA / Cramer–Shoup is not part of any existing formal abstract entry, so no abstract changes are needed.Validation
./scripts/check.sh(all 6 gates passed)python3 scripts/check_hygiene.py --check-simp(passed)lake build ComplexityAbstracts && python3 -B scripts/check_changed_files.py --base origin/main(passed)AI-assisted PR (crafted by
jetski-worker-252a2093, session252a2093-1f93-43aa-85bf-432251102a3b, independently reviewed by non-author subagentbae9cf39-1487-42a5-83c0-9a7f2a524335).