Documentation

CslibFrontier.Crypto.Primitives.Garbling.Scheme

Garbling schemes: syntax, correctness and side information #

A garbling scheme in the sense of Bellare, Hoang and Rogaway [BHR12b], Section 3, is a tuple (Gb, En, De, Ev, ev). The probabilistic garbling algorithm Gb maps a security parameter and a function f to a garbled function F, encoding information e and decoding information d; the deterministic algorithms En, Ev and De encode an input, evaluate a garbled function and decode a garbled output; and ev gives the semantics of f. Functions are an abstract type Fn carrying length readers, so the development is parametric in the function representation (for a concrete point-and-permute circuit garbling construction over Cslib.Circuits.Circuit, see CslibFrontier.Crypto.Primitives.Garbling.Basic and CslibFrontier.Crypto.Primitives.Garbling.Privacy).

The randomness of Gb is explicit: a scheme fixes a coin-length function and a deterministic garbling map on coin strings, and Scheme.garble samples the coins uniformly. This makes the output distribution of garbling a PMF via ProbComp.eval, and the support of that distribution is characterised by Scheme.mem_support_eval_garble_iff.

Side-information functions Φ : Fn → Λ ([BHR12b], Section 3.3) describe what a garbled function is allowed to reveal about f. The side information is Φ-compatible with a scheme when it determines the length readers, and the two inversion properties of Section 4.1 (SideInfo.IsEvInverter and SideInfo.IsInverter) are the hypotheses under which the indistinguishability and simulation notions of CslibFrontier.Crypto.Primitives.Garbling.Foundations coincide.

Efficiency requirements (polynomial-time algorithms, efficiently computable inverters) and the projective encoding structure of [BHR12b], Section 3.2, are not part of this module.

Main definitions #

Main results #

References #

A garbled function together with its encoding and decoding information, the output (F, e, d) of the garbling algorithm.

  • fn : List Bool

    The garbled function F.

  • encInfo : List Bool

    The encoding information e.

  • decInfo : List Bool

    The decoding information d.

A query (f, x) to a garbling scheme: a function description and an input.

  • fn : Fn

    The function description f.

  • input : List Bool

    The input x.

def Cslib.Crypto.Garbling.instDecidableEqQuery.decEq {Fn✝ : Type} [DecidableEq Fn✝] (x✝ x✝¹ : Query Fn✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]

A garbling scheme over a type Fn of function descriptions, following [BHR12b], Section 3.1. The probabilistic algorithm Gb is split into a coin-length function and a deterministic map gb on coin strings; see Scheme.garble for the sampled version.

  • inLen : Fn → ℕ

    The input length f.n of a function description.

  • outLen : Fn → ℕ

    The output length f.m of a function description.

  • size : Fn → ℕ

    The size |f| of a function description.

  • ev : Fn → List Bool → List Bool

    The semantics ev(f, x) of a function description.

  • coinLen : ℕ → ℕ → ℕ → ℕ → ℕ

    The number of coins used by Gb, as a function of the security parameter and the input length, output length and size of f.

  • gb : ℕ → Fn → List Bool → Garbled

    The deterministic core of Gb(1^k, f; r).

  • encode : List Bool → List Bool → List Bool

    The encoding algorithm En(e, x).

  • evalGarbled : List Bool → List Bool → List Bool

    The evaluation algorithm Ev(F, X).

  • decode : List Bool → List Bool → Option (List Bool)

    The decoding algorithm De(d, Y), with none for the failure symbol ⊥.

def Cslib.Crypto.Garbling.Scheme.coins {Fn : Type} (G : Scheme Fn) (k : ℕ) (f : Fn) :

The number of coins Gb(1^k, f) consumes.

noncomputable def Cslib.Crypto.Garbling.Scheme.garble {Fn : Type} (G : Scheme Fn) (k : ℕ) (f : Fn) :

The probabilistic garbling algorithm Gb(1^k, f): sample the coins uniformly and apply the deterministic core.

@[simp]
theorem Cslib.Crypto.Garbling.Scheme.eval_garble {Fn : Type} (G : Scheme Fn) (k : ℕ) (f : Fn) :
(G.garble k f).eval = PMF.map (G.gb k f) (BitString.uniformList (G.coins k f))
theorem Cslib.Crypto.Garbling.Scheme.mem_support_eval_garble_iff {Fn : Type} (G : Scheme Fn) {k : ℕ} {f : Fn} {g : Garbled} :
g ∈ (G.garble k f).eval.support ↔ ∃ (coins : List Bool), coins.length = G.coins k f ∧ G.gb k f coins = g

The garbled triples a scheme can output are exactly the images of coin strings of the right length.

def Cslib.Crypto.Garbling.Scheme.SameShape {Fn : Type} (G : Scheme Fn) (f f' : Fn) :

Two function descriptions have the same shape when their length readers agree.

The length condition of [BHR12b], Section 3.1: the lengths of F, e and d depend only on k and the shape of f.

Non-degeneracy of [BHR12b], Section 3.1: on the same coins, functions of the same shape receive the same encoding and decoding information.

Correctness of [BHR12b], Section 3.1: decoding the evaluation of an encoded input recovers ev(f, x).

A garbling scheme is valid when it satisfies the length condition, non-degeneracy and correctness.

A scheme is well typed when ev returns f.m bits on inputs of f.n bits and, for every honestly garbled (F, e, d), any successful decoding De(d, Y) = y of an arbitrary string Y returns f.m bits.

A side-information function Φ : Fn → Λ together with length readers on Λ, following [BHR12b], Section 3.3.

  • phi : Fn → Λ

    The side information Φ(f).

  • inLen : Λ → ℕ

    The input length read from side information.

  • outLen : Λ → ℕ

    The output length read from side information.

  • size : Λ → ℕ

    The size read from side information.

Side information is compatible with a scheme when it determines the length readers of the scheme.

theorem Cslib.Crypto.Garbling.SideInfo.Compatible.inLen_eq {Fn Λ : Type} {Φ : SideInfo Fn Λ} {G : Scheme Fn} (h : Φ.Compatible G) {f f' : Fn} (hphi : Φ.phi f = Φ.phi f') :
G.inLen f = G.inLen f'

Functions with the same compatible side information have the same input length.

def Cslib.Crypto.Garbling.SideInfo.IsEvInverter {Fn Λ : Type} (Φ : SideInfo Fn Λ) (G : Scheme Fn) (M : Λ → List Bool → Query Fn) :

M is an ev-inverter for Φ ([BHR12b], Section 4.1): from Φ(f) and y = ev(f, x) it produces a query (f', x') with Φ(f') = Φ(f), x' of the right length and ev(f', x') = y.

def Cslib.Crypto.Garbling.SideInfo.IsInverter {Fn Λ : Type} (Φ : SideInfo Fn Λ) (M : Λ → Fn) :

M inverts Φ ([BHR12b], Section 4.1): from Φ(f) it produces some f' with Φ(f') = Φ(f).

The side information Φ_circ revealing the function description itself.