Documentation

CslibFrontier.Crypto.Computational.DiffieHellman.GapCDH.Decodable

Asymptotic ROM IND-CCA security of the Diffie–Hellman KEM under Gap-CDH #

This module bridges the fair-coin word-level random-oracle DH-KEM (dhKEMCCAWordGame) and its certified word-level reduction (dhKEMToGapCDHWord) from CslibFrontier.Crypto.Computational.DiffieHellman.GapCDH.WordKEM to the typed per-group games and reduction (PrimeOrderGroupFamily.dhKEMCCAGame, PrimeOrderGroupFamily.gapCDHGame, PrimeOrderGroupFamily.dhKEMToGapCDH) of CslibFrontier.Crypto.Computational.DiffieHellman.GapCDH, and proves the asymptotic security theorem ([KL20], Theorem 12.22, p. 435).

For any uniform strict oracle-PPT adversary A, IsOraclePPTOn.exists_savedCoins yields a coin-tape machine whose fixed-coin replays savedCoinDHKEMAdversary instantiate typed PrimeOrderGroupFamily.DHKEMAdversary adversaries at each (n, d). Because F.Carrier d is finite, every challenge word at (n, d) has bounded length, so padding the coin tape to dhKEMCoinBudget makes the coin draw independent of (x, y, H, key). Query-by-query simulation through routeToTypedQuery and tableRep equates:

  1. the ideal-exponent-sampling step dhKEMCCAWordIdealGameAt with the coin-averaged typed dhKEMCCAGame, and
  2. the execution of dhKEMToGapCDHWord on every encoded Gap-CDH instance (and hence gapCDHWordGame) with the coin-averaged typed dhKEMToGapCDH (eval_run_dhKEMToGapCDHWord_eq and gapCDHWordGame_dhKEMToGapCDHWord_eq).

Averaging PrimeOrderGroupFamily.advantage_dhKEMCCAGame_le_ideal over the coin tape and setup n bounds the advantage in the ideal-exponent-sampling game dhKEMCCAWordIdealGame. Replacing the two exact uniform exponent draws in each world by dhKEMKeyGenWordProb and dhKEMEncapsWordProb (PrimeOrderGroupFamily.sampleExp) via advantage_bind_sampleExp_pair_le and Game.advantage_four_hop_le adds at most 4 / 2 ^ n (advantage_dhKEMCCAWordGame_le), yielding GapCDH.dhKEMROMINDCCA.

Main definitions #

Main results #

References #

Translate a word-level DHKEMOp request at group d into a typed DHKEMQuery program, answering out-of-group requests (F.decode d w = none) with [] without making any oracle call.

Maximum encoded bit length among all elements of F.Carrier d.

Uniform upper bound on the bit length of every encoded DHKEMChallenge at (n, d) with a keyLen n-bit key.

theorem Cslib.Crypto.DecodablePrimeOrderGroupFamily.length_encDHKEMChallenge_le (F : DecodablePrimeOrderGroupFamily) (keyLen : ℕ → ℕ) (n : ℕ) (d : F.Desc) (h cStar : F.Carrier d) (key : BitString (keyLen n)) :
((encDHKEMChallenge F.toPrimeOrderGroupFamily) { groupParameters := d, publicPoint := F.encode d h, ciphertext := F.encode d cStar, key := List.ofFn key }).length ≤ F.maxChallengeLen keyLen n d

Uniform coin-tape length for replaying an oracle machine with clock (c, deg) on any challenge at (n, d).

noncomputable def Cslib.Crypto.DecodablePrimeOrderGroupFamily.savedCoinDHKEMAdversary (F : DecodablePrimeOrderGroupFamily) {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control DHKEMOp) (keyLen : ℕ → ℕ) (c deg n : ℕ) (d : F.Desc) (coins : List Bool) :
F.DHKEMAdversary d (BitString (keyLen n))

Fixed-coin typed KEM adversary obtained by replaying machine on the encoded challenge word and routing its queries through routeToTypedQuery.

Word-level representation of a typed SimTable.

Query-by-query and table simulation #

Saved-coin replay equalities and Theorem 12.22 #

theorem Cslib.Crypto.DecodablePrimeOrderGroupFamily.eval_run_dhKEMToGapCDHWord_eq (F : DecodablePrimeOrderGroupFamily) (keyLen : ℕ → ℕ) {adversary : ℕ → List Bool → Probability.WordOracleComp DHKEMOp Bool} {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control DHKEMOp) (c deg : ℕ) (hrun : ∀ (x : ℕ × List Bool) (Store : Type) (oracle : DHKEMOp × List Bool → StateT Store PMF (List Bool)) (s : Store), ProbOracleComp.runWith oracle (⇑Turing.MultiTapeTM.encBool <$> adversary x.1 x.2) s = (BitString.uniformList (c * (((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) x).length + 1) ^ deg)).bind fun (coins : List Bool) => ProbOracleComp.runWith oracle (machine.runCoins (fun (op : DHKEMOp) (word : List Bool) => ProbOracleComp.query (op, word)) coins ((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) x)) s) (n : ℕ) (d : F.Desc) (a b : ZMod (F.order d)) :
(ProbOracleComp.run (F.dhKEMToGapCDHWord keyLen adversary { secParam := n, groupParameters := d, leftPublic := F.encode d (a • F.generator d), rightPublic := F.encode d (b • F.generator d) }) fun (req : Unit × List Bool) => pure (F.ddhWordOracle d b req.2)).eval = (BitString.uniformList (F.dhKEMCoinBudget keyLen c deg n d)).bind fun (coins : List Bool) => PMF.map (F.encode d) (F.runDDH d b (F.dhKEMToGapCDH d (ProbComp.uniform (BitString (keyLen n))) (F.savedCoinDHKEMAdversary machine keyLen c deg n d coins) (a • F.generator d, b • F.generator d)))

