Mixed-modulus circuits and mixed-modulus circular correlation robustness #
Ball, Malkin and Rosulek [BMR16] garble mixed-modulus arithmetic circuits:
every wire carries a residue modulo its own modulus, addition and multiplication by a constant
act within one modulus, and a projection gate applies an arbitrary function
φ : ℤ_m → ℤ_n between moduli. Wire sorts are drawn from a finite type ι; sort i has modulus
μ i and wire labels of sort i are vectors of ℤ_{μ i}^{ℓ i + 1}, split as a key in
ℤ_{μ i}^{ℓ i} and a colour, the last coordinate. In [BMR16] the key length is
λ_m = ⌈λ / log₂ m⌉ for security parameter λ (§4.1, p. 5). Page numbers here refer to the full
version, ePrint 2016/969, dated October 6, 2016.
A circuit is a typed straight-line program: MixedModulusCircuit μ P Γ Θ reads input wires of
the sorts listed in Γ, appends one wire per gate, and outputs wires of the sorts listed in
Θ. A wire is referred to by a typed de Bruijn reference Ref Γ i, so every gate reads only
earlier wires of the right sorts and no well-formedness side condition is needed. The parameter
P i j is the payload of a projection gate from sort i to sort j: for an actual circuit it is
the function ℤ_{μ i} → ℤ_{μ j} (Projection); a garbling simulator is polymorphic in P, so it
cannot read the projection functions, which are exactly what a garbled circuit hides.
The security of the garbling scheme rests on mixed-modulus circular correlation robustness
of a tweakable hash H [BallMalkinRosulek2016, Definition 1]. A secret offset Δ_i = (δ_i, 1) is
drawn for each sort, with uniform key part and colour 1. The real oracle answers a query
(g, i, j, X, a, b) of source sort i and target sort j with H(g, X + a Δ_i) + b Δ_j; the
ideal oracle is a uniformly random function. This file defines the two experiments and the
advantage ccrAdvantage of one adversary against one hash. It states no assumption: an asymptotic
assumption against efficient adversaries, and the privacy theorem of BMR16 that would rest on it,
are tracked in #6068.
Definition 1 of [BMR16] (§4.3, p. 7) quantifies over polynomial-time adversaries
"that query their oracle on distinct g values and a ≠ 0". In the source's own scheme (Figure 1,
p. 7) the m - 1 ciphertexts of a projection gate from modulus m all use that gate's tweak, and
the proof sketch of its Theorem 1 (pp. 7–8) replaces them using only the oracle of Definition 1,
which takes m - 1 queries under one tweak. So the source's argument needs more than Definition 1
grants. We use a relaxed legality condition, which closes that gap: along every run, no query uses
a = 0, and two queries that agree on the tweak, the source sort, X and a are equal
(CCRAdversary.IsLegal). Every adversary legal for Definition 1 is legal here, so an assumption
stated with this legality is stronger than Definition 1 as literally stated, and would be novel to
this library. It is strictly stronger: if H' satisfies Definition 1, so does
H g i (k, c) j := H' g i (k, 0) j, yet two queries under one tweak with labels (k, 0) and
(k, 1), a = 1 and b = 0 get equal real answers. A run answers every call, private coin or
oracle query, independently with an arbitrary reply (IsRun).
Composite moduli. [BMR16] does not restrict moduli to primes, and its gadgets
use composite ones: b + 1 for a fan-in-b AND gate (§5, p. 8), the output modulus k + 1 of an
equality test (§6.2, p. 11) and p + q - 1 in comparisons (§6.3, pp. 12–13). When μ i is
composite with least prime factor p, a nonzero multiplier can be a zero divisor, and
(μ i / p) • δ_i = 0 with probability 1 / p ^ ℓ i. Let r = μ i / p, and fix a tweak g, a
target sort j, a key k and a colour c. The queries with labels (k, c) and (k, c - r),
multipliers a = 1 and a' = 1 + r, and b = 0 have different ccrKeys and nonzero multipliers,
and they hash the same input exactly when r • δ_i = 0. The adversary that asks both and compares
the answers is legal, never evaluates H, and has ccrAdvantage at least
1 / p ^ ℓ i - 1 / μ j ^ (ℓ j + 1) against every H; for μ i = 2 ^ λ with λ ≥ 2 and
ℓ i = 1 that is 1 / 2 - 1 / μ j ^ (ℓ j + 1). The single query (g, i, j, X, r, 0), compared
with H g i (X + (0, r)) j, does as well and is legal for Definition 1 too, so the analogue of
Definition 1 fails in the same way when the adversary can also evaluate the hash. These are
arguments, not theorems stated here. The source does not address this collision: §4.3 has no
analysis of zero divisors, and the only bound it states is 1 / 2 ^ λ for authenticity (p. 8).
This library documents the gap rather than excluding composite moduli, which would exclude the
gadgets above. With the source's key length ⌈λ / log₂ (μ i)⌉ the probability is about
2 ^ (-λ log₂ p / log₂ (μ i)) (2 ^ (-64) for μ i = 4 and λ = 128); bringing it down to
2 ^ (-λ) needs ℓ i ≥ ⌈λ / log₂ (Nat.minFac (μ i))⌉, which is the source's length when μ i
is prime. The definitions here and in BMR16 take ℓ as a parameter, so this is a condition on
the choice of ℓ, not on the definitions. In an asymptotic assumption (#6068) the collision
probability at level κ is p(κ) ^ (-ℓ(κ)), where p(κ) is the least prime factor of the modulus
at that level. For fixed moduli, or more generally a bounded least prime factor, it is negligible
only if ℓ grows. With moduli that vary it can be negligible for fixed ℓ: for μ κ = p(κ) ^ 2
with a prime p(κ) ≥ 2 ^ κ and ℓ = 1 it is at most 2 ^ (-κ). So the collision argument alone
does not force ℓ to grow; this observation does not prove security.
Main definitions #
Cslib.Crypto.Garbling.MixedModulus.Ref,Cslib.Crypto.Garbling.MixedModulus.Env: typed wire references and assignments of values to the wires of a context.Cslib.Crypto.Garbling.MixedModulus.MixedModulusCircuit,.eval: mixed-modulus circuits withAdd_m,Mult_candProj_φgates and their evaluation.Cslib.Crypto.Garbling.MixedModulus.CCRInput: a CCR query without its tweak, read throughsource,target,label,aandb.Cslib.Crypto.Garbling.MixedModulus.ccrOracle,.ccrRealGame,.ccrIdealGame,.ccrAdvantage: the mixed-modulus circular correlation robustness experiments.Cslib.Crypto.Garbling.MixedModulus.IsRun: the runs of an oracle program.Cslib.Crypto.Garbling.MixedModulus.CCRAdversary.IsLegal: legal adversaries, in a relaxed sense that admits more adversaries than Definition 1 of [BMR16].
References #
Typed contexts #
A reference to a wire of sort i in a context Γ of wire sorts, newest wire first.
Mixed-modulus circuits #
A residue of sort i: a wire value in ℤ_{μ i}.
A wire label of sort i: a key in ℤ_{μ i}^{ℓ i} and a colour in ℤ_{μ i}, that is, a
vector of ℤ_{μ i}^{ℓ i + 1} whose last coordinate is the colour.
The payload of an actual projection gate from sort i to sort j: a function
ℤ_{μ i} → ℤ_{μ j}.
A mixed-modulus circuit [BMR16] with inputs of the sorts in Γ and
outputs of the sorts in Θ, as a straight-line program: each gate reads earlier wires and appends
a new wire. P i j is the payload of a projection gate from sort i to sort j.
- output {ι : Type} {μ : ι → ℕ} {P : ι → ι → Type} {Γ Θ : List ι} (outs : Env (Ref Γ) Θ) : MixedModulusCircuit μ P Γ Θ
Output the listed wires.
- add {ι : Type} {μ : ι → ℕ} {P : ι → ι → Type} {Γ Θ : List ι} {i : ι} (args : List (Ref Γ i)) (next : MixedModulusCircuit μ P (i :: Γ) Θ) : MixedModulusCircuit μ P Γ Θ
Add_m: the sum moduloμ iof the listed wires of sorti. - mul {ι : Type} {μ : ι → ℕ} {P : ι → ι → Type} {Γ Θ : List ι} {i : ι} (c : ZMod (μ i)) (arg : Ref Γ i) (next : MixedModulusCircuit μ P (i :: Γ) Θ) : MixedModulusCircuit μ P Γ Θ
Mult_c: the product of a wire of sortiby the constantc ∈ ℤ_{μ i}. - proj {ι : Type} {μ : ι → ℕ} {P : ι → ι → Type} {Γ Θ : List ι} {i j : ι} (arg : Ref Γ i) (φ : P i j) (next : MixedModulusCircuit μ P (j :: Γ) Θ) : MixedModulusCircuit μ P Γ Θ
Proj_φ: a projection from a wire of sortito a new wire of sortj.
The number of gates.
Evaluate a circuit on the residues of its input wires.
Runs of oracle programs #
A run of an oracle program: the requests it makes, in order, and its result, when each call is answered independently by an arbitrary reply. Two calls with the same request may get different replies along one run.
A run of a sequence splits into a run of its first part and a run of the continuation selected by the first result.
Mixed-modulus circular correlation robustness #
The source sort i.
The target sort j.
A legal adversary makes a legal list of oracle queries along every run, whatever its private coins and the oracle's replies: the oracle queries are the right components of the requests.
The real experiment: sample the offsets and answer every query with the real oracle.
A reply for each query with a fixed tweak.
Instance search does not find this product of finite function types on its own.
The ideal experiment: sample a uniformly random function and answer every query with it.
The mixed-modulus CCR advantage of B against H.