Free-XOR garbling as a garbling scheme #
Definitions and correctness only. The efficiency certificates of the scheme
(CslibFrontier.Crypto.Primitives.Garbling.FreeXOR.Efficient), its word simulator
(CslibFrontier.Crypto.Primitives.Garbling.FreeXOR.Simulator) and its simulation privacy
(prv.sim) under CircularCorrelationRobust, by a certified reduction
(CslibFrontier.Crypto.Primitives.Garbling.FreeXOR.Reduction,
CslibFrontier.Crypto.Primitives.Garbling.FreeXOR.PrvSim), build on it.
The Free-XOR garbling of CslibFrontier.Crypto.Primitives.Garbling.FreeXOR, after Kolesnikov and
Schneider [KS08] and Choi, Katz, Kumaresan and Zhou
[CKKZ12], as a garbling scheme in the sense of Bellare, Hoang and Rogaway
[BHR12b] (Garbling.Scheme) over valid conventional circuits (ValidCircuit):
FreeXOR.scheme hash, with the hash family hash. Every gate whose truth table is XOR is marked
free and emits no garbled rows; every other gate gets four point-and-permute rows masked by two
single-key calls to H'(x, t) = CCR.atLevel hash k ((x, false), t).
At security parameter k, a label is a (k + 1)-bit key followed by its colour bit. Slot a of
row i of gate g has the tweak 8 g + 2 i + a reduced modulo 2 ^ k (PointPermute.tweak).
The coins are the k + 1 bits of the offset key R, then the n + q base labels of the n
input wires and q gate wires; the offset is CCR.offset R = (R, true). Correctness holds for
every hash family, even when tweaks collide (FreeXOR.scheme_correct).
Gb writes the garbled function F as the header (k, n, m, q), in unary, followed for each gate
by its two argument wires A g and B g as w-bit numbers (w the bit length of n + q), a bit
that is set when the gate computes XOR, and four (k + 2)-bit rows when the gate does not compute
XOR. XOR gates have no rows [KS08]. The encoding information e lists both
labels of each input wire, so En is projectiveEncode; the decoding information d lists the
colours of the zero labels of the m output wires, and De is PointPermute.decodeWord.
The scheme is correct (FreeXOR.scheme_correct) but not valid in the sense of
[BHR12b] (§3.1, p. 7: the length condition requires |F|, |e|, and |d| to
depend only on (k, f.n, f.m, |f|), and non-degeneracy requires e and d to depend only on
those and the coins). Here |F| depends on the number of non-XOR gates, so the length condition
fails, and d holds the colours of output zero labels propagated from the gate flags, so
non-degeneracy fails too. [CKKZ12] (§2.2, p. 5, locator not verified) likewise
send no ciphertexts for XOR gates. Simulation privacy does not use validity.
The garbler and the evaluator are list programs. The garbler writes the typed garbling
FreeXOR.garbleWith of ConventionalCircuit.toCircuit f (FreeXOR.gb_eq_encodeGarbled), and the
evaluator follows every fixed point of the typed evaluation round
(FreeXOR.evalWord_encodeFn), so correctness follows from FreeXOR.Garbled.run_garbleWith and
ConventionalCircuit.eval_toCircuit.
Main definitions #
Cslib.Crypto.Garbling.FreeXOR.scheme: Free-XOR garbling as a garbling scheme.Cslib.Crypto.Garbling.FreeXOR.encodeFn,Cslib.Crypto.Garbling.FreeXOR.encodeGarbled: the words of a typed garbled table and of a typed garbled circuit.
Main results #
Cslib.Crypto.Garbling.FreeXOR.gb_eq_encodeGarbled: the garbler computesgarbleWith.Cslib.Crypto.Garbling.FreeXOR.evalWord_encodeFn: the evaluator computes the typed evaluation.Cslib.Crypto.Garbling.FreeXOR.scheme_correct: the scheme is correct.
References #
XOR gates #
Whether a four-bit truth table [G 0 0, G 0 1, G 1 0, G 1 1] is XOR.
Words #
The zero labels of the first n + s wires of f at parameter k, in wire order: input wires
and non-XOR gates read their base labels from coins, and an XOR gate takes the sum of its
arguments' zero labels.
The block of gate g in the garbled function, from the zero labels labels of all wires:
its argument wires A g and B g as w-bit numbers, its XOR bit, and four rows when it is not an
XOR gate.
The decoding information of f: the colours of the zero labels of its last m wires.
One gate of Ev, with the labels of the earlier wires and the position pos of the gate's
block in the body: read the gate's argument wires and their labels, and append their sum for an XOR
gate or the unmasked selected row for a non-XOR gate.
Its length readers are (n, m, q) and its semantics is ConventionalCircuit.evalCirc.
The typed garbling #
Evaluating gate g of toCircuit f under fullInterpretation applies f.1.G to its two
arguments.
Free gates of toCircuit f compute the XOR of their arguments under fullInterpretation.
Row i of non-free gate g of τ, with colours read in binary, first argument most
significant.
The tweaks of the slots of (τ, free) at parameter k: slot a of row ρ of gate g gets
PointPermute.tweak k g (PointPermute.rowIndex ρ) a.
The block of gate g of a garbled table over (τ, free) at parameter k: its argument wires,
from 1, as w-bit numbers, its free bit, and for a non-free gate its rows in garbledRowOf
order.
The garbled function of a table over (τ, free) at parameter k: the header (k, n, m, s),
then the blocks of the gates.
The words (F, e, d) of a typed garbling of toCircuit f at parameter k.
The tweak of garbledRowOf for i < 4 is PointPermute.tweak k g i a.
A base label read from the coins, as a word, is baseWord.
The garbler's zero labels are the typed propagated zero labels.
Library infrastructure (no cited result): looking up gate g's wire in the ofFn label list
of toCircuit f returns labelBits (W (.gate g)).
Library infrastructure (no cited result): looking up gate g's first argument wire A g - 1
in the ofFn label list of toCircuit f.
Library infrastructure (no cited result): looking up gate g's second argument wire B g - 1
in the ofFn label list of toCircuit f.
Library infrastructure (no cited result): looking up output wire o in the ofFn label list
of toCircuit f returns labelBits (W ((toCircuit f).outputs o)).
Gate g of a typed garbled table over toCircuit f, as a word.
The garbler computes the typed garbling. At parameter k, Gb on any coins writes the
words of the typed Free-XOR garbling garbleWith of ConventionalCircuit.toCircuit f, with the
hash fun key t => CCR.atLevel hash k (key, false) t, the tweaks slotTweak and the offset key
and base labels read from the coins.
Evaluation #
Ev follows a fixed point of an evaluation round. If the labelling A of the wires of
toCircuit f is left unchanged by one round of the typed evaluation of table on the input labels
X, then Ev on the garbled function of table and the words of X returns the labels A of the
output wires.