Exact reduction equality on every encoded Gap-CDH challenge (a • g, b • g): running dhKEMToGapCDHWord against ddhWordOracle d b has the exact PMF law of drawing saved coins from BitString.uniformList (dhKEMCoinBudget ...) and encoding the output of the typed reduction PrimeOrderGroupFamily.dhKEMToGapCDH on savedCoinDHKEMAdversary.

theorem Cslib.Crypto.DecodablePrimeOrderGroupFamily.gapCDHWordGame_dhKEMToGapCDHWord_eq (F : DecodablePrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (keyLen : ℕ → ℕ) {adversary : ℕ → List Bool → Probability.WordOracleComp DHKEMOp Bool} {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control DHKEMOp) (c deg : ℕ) (hrun : ∀ (x : ℕ × List Bool) (Store : Type) (oracle : DHKEMOp × List Bool → StateT Store PMF (List Bool)) (s : Store), ProbOracleComp.runWith oracle (⇑Turing.MultiTapeTM.encBool <$> adversary x.1 x.2) s = (BitString.uniformList (c * (((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) x).length + 1) ^ deg)).bind fun (coins : List Bool) => ProbOracleComp.runWith oracle (machine.runCoins (fun (op : DHKEMOp) (word : List Bool) => ProbOracleComp.query (op, word)) coins ((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) x)) s) (n : ℕ) :
F.gapCDHWordGame setup (F.dhKEMToGapCDHWord keyLen adversary) n = (setup n).bind fun (d : F.Desc) => (BitString.uniformList (F.dhKEMCoinBudget keyLen c deg n d)).bind fun (coins : List Bool) => F.gapCDHGame d (F.dhKEMToGapCDH d (ProbComp.uniform (BitString (keyLen n))) (F.savedCoinDHKEMAdversary machine keyLen c deg n d coins))

Game-level reduction equality: at every security parameter n, the word-level Gap-CDH experiment of dhKEMToGapCDHWord equals the setup n- and coin-averaged typed gapCDHGame of PrimeOrderGroupFamily.dhKEMToGapCDH on savedCoinDHKEMAdversary.

theorem Cslib.Crypto.DecodablePrimeOrderGroupFamily.advantage_dhKEMCCAWordGame_le (F : DecodablePrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (keyLen : ℕ → ℕ) {adversary : ℕ → List Bool → Probability.WordOracleComp DHKEMOp Bool} (hA : Probability.IsOraclePPT Turing.MultiTapeTM.encBool adversary) (n : ℕ) :
(F.dhKEMCCAWordGame setup keyLen adversary true n).advantage (F.dhKEMCCAWordGame setup keyLen adversary false n) ≤ (F.gapCDHWordGame setup (F.dhKEMToGapCDHWord keyLen adversary) n).succProbability + 4 / 2 ^ n

Concrete family-level reduction for [KL20], Theorem 12.22 (p. 435): for every setup distribution, key length, uniform strict oracle-PPT adversary adversary, and security parameter n, the fair-coin word-level ROM IND-CCA advantage is at most the Gap-CDH success probability of dhKEMToGapCDHWord plus the 4 / 2 ^ n exponent-sampling loss (2 / 2 ^ n in each of the real-key and random-key worlds).

[KL20], Theorem 12.22 (p. 435). If Gap-CDH is hard relative to (F, setup) and keyLen is computable in polynomial time in unary, then the fair-coin word-level random-oracle Diffie–Hellman KEM (Construction 12.19, p. 431) is IND-CCA secure in the random-oracle model (DHKEMROMINDCCA); taking keyLen = id gives the n-bit keys of Definition 12.13 (p. 425).

Model and deviations from [KL20], Theorem 12.22:

  • Group parameters are drawn from an arbitrary setup : ℕ → PMF F.Desc rather than an efficient group generator G(1^n) (§12.4.1, p. 427), matching DiscreteLog, CDH, DDH, and GapCDH.
  • Honest key generation (dhKEMKeyGenWordProb) and encapsulation (dhKEMEncapsWordProb) sample their exponents in uniform strict (oracle) PPT over fair coins via PrimeOrderGroupFamily.sampleExp (within statistical distance 1 / 2 ^ n of uniform on ZMod (F.order d)), incurring the negligible 4 / 2 ^ n additive loss in advantage_dhKEMCCAWordGame_le.
  • Decapsulation (dhKEMDecapsWordOracle) validates canonical group membership via F.isElem, rejecting non-group words with none (encoded as [] alongside c = cStar) as in the ciphertext-validation remark of Construction 12.23 (pp. 435–436); hash queries outside Set.range (F.encode d) return [].
  • DHKEMROMINDCCA bounds the two-world distinguishing advantage (Game.Indistinguishable), twice the textbook's hidden-bit bias |Pr[KEM^cca = 1] - 1/2|.