Half-gates garbling as a garbling scheme #
Definitions and correctness only. The efficiency certificates of the scheme
(CslibFrontier.Crypto.Primitives.Garbling.HalfGates.Efficient), its word simulator
(CslibFrontier.Crypto.Primitives.Garbling.HalfGates.Simulator) and its simulation privacy
(prv.sim) under CircularCorrelationRobust, by a certified reduction
(CslibFrontier.Crypto.Primitives.Garbling.HalfGates.PrvSim), build on it.
The half-gates garbling of CslibFrontier.Crypto.Primitives.Garbling.HalfGates, after Zahur,
Rosulek and Evans [ZRE15] (Figure 2, p. 9), as a garbling scheme in the sense of
Bellare, Hoang and Rogaway [BHR12b] (Garbling.Scheme) over XOR–AND
conventional circuits (XorAndCircuit): HalfGates.scheme hash, with the hash family hash.
At security parameter k, a label is a (k + 1)-bit key followed by its colour bit, and the hash
of a label and a k-bit tweak is CCR.atLevel hash k (HalfGates.hashWord on words). Slot s of
gate g, false for the generator half and true for the evaluator half, has the tweak 2 g + s,
reduced modulo 2 ^ k (HalfGates.tweakWord). The coins are the k + 1 bits of the offset key
R, then the n input zero labels; the offset is CCR.offset R = (R, true).
The tweaks of different slots need not differ: at k = 0 every tweak is empty, and at k = 1 the
generator halves of gates 0 and 1 both get the tweak [false]. For a circuit with q gates
they are all distinct when 2 q ≤ 2 ^ k. Correctness does not use distinct tweaks, and
HalfGates.scheme_correct holds for every hash family.
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 for an AND gate, and for an AND gate its two ciphertexts, the generator half then the
evaluator half. XOR gates have no ciphertexts [KS08]. The encoding information
e lists the two labels of each input wire, for bit 0 and bit 1, as in point-and-permute
garbling, so En is the projective encoding projectiveEncode; the decoding information d
lists the colours of the zero labels of the m output wires, and De is
PointPermute.decodeWord.
Three choices differ from Figure 2 of [ZRE15] (p. 9): the tweaks are numbered by
gate, 2 g + s modulo 2 ^ k, where Figure 2 takes j and j' from the counter NextIndex,
which advances only at AND gates; e is projective, listing both labels of each input, where
Figure 2 sets e_i = W_i^0 and encodes X_i = e_i ⊕ x_i R; and labels have k + 2 bits, where
Figure 2 has k-bit labels and R ∈ {0,1}^{k-1}1.
The scheme is correct (HalfGates.scheme_correct) but not valid in the sense of
[BHR12b] (§3.1, p. 7). The length of F depends on the number of AND gates, so
the length condition fails, and d holds the colours of output zero labels derived through the
hash from the gates, so it depends on f and non-degeneracy fails too. The scheme of
[ZRE15] behaves the same way: Figure 2 sends F_i only for AND gates and sets
d_i = lsb(W_i^0). Simulation privacy does not use validity.
The garbler and the evaluator are list programs. The garbler writes the typed garbling
HalfGates.garbleWith of HalfGates.toCircuit f (HalfGates.gb_eq_encodeGarbled), and the
evaluator follows every fixed point of the typed evaluation round
(HalfGates.evalWord_encodeFn), so correctness follows from HalfGates.Garbled.run_garbleWith
and HalfGates.eval_toCircuit.
Main definitions #
Cslib.Crypto.Garbling.HalfGates.scheme: half-gates garbling as a garbling scheme.Cslib.Crypto.Garbling.HalfGates.encodeFn,Cslib.Crypto.Garbling.HalfGates.encodeGarbled: the words of a typed garbled table and of a typed garbled circuit.
Main results #
Cslib.Crypto.Garbling.HalfGates.gb_eq_encodeGarbled: the garbler computesgarbleWith.Cslib.Crypto.Garbling.HalfGates.evalWord_encodeFn: the evaluator computes the typed evaluation.Cslib.Crypto.Garbling.HalfGates.scheme_correct: the scheme is correct.
References #
Words #
The tweak of slot s of gate g at parameter k, s = false for the generator half: the
k low bits of 2 g + s, least significant first. Different slots get the same tweak when
2 g + s agree modulo 2 ^ k; correctness does not need distinct tweaks.
The zero label of gate g from the zero labels a, b of its arguments under the offset
Δ: the evaluator's AND gate on the gate's own ciphertexts, or the sum for an XOR gate.
The zero labels of the first n + s wires of f at parameter k, in wire order: the input
zero labels read from the coins, then gate by gate zeroGate on the zero labels of the gate's
arguments.
The block of gate g in the garbled function, from the zero labels labels of all wires:
the numbers of its argument wires as w-bit numbers, its AND bit, and for an AND gate its two
ciphertexts.
The encoding information of f: for each input wire, the labels encoding 0 and 1; label
j encodes bit j mod 2 of input j / 2.
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 the sum of the
labels for an XOR gate, or the evaluator's AND gate on the two ciphertexts for an AND gate.
The typed garbling #
The tweaks of the slots of a circuit at parameter k: slot s of gate g gets
tweakWord k g s.
The block of gate g of a garbled table over C at parameter k: the numbers of its
argument wires, from 1, as w-bit numbers, its AND bit, and for an AND gate its two
ciphertexts, the generator half first.
The words (F, e, d) of a typed garbling of toCircuit f at parameter k.
The evaluator's AND gate on words is andEval.
The offset read from the coins, as a word, is offsetWord.
An entry of the label words of a labelling.
The garbler's zero labels are the typed zero labels. The first n + s zero label words
that Gb computes are the words of the zero labels of the typed garbling of toCircuit f, with the
offset key and input zero labels read from the coins.
Gate g of a typed garbled table over toCircuit f, as a word: the argument wires
A g and B g of f as w-bit numbers, w the bit length of n + q, the AND bit G g 1 1,
and for an AND gate the words of its two ciphertexts, the generator half first.
The garbler computes the typed garbling. At parameter k, Gb on any coins writes the
words of the typed half-gates garbling garbleWith of toCircuit f, with the hash
CCR.atLevel hash k, the tweaks slotTweak and the offset key and input zero 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.