Documentation

CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.Bot

ROM IND-CCA security of FO^⊥ #

The explicit-rejection Fujisaki–Okamoto transform FO^⊥ = U^⊥ ∘ T of [HHK17] (IACR ePrint 2017/604, full version dated 2 November 2021, §3.1 Fig. 5 and §3.2.1 Fig. 9) is IND-CCA secure in the random oracle model when the underlying explicit-coin PKE is two-stage IND-CPA secure, δ-correct and γ-spread, and messages are uniform (Scheme.indCcaBotAdvantage_le). For a randomized adversary each of whose coin values makes at most qG queries to G, qH queries to H, and qD queries to the punctured decapsulation oracle (RandomizedROAdversary.FullQueryBounds A qG qH qD),

`Adv^{IND-CCA}_{FO^⊥}(A) ≤ 2 · Adv^{IND-CPA}(B) + 2 (qG + qH) / |M| + 2 (qG + qH + 1) δ

where B = romBotCpaReduction A is one two-stage IND-CPA adversary that draws its own challenge messages. This concrete bound is the per-parameter step of the asymptotic theorem for the word-level family, WordPKE.INDCPA.romINDCCABot in CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.WordSecurity, which applies the IND-CPA assumption to the certified word-level reduction WordPKE.romBotCpaReductionWord. Unlike the implicit-rejection transform FO-notbot (module CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.NotBot), FO^⊥ has no secret fallback seed and therefore no 2 qH / |M| seed-guessing term; conversely, because decapsBot explicitly outputs none when decT rejects (exposing the §3.1 ciphertext-validity oracle CVO of T[PKE, G]), simulating decapsulation from cached G-queries alone incurs a 2 qD 2^{-γ} ciphertext-validity term, and its keyless challenge hop (step 4 below) pays a further 2 (qG + qH) 2^{-γ} that FO-notbot avoids. In total FO^⊥ pays 2 (qG + qH + qD) 2^{-γ} for spreadness, where the FO-notbot bound has no spreadness term.

The proof composes four game hops for each challenge bit b : Bool:

  1. eval_roIndCcaBotGame_eq_eagerIndCcaBotGame and eagerCoupledBotGame_eq_eagerIndCcaBotGame: lazy/eager equivalence for roIndCcaBotGame and oracle re-indexing via coupledH (bind_keyTable_coupledH), so that valid decapsulations read the ciphertext key table Hq c while invalid ciphertexts return none. Both games are the FO^⊥ instance of the shared ROM IND-CCA experiment (romIndCcaExperiment_bot, eagerRomIndCcaExperiment_bot), so the lazy/eager step is Scheme.eval_romIndCcaExperiment_eq_eager.
  2. closeTo_cachedCoupledBotGame_eagerCoupledBotGame: lazy-sampling simulation with CloseTo error qD · 2^{-γ} (the §3.1 ciphertext-validity hop for T[PKE, G]), replacing decT's check on G(m') by a lookup in the cached G-queries gCache. The hop applies the approximate simulation OracleComp.closeTo_run_interpret_simulation_readOnly to the joined cache SimState.coupledCache of CslibFrontier.Crypto.Protocols.KEM.FujisakiOkamoto.NotBot.Lazy, on which G and H are exact (RandomOracle.eval_run_interpret_bind_complete); only decapsulation needs spreadness.
  3. advantage_cachedCoupledBotGame_simBotGame_le: dropping the secret-key decryption test from both H and decaps via NotBot.Correctness.advantage_coupledFilterGame_simFilterGame_le costs (qG + qH + 1) δ.
  4. advantage_simBotGame_le: in the keyless FO^⊥ simulator simBotGame, the programmed challenge entry (m*, r*) never matches a punctured decapsulation query c ≠ c*, so NotBot.Challenge.advantage_simFilterGame_le reduces distinguishing the real and random challenge keys to the one-wayness experiment simFilterOwExperiment (simBotCheck S.pke), which Scheme.succProbability_simFilterOwExperiment_le bounds by the IND-CPA advantage of romBotCpaReduction.

Steps 1–3 are applied to both challenge bits, which accounts for the factor 2 on their terms. In roIndCcaBotGame and eagerIndCcaBotGame, both real H replies and the independent ideal challenge key are drawn from the arbitrary sampler S.sampleKey : ProbComp K (distinct from S.pke.keyGen), and the proof holds for any S.sampleKey; taking S.sampleKey uniform on K recovers the standard uniform-ideal-key experiment of [HHK17], §2.2, Def. 2.4 / Fig. 4.

Main definitions #

Main results #

References #

Section 1: Executable and Eager ROM IND-CCA Games for FO^⊥ = U^⊥ ∘ T #

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.roBotHandler {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (pk : PK) (sk : SK) (cStar : CT) (q : ROQuery M CT) :
StateT (ROCache M R CT K) ProbComp (ROResp R K q)

Stateful oracle handler for the executable ROM IND-CCA game of FO^⊥ ([HHK17], §3.2.1, Fig. 9). Queries to the challenge ciphertext cStar are rejected with none; other decapsulation queries run the scheme's decapsulation decapsBotM against the lazy random oracles G and H.

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.roIndCcaBotGame {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) (b : Bool) :

The executable ROM IND-CCA security game for FO^⊥ = U^⊥ ∘ T with bit b : Bool. When b = false, the adversary receives the real encapsulated key kReal = H(false, m*, c*); when b = true, it receives an independent key kRand ← S.sampleKey.

noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.indCcaBotAdvantage {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (A : RandomizedROAdversary PK M R CT K) :

The ROM IND-CCA advantage of a randomized adversary A against FO^⊥: the adversary draws its coins and plays roIndCcaBotGame.

noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.eagerBotHandler {PK SK M R CT K : Type} [DecidableEq CT] (S : Scheme PK SK M R CT K) (G : M → R) (H : Bool × M × CT → K) (pk : PK) (sk : SK) (cStar : CT) (q : ROQuery M CT) :
PMF (ROResp R K q)

Stateless handler for S.eagerIndCcaBotGame: G and H are complete functions and decapsulation queries for c ≠ cStar evaluate S.decapsBot G (fun mc => H (false, mc)) pk sk c.

noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.eagerIndCcaBotGame {PK SK M R CT K : Type} [DecidableEq CT] [Fintype M] [Finite R] [Fintype CT] [Finite K] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) (b : Bool) :

The eager random-oracle IND-CCA game for FO^⊥, defined directly from S.pke.keyGen, S.encapsBot, and S.decapsBot over eager random oracles G ← S.coinTable and H ← S.keyTable (Bool × M × CT).

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.botDecaps {PK SK M R CT K : Type} [DecidableEq CT] (S : Scheme PK SK M R CT K) (pk : PK) (sk : SK) (c : CT) :
OracleComp (ROSpec M R CT K) (Option K)

FO^⊥ decapsulation decapsBotM as a program over the random oracles.

theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.roBotHandler_eq_romHandler {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (pk : PK) (sk : SK) (cStar : CT) :
S.roBotHandler pk sk cStar = S.romHandler (S.botDecaps pk sk) cStar

roBotHandler is the lazy handler of romProgram with FO^⊥ decapsulation.

theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.eagerBotHandler_eq_romEagerHandler {PK SK M R CT K : Type} [DecidableEq CT] (S : Scheme PK SK M R CT K) (G : M → R) (H : Bool × M × CT → K) (pk : PK) (sk : SK) (cStar : CT) :
S.eagerBotHandler G H pk sk cStar = romEagerHandler G H (S.botDecaps pk sk) cStar

eagerBotHandler is the eager handler of romProgram with FO^⊥ decapsulation.

@[simp]

roIndCcaBotGame is the ROM IND-CCA experiment of FO^⊥.

@[simp]

eagerIndCcaBotGame is the eager ROM IND-CCA experiment of FO^⊥.

Eager/lazy equivalence for the FO^⊥ ROM IND-CCA game: evaluating the executable lazy-cached game S.roIndCcaBotGame A b yields the exact same output distribution as the eager random-oracle game S.eagerIndCcaBotGame A b.

The ROM IND-CCA advantage of a deterministic adversary A against FO^⊥ equals the distinguishing advantage between S.eagerIndCcaBotGame A false and S.eagerIndCcaBotGame A true.

Section 2: Oracle Re-indexing and Lazy + Spreadness CVO Hop #

noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.eagerCoupledBotHandler {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (G : M → R) (Hq : CT → K) (Hraw : Bool × M × CT → K) (pk : PK) (sk : SK) (cStar : CT) (q : ROQuery M CT) :
PMF (ROResp R K q)

Stateless oracle of eagerCoupledBotGame: G reads G, H reads coupledH, and decapsulation queries c ≠ cStar return some (Hq c) when decT accepts c and none when decT rejects c.

noncomputable def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.eagerCoupledBotGame {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] [Fintype M] [Finite R] [Fintype CT] [Finite K] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) (b : Bool) :

The eager coupled game for FO^⊥: independent tables G, Hq, Hraw, challenge c* = Enc(pk, m*; G(m*)) with real key coupledH (false, m*, c*), and decapsulation gated by decT.

Re-indexing the random oracle H of FO^⊥: eagerCoupledBotGame and eagerIndCcaBotGame have the exact same output distribution.

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.cachedCoupledBotCheck {PK SK M R CT : Type} [DecidableEq M] [DecidableEq CT] (P : ExplicitCoinPKE PK SK M R CT) (pk : PK) (sk : SK) (gCache : List (M × R)) (c : CT) :

Decapsulation filter of cachedCoupledBotGame: decrypts c under sk to m' and accepts only when m' is already cached in gCache with a coin r' satisfying Enc(pk, m'; r') = c.

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.cachedCoupledBotGame {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) (b : Bool) :

Lazy coupled game for FO^⊥ where decapsulation only checks coins already cached in gCache from mStar, G, or H queries.

theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.closeTo_cachedCoupledBotGame_eagerCoupledBotGame {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] [Fintype M] [Finite R] [Fintype CT] [Finite K] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) {qG qH qD : ℕ} (hq : ROFullQueryBounds A qG qH qD) {γ : ℝ} (hγ : S.pke.GammaSpread γ) (b : Bool) :

Lazy and γ-spreadness CVO hop for FO^⊥ ([HHK17], §3.1): replacing eagerCoupledBotGame (where decapsulation evaluates decT on the full table G) by cachedCoupledBotGame (where decapsulation only checks coins already cached in gCache from mStar, G, or H) changes the output distribution by at most qD · 2^{-γ}.

Section 3: Keyless Simulator, Correctness Hop, Challenge Hop, and Main Theorem #

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.simBotCheck {PK SK M R CT : Type} [DecidableEq M] [DecidableEq CT] (P : ExplicitCoinPKE PK SK M R CT) (pk : PK) (gCache : List (M × R)) (c : CT) :

Decapsulation filter of the keyless FO^⊥ simulator simBotHandler: accepts c when some message p.1 in gCache has active cached coin gCache.lookup p.1 = some r satisfying Enc(pk, p.1; r) = c.

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.simBotHandler {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (pk : PK) (cStar : CT) (q : ROQuery M CT) :
StateT (SimState M R CT K) ProbComp (ROResp R K q)

Stateful oracle handler for the keyless ROM simulator of the FO^⊥ IND-CCA game: answers G and H as in simHandler, and answers punctured decapsulation queries c ≠ cStar with some (H_q(c)) when simBotCheck S.pke pk st.gCache c = true and none otherwise.

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.simBotGame {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) (b : Bool) :

The lazy keyless simulator game for FO^⊥ with challenge coin G(m*) programmed.

def Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.romBotCpaReduction {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (A : RandomizedROAdversary PK M R CT K) :
TwoStage PK (MessagePair M) CT Bool (PK × M)

The IND-CPA reduction for FO^⊥: romFilterCpaReduction with the keyless FO^⊥ simulator simBotHandler. Its first stage draws m₀, m₁ ← S.sampleMsg; its second stage runs A against simBotHandler pk cStar from empty caches and outputs whether m₁ was queried to G.

theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.advantage_cachedCoupledBotGame_simBotGame_le {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] [Fintype M] [Nonempty M] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) {qG qH : ℕ} (hq : ROQueryBounds A qG qH) {δ : ℝ} (hδ : S.pke.DeltaCorrect δ) (b : Bool) :
↑(Game.advantage (S.cachedCoupledBotGame A b).eval (S.simBotGame A b).eval) ≤ ↑(qG + qH + 1) * δ

Correctness hop for FO^⊥: for an adversary making at most qG queries to G and qH queries to H against a δ-correct PKE, cachedCoupledBotGame and simBotGame have distinguishing advantage at most (qG + qH + 1) δ.

theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.advantage_simBotGame_le {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) {qG qH : ℕ} (hq : ROQueryBounds A qG qH) {γ : ℝ} (hγ : S.pke.GammaSpread γ) :

Challenge hop for FO^⊥: if the PKE is γ-spread, then for every adversary making at most qG queries to G and qH queries to H, the advantage between simBotGame A false and simBotGame A true is at most `2 Pr[simFilterOwExperiment (simBotCheck S.pke) A]

  • 2 (qG + qH) 2^(-γ)`.
theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.advantage_eagerIndCcaBotGame_simBotGame_le {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] [Fintype M] [Nonempty M] [Finite R] [Fintype CT] [Finite K] (S : Scheme PK SK M R CT K) (A : ROAdversary PK M R CT K) {qG qH qD : ℕ} (hq : ROFullQueryBounds A qG qH qD) {δ γ : ℝ} (hδ : S.pke.DeltaCorrect δ) (hγ : S.pke.GammaSpread γ) (b : Bool) :
↑((S.eagerIndCcaBotGame A b).advantage (S.simBotGame A b).eval) ≤ ↑(qG + qH + 1) * δ + ↑qD * 2 ^ (-γ)

Hybrid chain for one challenge bit of FO^⊥: for a δ-correct and γ-spread PKE and an adversary satisfying ROFullQueryBounds A qG qH qD, the eager IND-CCA game of FO^⊥ and the keyless simulator game simBotGame differ by at most (qG + qH + 1) δ + qD · 2^{-γ}.

theorem Cslib.Crypto.Protocols.FujisakiOkamoto.Scheme.indCcaBotAdvantage_le {PK SK M R CT K : Type} [DecidableEq M] [DecidableEq CT] [Fintype M] [Nonempty M] [Finite R] [Finite CT] [Finite K] (S : Scheme PK SK M R CT K) (A : RandomizedROAdversary PK M R CT K) {qG qH qD : ℕ} (hq : A.FullQueryBounds qG qH qD) (hmsg : S.sampleMsg.eval = Probability.PMF.uniformOfFintype M) {δ γ : ℝ} (hδ : S.pke.DeltaCorrect δ) (hγ : S.pke.GammaSpread γ) :
↑(S.indCcaBotAdvantage A) ≤ 2 * ↑(S.pke.cpaAdvantage (S.romBotCpaReduction A)) + 2 * (↑qG + ↑qH) / ↑(Fintype.card M) + 2 * ↑(qG + qH + 1) * δ + 2 * ((↑qG + ↑qH + ↑qD) * 2 ^ (-γ))

The concrete ROM IND-CCA bound for FO^⊥ = U^⊥ ∘ T over one fixed scheme, the step at each parameter of WordPKE.INDCPA.romINDCCABot; it is not the bound of [HHK17], whose Theorems 3.2 and 3.3 it follows. Let the messages be uniform, the PKE δ-correct and γ-spread, and let every coin value of the randomized adversary A make at most qG queries to G, qH queries to H and qD queries to decaps. Then the single IND-CPA reduction romBotCpaReduction A satisfies `Adv^{IND-CCA}_{FO^⊥}(A) ≤ 2 · Adv^{IND-CPA}(romBotCpaReduction A)

  • 2 (qG + qH) / |M| + 2 (qG + qH + 1) δ + 2 (qG + qH + qD) 2^{-γ}. Both advantages are two-world differences, twice HHK17's hidden-bit advantages. Both real Hreplies and the independent ideal challenge key inroIndCcaBotGameandeagerIndCcaBotGameare drawn from the arbitrary key samplerS.sampleKey : ProbComp K; taking S.sampleKeyuniform on `Krecovers the standard uniform-ideal-key experiment of [HofheinzHoevelmannsKiltz2017], §2.2, Def. 2.4 / Fig. 4. This is a concrete bound for one fixed scheme; it says nothing about the running time of the reduction, which the word-level reductionWordPKE.romBotCpaReductionWord` certifies.

