Documentation

CslibFrontier.Crypto.Primitives.PRF.MultiKey

Several independent keys of a finite pseudorandom function #

A multi-key adversary queries t channels at once: the query (i, x) asks channel i at x. In the real experiment multiKeyRealExperiment the channels are F (keys i) for t independent uniform keys; in the ideal experiment multiKeyIdealExperiment they are t independent uniform functions D → R. This is the t-wise parallel composition of a PRF ([BS23], Exercise 4.26), for finite key, input and output types, and the finite counterpart of the word-level Cslib.Crypto.PseudorandomFunction.multiKey_constantCount.

The proof is the standard hybrid argument. In the j-th hybrid the channels below j are random and the others are keyed. The reduction multiKeyReduction F j A is one randomized PRF adversary: it samples its own keys, forwards channel j to its PRF challenger, answers the channels above j with its keys, and lazily samples the random channels below j with a list cache (multiKeyHandler). Against the real PRF experiment it plays the j-th hybrid and against the ideal one the (j + 1)-st, so the multi-key advantage is at most the sum of the t PRF advantages of the reductions (multiKeyAdvantage_le_sum). Each reduction makes at most as many queries as the adversary (isQueryBounded_multiKeyReduction).

This deviates from the exercise, which relates the multi-key advantage to t times the advantage of one reduction that picks the hybrid at random. By the triangle inequality the sum of the t hybrid advantages is at least that quantity, so the bound here follows from the exercise's form and may be weaker. Cslib.Crypto.Game.advantage_hybrid_average provides the averaging step.

Main definitions #

Main results #

References #

@[reducible, inline]

An adaptive test with private coins and t oracle channels, each a function D → R: the query (i, x) asks channel i at x.

noncomputable def Cslib.Crypto.PRF.multiKeyRealExperiment {Key D R : Type} {t : ℕ} [Fintype Key] [Nonempty Key] (F : Key → D → R) (A : MultiKeyAdversary t D R) :

The real multi-key experiment: sample t independent uniform keys and answer each query (i, x) with F (keys i) x.

The ideal multi-key experiment: sample t independent uniform functions D → R and answer each query (i, x) with tables i x.

@[reducible, inline]
noncomputable abbrev Cslib.Crypto.PRF.multiKeyAdvantage {Key D R : Type} {t : ℕ} [Fintype Key] [Nonempty Key] [Fintype D] [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (A : MultiKeyAdversary t D R) :

The multi-key distinguishing advantage of A against F.

@[reducible, inline]

The cache of a hybrid reduction: the replies of its lazily sampled channels so far.

noncomputable def Cslib.Crypto.PRF.multiKeyHandler {Key D R : Type} {t : ℕ} [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (j : ℕ) (keys : Fin t → Key) :
Fin t × D → StateT (MultiKeyCache t D R) (ProbOracleComp fun (x : D) => R) R

One call of the j-th hybrid reduction with its own keys. Channels below j are lazily sampled uniform random functions: a cached request returns its cached reply, and a new one samples a uniform reply and caches it. Channel j is forwarded to the external PRF oracle. Channels above j are evaluated with their keys.

noncomputable def Cslib.Crypto.PRF.multiKeyReduction {Key D R : Type} {t : ℕ} [Fintype Key] [Nonempty Key] [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (j : ℕ) (A : MultiKeyAdversary t D R) :
ProbOracleComp (fun (x : D) => R) Bool

The j-th hybrid reduction: sample t uniform keys, then run the multi-key adversary with multiKeyHandler from the empty cache. It is a PRF adversary for a single channel.

theorem Cslib.Crypto.PRF.isQueryBounded_multiKeyReduction {Key D R : Type} {t : ℕ} [Fintype Key] [Nonempty Key] [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (j : ℕ) {A : MultiKeyAdversary t D R} {Q : ℕ} (hQ : ProbOracleComp.IsQueryBounded A Q) :

A hybrid reduction makes at most as many queries as the multi-key adversary: each request makes at most one query, and private samples make none.

Correctness of the hybrid reductions #

theorem Cslib.Crypto.PRF.interpret_multiKeyReduction_eq_bind {Key D R : Type} {t : ℕ} [Fintype Key] [Nonempty Key] [Fintype D] [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (j : ℕ) (A : MultiKeyAdversary t D R) (ext : D → R) :
OracleComp.interpret (OracleComp.sumHandler ProbComp.unifOracle fun (x : D) => PMF.pure (ext x)) (multiKeyReduction F j A) = (Probability.PMF.uniformOfFintype (Fin t → Key)).bind fun (keys : Fin t → Key) => (Probability.PMF.uniformOfFintype (Fin t → D → R)).bind fun (tables : Fin t → D → R) => OracleComp.interpret (OracleComp.sumHandler ProbComp.unifOracle fun (x : Fin t × D) => match x with | (i, x) => PMF.pure (if ↑i < j then tables i x else if ↑i = j then ext x else F (keys i) x)) A

The law of a hybrid reduction against a fixed function: against a deterministic external oracle ext, the j-th reduction draws its t keys and t uniform tables, and runs A with the channels below j read from the tables, channel j answered by ext, and the channels above j keyed. The lazily sampled channels are thus eager uniform functions.

theorem Cslib.Crypto.PRF.multiKeyAdvantage_le_sum {Key D R : Type} {t : ℕ} [Fintype Key] [Nonempty Key] [Fintype D] [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (A : MultiKeyAdversary t D R) :

Hybrid bound, a step toward [BS23], Exercise 4.26, not the cited result: the multi-key advantage of A is at most the sum of the PRF advantages of the t hybrid reductions multiKeyReduction F j A. This is a concrete bound for one finite instance; running time is not modeled. The asymptotic word-level statement, for a constant number of keys, is Cslib.Crypto.PseudorandomFunction.multiKey_constantCount.