Documentation

CslibFrontier.Crypto.Protocols.VOLE.RingMulCheck

The masked multiplication check over ZMod n #

Hazay and Yang [HY24], §5.1, Equation (1), check a multiplication z = x * y of IT-MAC-authenticated values over ZMod (N ^ ζ) with one extra authenticated random value r. With keys k_w = w * Δ + m_w, the prover sends the masked coefficients

c₁ = x * m_y + y * m_x - m_z + r and c₀ = m_x * m_y + m_r,

and the verifier accepts when k_r + k_x * k_y - k_z * Δ = c₁ * Δ + c₀. This file proves the three properties of this check:

The coefficients reuse voleMulCrossTerm and voleMulConstTerm from Basic.lean; their soundness counterpart in MulCheck.lean needs a field. The results concern a single check with a key the prover never sees; they do not establish security of the protocols of [HY24].

Main definitions #

Main results #

References #

def Cslib.Crypto.Protocols.VOLE.ringMulCheckReply {R : Type u_1} [CommRing R] (x m_x y m_y m_z r m_r : R) :
R × R

The honest masked coefficients (c₁, c₀) of [HY24], §5.1, Equation (1), for authenticated values x, y, z with MAC masks m_x, m_y, m_z and an extra authenticated random value r with mask m_r.

def Cslib.Crypto.Protocols.VOLE.RingMulCheckAccepts {R : Type u_1} [CommRing R] (k_x k_y k_z k_r delta : R) (reply : R × R) :

The verifier's equation k_r + k_x * k_y - k_z * Δ = c₁ * Δ + c₀ on keys k_x, k_y, k_z, k_r, global key Δ and received coefficients reply = (c₁, c₀).

Instances For
    @[instance_reducible]
    instance Cslib.Crypto.Protocols.VOLE.instDecidableRingMulCheckAcceptsOfDecidableEq {R : Type u_1} [CommRing R] [DecidableEq R] (k_x k_y k_z k_r delta : R) (reply : R × R) :
    Decidable (RingMulCheckAccepts k_x k_y k_z k_r delta reply)
    theorem Cslib.Crypto.Protocols.VOLE.ringMulCheck_complete {R : Type u_1} [CommRing R] {x y z : R} (m_x m_y m_z r m_r delta : R) (hxyz : x * y = z) :
    RingMulCheckAccepts (x * delta + m_x) (y * delta + m_y) (z * delta + m_z) (r * delta + m_r) delta (ringMulCheckReply x m_x y m_y m_z r m_r)

    Completeness. If x * y = z, the honest coefficients pass the check under every key.

    def Cslib.Crypto.Protocols.VOLE.ringMulCheckView {R : Type u_1} [CommRing R] (x m_x y m_y m_z delta : R) (rm : R × R) :
    R × R × R

    The verifier's view (k_r, c₁, c₀) of an honest run, as a function of the mask rm = (r, m_r). The keys k_x, k_y, k_z and Δ are fixed by the setup.

    def Cslib.Crypto.Protocols.VOLE.ringMulCheckSimulate {R : Type u_1} [CommRing R] (k_x k_y k_z delta : R) (kc : R × R) :
    R × R × R

    The simulator's view: (k_r, c₁) is the given pair and c₀ is the unique value that satisfies the verifier's equation for the keys k_x, k_y, k_z and Δ.

    theorem Cslib.Crypto.Protocols.VOLE.ringMulCheckSimulate_accepts {R : Type u_1} [CommRing R] (k_x k_y k_z delta : R) (kc : R × R) :
    RingMulCheckAccepts k_x k_y k_z (ringMulCheckSimulate k_x k_y k_z delta kc).1 delta (ringMulCheckSimulate k_x k_y k_z delta kc).2

    The simulated view always satisfies the verifier's equation.

    theorem Cslib.Crypto.Protocols.VOLE.ringMulCheckView_eq_simulate {R : Type u_1} [CommRing R] [Fintype R] [Nonempty R] {x y z : R} (m_x m_y m_z delta : R) (hxyz : x * y = z) :
    PMF.map (ringMulCheckView x m_x y m_y m_z delta) (Probability.PMF.uniformOfFintype (R × R)) = PMF.map (ringMulCheckSimulate (x * delta + m_x) (y * delta + m_y) (z * delta + m_z) delta) (Probability.PMF.uniformOfFintype (R × R))

    Exact simulation of the verifier's view. If x * y = z, then under a uniform mask (r, m_r) the honest view (k_r, c₁, c₀) has the simulator's distribution, which uses only the keys and Δ. This holds for every key Δ and every finite commutative ring.

    theorem Cslib.Crypto.Protocols.VOLE.card_filter_ringMulCheck_le {n : ℕ} [NeZero n] {x y z : ZMod n} (m_x m_y m_z r m_r : ZMod n) (reply : ZMod n × ZMod n) (hfalse : x * y ≠ z) :
    {delta : ZMod n | RingMulCheckAccepts (x * delta + m_x) (y * delta + m_y) (z * delta + m_z) (r * delta + m_r) delta reply}.card ≤ 2 * (n / n.minFac)

    Soundness, counting form. If x * y ≠ z, then for any fixed masks and any fixed coefficients reply, at most 2 * (n / n.minFac) keys Δ ∈ ZMod n accept.

    theorem Cslib.Crypto.Protocols.VOLE.toOuterMeasure_ringMulCheck_le {n : ℕ} [NeZero n] {x y z : ZMod n} (m_x m_y m_z r m_r : ZMod n) (reply : ZMod n × ZMod n) (hfalse : x * y ≠ z) :
    (Probability.PMF.uniformOfFintype (ZMod n)).toOuterMeasure {delta : ZMod n | RingMulCheckAccepts (x * delta + m_x) (y * delta + m_y) (z * delta + m_z) (r * delta + m_r) delta reply} ≤ 2 / ↑n.minFac

    Soundness. If x * y ≠ z, then for any fixed masks and coefficients the check accepts under a uniform key with probability at most 2 / n.minFac.

    theorem Cslib.Crypto.Protocols.VOLE.toOuterMeasure_ringMulCheck_bind_le {n : ℕ} [NeZero n] {S : Type} (prover : PMF S) (x y z m_x m_y m_z r m_r : S → ZMod n) (reply : S → ZMod n × ZMod n) :
    (do let s ← prover let delta ← Probability.PMF.uniformOfFintype (ZMod n) pure (s, delta)).toOuterMeasure {sd : S × ZMod n | x sd.1 * y sd.1 ≠ z sd.1 ∧ RingMulCheckAccepts (x sd.1 * sd.2 + m_x sd.1) (y sd.1 * sd.2 + m_y sd.1) (z sd.1 * sd.2 + m_z sd.1) (r sd.1 * sd.2 + m_r sd.1) sd.2 (reply sd.1)} ≤ 2 / ↑n.minFac

    Soundness against a randomized prover. The prover's state s, drawn before the independent uniform key, determines the values, masks and coefficients. The bad event includes the false multiplication, so no assumption on the prover's distribution is needed. The prover sees neither the key nor the verifier's keys before committing to its coefficients.