Documentation

CslibFrontier.Crypto.Computational.PseudorandomFunction.Label

Garbling labels from a length-preserving pseudorandom function #

The point-and-permute garbling of CslibFrontier.Crypto.Primitives.Garbling.Basic masks its tables with a keyed function F : K → T → K × Bool that sends a wire key and a tweak to a label, a key together with a colour bit. A length-preserving PRF has one bit too few for this. PRF.label F builds such a function from a keyed function F on (n + 1)-bit strings with two calls: the label of an n-bit tweak t under key k is F k (0 ‖ t) together with the first bit of F k (1 ‖ t).

It is exactly as secure as F (PRF.advantage_label): an adversary against PRF.label F has the same finite PRF advantage as the adversary against F that answers each of its label queries with the two calls. On the ideal side, reading a uniform function on (n + 1)-bit strings at 0 ‖ t and the first bit at 1 ‖ t gives a uniform function from tweaks to labels, because this reading is a surjective additive map.

On words, a label distinguisher is an OracleDistinguisher that sends n-bit tweaks and reads (n + 2)-bit replies, a key's bits followed by the colour bit (labelCodec n). The reduction labelReduction W runs W at parameter n against a PRF oracle at parameter n + 1 and answers each tweak with the two calls. It is oracle PPT whenever W is (isOraclePPT_labelReduction), and its word PRF advantage at n + 1 is W's label advantage at n (advantage_label_atLevel). So the label function of a PseudorandomFunction is pseudorandom against every oracle-PPT label distinguisher (PseudorandomFunction.indistinguishable_label).

The two-call construction is the standard way to lengthen the output of a PRF; the statements and proofs are this library's.

Main definitions #

Main results #

def Cslib.Crypto.PRF.label {Key : Type} {n : ℕ} (F : Key → BitString (n + 1) → BitString (n + 1)) (key : Key) (t : BitString n) :

The label function of a keyed function F on (n + 1)-bit strings: the label of an n-bit tweak t under key is F key (0 ‖ t) together with the first bit of F key (1 ‖ t).

def Cslib.Crypto.PRF.labelQuery {n : ℕ} (t : BitString n) :
ProbOracleComp (fun (x : BitString (n + 1)) => BitString (n + 1)) (BitString (n + 1) × Bool)

The two calls to a function on (n + 1)-bit strings that answer the label query t.

theorem Cslib.Crypto.PRF.advantage_label {Key : Type} {n : ℕ} [Fintype Key] [Nonempty Key] (F : Key → BitString (n + 1) → BitString (n + 1)) (A : Adversary (BitString n) (BitString (n + 1) × Bool)) :

The label function is exactly as secure as the keyed function. The finite PRF advantage of A against PRF.label F is the advantage against F of A with each label query answered by the two calls labelQuery.

Labels on words #

Labels on the single word channel: an n-bit tweak is the request of its bits, and the label (k, c) is the reply of the n + 1 bits of k followed by c.

The PRF distinguisher built from a label distinguisher W: at parameter m it runs W at parameter m - 1 and answers each (m - 1)-bit tweak t with two calls to its own oracle, the first m bits of the reply to 0 ‖ t followed by the first bit of the reply to 1 ‖ t. Any other request of W is answered by the empty word, without a query.

Efficiency #

Efficiency of the reduction. For every uniform strict oracle-PPT label distinguisher W, labelReduction W is uniform strict oracle PPT.

Security #

theorem Cslib.Crypto.advantage_label_atLevel {family : List Bool → List Bool → List Bool} (hlength : ∀ (key query : List Bool), query.length = key.length → (family key query).length = key.length) (W : OracleDistinguisher) (n : ℕ) :

The reduction's advantage is the label advantage. For a length-preserving family, the word PRF advantage of labelReduction W at parameter n + 1 is the finite PRF advantage of the label distinguisher W, read through labelCodec n, against the label function of family at parameter n + 1.

The label function of a pseudorandom function is pseudorandom. For every uniform strict oracle-PPT label distinguisher W, its finite PRF advantage at parameter n, read through labelCodec n, against the label function of family at parameter n + 1 is negligible.