Relation to the source (IACR ePrint 2017/604, version of 2 November 2021). The proof follows the game hops of Theorem 3.2 (T, p. 12) and Theorem 3.3 (U^⊥, p. 14) but composes them directly, without the intermediate OW-PCVA game, and its bound differs from theirs in every term. In HHK17's hidden-bit convention (halving both sides) it reads `Adv(A) ≤ 2 · Adv^{IND-CPA}(romBotCpaReduction A) + (qG + qH) / |M| + (qG + qH + 1) δ

  • (qG + qH + qD) 2^{-γ}, while composing the two theorems as stated, with the at most qHplaintext-checking andqHvalidity queries that Theorem 3.3 gives its OW-PCVA adversary, yields, for some IND-CPA adversary `A', Adv(A) ≤ 3 · Adv^{IND-CPA}(A') + (2 qG + 1) / |M| + (qG + qH) δ + qH 2^{-γ}, which the FO^⊥row of the §3.3 table (p. 22) simplifies to `q_RO (δ + 2^{-γ}) + 3 q_RO / |M| + 3 · Adv^{IND-CPA}(A')withq_RO = qG + qH. Neither bound implies the other: this one has the smaller IND-CPA coefficient, and the smaller message-space term when qH ≤ qG + 1, but a correctness term larger by δand a spreadness term that grows withqGandqD. The query counts are not the same either: HHK17 counts every evaluation of GandHin the experiment, the experiment's own included (§2.1, p. 9), whileFullQueryBounds` counts only the adversary's explicit queries.