Documentation

CslibFrontier.Crypto.Primitives.Garbling.Games

Security games for garbling schemes #

The security notions of [BHR12b], Sections 3.4 to 3.6, for a garbling scheme G with side information Φ. Each game has one two-stage adversary (Cslib.Crypto.TwoStage) who makes a single query and keeps a state between its stages, as in the single-query games of the paper. Each experiment is a program (Cslib.Crypto.Experiment) at a fixed security parameter k. On an invalid query the adversary receives ⊥, which is none.

Advantages are the Experiment.advantage between the two experiments of a game, or the success probability for authenticity. The bit-guessing form Experiment.guessBit of an indistinguishability game draws a uniform hidden bit; the advantage is twice its bias, which is the formulation 2 Pr[PrvInd = 1] − 1 of the paper up to sign. The relations between the indistinguishability and simulation notions are in CslibFrontier.Crypto.Primitives.Garbling.Foundations.

Main definitions #

Main results #

References #

Views #

The view (F, X, d) of a privacy adversary: a garbled function, a garbled input and decoding information.

  • fn : List Bool

    The garbled function F.

  • input : List Bool

    The garbled input X.

  • decInfo : List Bool

    The decoding information d.

The view (F, X) of an obliviousness or authenticity adversary: a garbled function and a garbled input.

noncomputable def Cslib.Crypto.Garbling.Scheme.prvView {Fn : Type} (G : Scheme Fn) (k : ℕ) (q : Query Fn) :

The real privacy view of the query q at security parameter k: garble q.fn to (F, e, d) and return (F, En(e, q.input), d).

noncomputable def Cslib.Crypto.Garbling.Scheme.obvView {Fn : Type} (G : Scheme Fn) (k : ℕ) (q : Query Fn) :

The real obliviousness view of the query q at security parameter k: garble q.fn to (F, e, d) and return (F, En(e, q.input)).

Privacy: indistinguishability #

@[reducible, inline]

A prv.ind adversary: it chooses a pair of queries and keeps a state, then guesses the hidden bit from the view (F, X, d), or from ⊥ when its pair was invalid.

def Cslib.Crypto.Garbling.prvIndValid {Fn Λ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (pair : MessagePair (Query Fn)) :

Validity of a prv.ind pair (f₀, x₀), (f₁, x₁): Φ(f₀) = Φ(f₁), both inputs have f₀.n bits and ev(f₀, x₀) = ev(f₁, x₁).

Instances For
    @[instance_reducible]
    noncomputable def Cslib.Crypto.Garbling.prvIndExperiment {Fn Λ σ : Type} [DecidableEq Λ] (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (A : PrvIndAdversary Fn σ) (b : Bool) :

    Experiment b of the game PrvInd, [BHR12b], Section 3.4: on a valid pair, hand the adversary the real view of the query selected by b; otherwise hand it ⊥.

    noncomputable def Cslib.Crypto.Garbling.prvIndAdvantage {Fn Λ σ : Type} [DecidableEq Λ] (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (A : PrvIndAdversary Fn σ) :

    The prv.ind advantage of an adversary: the distinguishing advantage between the two experiments of PrvInd.

    Privacy: simulation #

    @[reducible, inline]

    A prv.sim adversary: it chooses a query and keeps a state, then guesses whether the view (F, X, d) is real or simulated, or guesses from ⊥ when its query was invalid.

    @[reducible, inline]

    A prv.sim simulator S(1^k, y, φ) at a fixed security parameter: it produces a view (F, X, d) from the output y = ev(f, x) and the side information φ = Φ(f).

    noncomputable def Cslib.Crypto.Garbling.prvSimExperiment {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (S : PrvSimulator Λ) (B : PrvSimAdversary Fn σ) (b : Bool) :

    Experiment b of the game PrvSim, [BHR12b], Section 3.4: when x has f.n bits, b = true hands the adversary the real view of (f, x) and b = false the output of the simulator on (ev(f, x), Φ(f)); otherwise it hands the adversary ⊥.

    noncomputable def Cslib.Crypto.Garbling.prvSimAdvantage {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (S : PrvSimulator Λ) (B : PrvSimAdversary Fn σ) :

    The prv.sim advantage of an adversary against a simulator: the distinguishing advantage between the two experiments of PrvSim.

    Obliviousness: indistinguishability #

    @[reducible, inline]

    An obv.ind adversary: it chooses a pair of queries and keeps a state, then guesses the hidden bit from the view (F, X), or from ⊥ when its pair was invalid.

    def Cslib.Crypto.Garbling.obvIndValid {Fn Λ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (pair : MessagePair (Query Fn)) :

    Validity of an obv.ind pair (f₀, x₀), (f₁, x₁): Φ(f₀) = Φ(f₁) and both inputs have f₀.n bits. The outputs ev(f₀, x₀) and ev(f₁, x₁) need not agree.

    Instances For
      @[instance_reducible]
      noncomputable def Cslib.Crypto.Garbling.obvIndExperiment {Fn Λ σ : Type} [DecidableEq Λ] (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (A : ObvIndAdversary Fn σ) (b : Bool) :

      Experiment b of the game ObvInd, [BHR12b], Section 3.5: on a valid pair, hand the adversary the real view (F, X) of the query selected by b, withholding d; otherwise hand it ⊥.

      noncomputable def Cslib.Crypto.Garbling.obvIndAdvantage {Fn Λ σ : Type} [DecidableEq Λ] (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (A : ObvIndAdversary Fn σ) :

      The obv.ind advantage of an adversary: the distinguishing advantage between the two experiments of ObvInd.

      Obliviousness: simulation #

      @[reducible, inline]

      An obv.sim adversary: it chooses a query and keeps a state, then guesses whether the view (F, X) is real or simulated, or guesses from ⊥ when its query was invalid.

      @[reducible, inline]

      An obv.sim simulator S(1^k, φ) at a fixed security parameter: it produces a view (F, X) from the side information φ = Φ(f) alone.

      noncomputable def Cslib.Crypto.Garbling.obvSimExperiment {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (S : ObvSimulator Λ) (B : ObvSimAdversary Fn σ) (b : Bool) :

      Experiment b of the game ObvSim, [BHR12b], Section 3.5: when x has f.n bits, b = true hands the adversary the real view (F, X) of (f, x) and b = false the output of the simulator on Φ(f); otherwise it hands the adversary ⊥.

      noncomputable def Cslib.Crypto.Garbling.obvSimAdvantage {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (S : ObvSimulator Λ) (B : ObvSimAdversary Fn σ) :

      The obv.sim advantage of an adversary against a simulator: the distinguishing advantage between the two experiments of ObvSim.

      Authenticity #

      @[reducible, inline]

      An aut adversary: it chooses a query and keeps a state, then forges a garbled output from the view (F, X).

      noncomputable def Cslib.Crypto.Garbling.autExperiment {Fn σ : Type} (G : Scheme Fn) (k : ℕ) (A : AutAdversary Fn σ) :

      The game Aut, [BHR12b], Section 3.6: when x has f.n bits, the adversary receives (F, X) and wins when its forgery differs from Ev(F, X) and decodes successfully; otherwise the game outputs false.

      noncomputable def Cslib.Crypto.Garbling.autAdvantage {Fn σ : Type} (G : Scheme Fn) (k : ℕ) (A : AutAdversary Fn σ) :

      The aut advantage of an adversary: its probability of winning Aut.

      Elementary bounds #

      theorem Cslib.Crypto.Garbling.prvIndAdvantage_le_one {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) [DecidableEq Λ] (A : PrvIndAdversary Fn σ) :
      prvIndAdvantage G Φ k A ≤ 1
      theorem Cslib.Crypto.Garbling.prvSimAdvantage_le_one {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (S : PrvSimulator Λ) (B : PrvSimAdversary Fn σ) :
      prvSimAdvantage G Φ k S B ≤ 1
      theorem Cslib.Crypto.Garbling.obvIndAdvantage_le_one {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) [DecidableEq Λ] (A : ObvIndAdversary Fn σ) :
      obvIndAdvantage G Φ k A ≤ 1
      theorem Cslib.Crypto.Garbling.obvSimAdvantage_le_one {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) (S : ObvSimulator Λ) (B : ObvSimAdversary Fn σ) :
      obvSimAdvantage G Φ k S B ≤ 1
      theorem Cslib.Crypto.Garbling.autAdvantage_le_one {Fn σ : Type} (G : Scheme Fn) (k : ℕ) (A : AutAdversary Fn σ) :

      The prv.ind advantage is twice the bias of the bit-guessing experiment, the absolute value of 2 Pr[PrvInd = 1] − 1 in [BHR12b], Section 3.4.

      theorem Cslib.Crypto.Garbling.prvIndAdvantage_eq_zero_of_invalid {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) [DecidableEq Λ] (A : PrvIndAdversary Fn σ) (h : ∀ (pair : MessagePair (Query Fn)) (st : σ), (pair, st) ∈ (A.choose ()).eval.support → ¬prvIndValid G Φ pair) :
      prvIndAdvantage G Φ k A = 0

      An adversary whose pair is never valid has prv.ind advantage 0: both experiments hand it ⊥.

      theorem Cslib.Crypto.Garbling.eval_prvSimExperiment_eq_bind {Fn Λ σ : Type} (G : Scheme Fn) (Φ : SideInfo Fn Λ) (k : ℕ) {α : Query Fn → Type} (S : PrvSimulator Λ) (B : PrvSimAdversary Fn σ) (b : Bool) (P : Query Fn → Prop) [DecidablePred P] (hP : ∀ (q : Query Fn) (st : σ), (q, st) ∈ (B.choose ()).eval.support → q.input.length = G.inLen q.fn → P q) (wrap : (q : Query Fn) → α q → PrvView) (rhs : (q : Query Fn) → PMF (α q)) (hrhs : ∀ (q : Query Fn) (st : σ), (q, st) ∈ (B.choose ()).eval.support → q.input.length = G.inLen q.fn → (if b = true then G.prvView k q else S (G.ev q.fn q.input) (Φ.phi q.fn)).eval = PMF.map (wrap q) (rhs q)) :
      ProbComp.eval (prvSimExperiment G Φ k S B b) = (B.choose ()).eval.bind fun (x : Query Fn × σ) => match x with | (q, st) => if q.input.length = G.inLen q.fn ∧ P q then (rhs q).bind fun (a : α q) => (B.guess st (some (wrap q a))).eval else (B.guess st none).eval

      Library infrastructure (no cited result): rewrite the PrvSim experiment distribution on a predicate P holding on all valid queries in the support of B.choose (), replacing the real-or-simulated view computation by rhs.