Documentation

CslibFrontier.Crypto.Computational.DiffieHellman.Blinded

Two blinded Diffie–Hellman problems in a fixed group #

[BS23], Section 21.11.5, Lemmas 21.7 and 21.8 (pp. 910–911), state two problems that are hard under CDH. With [X, Y] the Diffie–Hellman value of X and Y (Section 21.11.4), given random a, b, u, v, Lemma 21.7's adversary must find γ and w = [u / a ^ γ, v / b ^ γ]; given random a, b, u, Lemma 21.8's adversary must find γ₁ ≠ γ₂, any v and both values wᵢ = [u / a ^ γᵢ, v / b ^ γᵢ]. The book names neither problem: "blinded CDH" and "two-point blinded CDH", and the names of all declarations here, are this library's names.

This module states both problems in one group, as Cslib.Crypto.cdhExperiment does for CDH, and analyses exactly the book's reductions, which turn an adversary for each problem into a CDH adversary. The efficient reductions over a prime-order group family, and the conclusions under the CDH assumption, are in CslibFrontier/Crypto/Computational/DiffieHellman/BlindedFamily.lean.

Differences from the book:

Main definitions #

Main results #

References #

def Cslib.Crypto.blindedDH {G : Type} [AddCommGroup G] {q : ℕ} [Module (ZMod q) G] (α x γ : ZMod q) (b v : G) :
G

The book's [u / a ^ γ, v / b ^ γ] ([BS23], Lemma 21.7) for u = x • g and a = α • g, written through the exponents of u and a: since [X, Y] is the discrete logarithm of X times Y, it is (x - γ * α) • (v - γ • b). No discrete logarithm of b or v is needed. The name is this library's.

theorem Cslib.Crypto.blindedDH_smul_smul {G : Type} [AddCommGroup G] {q : ℕ} [Module (ZMod q) G] (g : G) (α β x y γ : ZMod q) :
blindedDH α x γ (β • g) (y • g) = ((x - γ * α) * (y - γ * β)) • g

When b = β • g and v = y • g, blindedDH is the product of the two blinded exponents times g.

An adversary's answer in blindedCDHExperiment: the exponent γ and the claimed value w = [u / a ^ γ, v / b ^ γ] of [BS23], Lemma 21.7.

  • exponent : ZMod q

    The exponent γ chosen by the adversary.

  • value : G

    The claimed value of blindedDH at γ.

An adversary's answer in blindedCDHPairExperiment: two exponents γ₁, γ₂, an element v and the claimed values wᵢ = [u / a ^ γᵢ, v / b ^ γᵢ] of [BS23], Lemma 21.8.

  • exponent₁ : ZMod q

    The first exponent γ₁.

  • exponent₂ : ZMod q

    The second exponent γ₂.

  • right : G

    The element v chosen by the adversary.

  • value₁ : G

    The claimed value of blindedDH at γ₁.

  • value₂ : G

    The claimed value of blindedDH at γ₂.

def Cslib.Crypto.BlindedCDHAnswer.solve {G : Type} [AddCommGroup G] {q : ℕ} [Module (ZMod q) G] (out : BlindedCDHAnswer q G) (g : G) (μ ν : ZMod q) (s t : G) :
G

The output of the reduction of [BS23], Lemma 21.7, on the CDH instance (s, t) with blinding exponents μ, ν (so a = μ • g and b = ν • g): equation (21.10) solved for [s, t], w + (γ * ν) • s + (γ * μ) • t - (γ ^ 2 * μ * ν) • g.

def Cslib.Crypto.BlindedCDHPairAnswer.solve {G : Type} [AddCommGroup G] {q : ℕ} [Module (ZMod q) G] (out : BlindedCDHPairAnswer q G) (μ : ZMod q) (s : G) :
G

The output of the reduction of [BS23], Lemma 21.8, on a CDH instance whose first element is s, with blinding exponent μ (so a = μ • g and b = s): equation (21.11) solved for [u, b], (γ₁ - γ₂)⁻¹ • (w₂ - w₁) - μ • v + ((γ₁ + γ₂) * μ) • s.

theorem Cslib.Crypto.BlindedCDHAnswer.solve_eq_iff {G : Type} [AddCommGroup G] {q : ℕ} [Module (ZMod q) G] (out : BlindedCDHAnswer q G) (g : G) (μ ν x y : ZMod q) :
out.solve g μ ν (x • g) (y • g) = (x * y) • g ↔ out.value = blindedDH μ x out.exponent (ν • g) (y • g)

The algebra of [BS23], Lemma 21.7: the reduction's output is the Diffie–Hellman element exactly when the adversary's value is the blinded one. No hypothesis on G, q or g.

theorem Cslib.Crypto.BlindedCDHPairAnswer.solve_eq {G : Type} [AddCommGroup G] {q : ℕ} [Module (ZMod q) G] [Fact (Nat.Prime q)] (out : BlindedCDHPairAnswer q G) (g : G) (μ β x : ZMod q) (hne : out.exponent₁ ≠ out.exponent₂) (h₁ : out.value₁ = blindedDH μ x out.exponent₁ (β • g) out.right) (h₂ : out.value₂ = blindedDH μ x out.exponent₂ (β • g) out.right) :
out.solve μ (β • g) = (β * x) • g

The algebra of [BS23], Lemma 21.8: for prime q, from the two blinded values at distinct exponents the reduction's output is the Diffie–Hellman element of β • g and x • g. The adversary's v is any element of G.

def Cslib.Crypto.blindedCDHToCDHWith {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) (A : G → G → G → G → ProbComp (BlindedCDHAnswer q G)) (μ ν : ZMod q) (s t : G) :

The reduction of [BS23], Lemma 21.7, with its blinding exponents μ, ν fixed: on the CDH instance (s, t), run the adversary on a = μ • g, b = ν • g, u = s, v = t and return BlindedCDHAnswer.solve.

def Cslib.Crypto.blindedCDHPairToCDHWith {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) (A : G → G → G → ProbComp (BlindedCDHPairAnswer q G)) (μ : ZMod q) (s t : G) :

The reduction of [BS23], Lemma 21.8, with its blinding exponent μ fixed: on the CDH instance (s, t), run the adversary on a = μ • g, b = s, u = t and return BlindedCDHPairAnswer.solve.

noncomputable def Cslib.Crypto.blindedCDHToCDH {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] (A : G → G → G → G → ProbComp (BlindedCDHAnswer q G)) (s t : G) :

The reduction of [BS23], Lemma 21.7, with exactly uniform blinding exponents.

@[reducible, inline]
noncomputable abbrev Cslib.Crypto.blindedCDHPairToCDH {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] (A : G → G → G → ProbComp (BlindedCDHPairAnswer q G)) (s t : G) :

The reduction of [BS23], Lemma 21.8, with an exactly uniform blinding exponent. Its bound, blindedCDHPairAdvantage_le_cdhAdvantage, needs q prime. It is an abbrev, so that the program it runs after the draw is visibly blindedCDHPairToCDHWith, whose efficiency over a group family is PrimeOrderGroupFamily.isPPTOn_blindedCDHPairToCDHWith. The exactly uniform draw is outside that certificate: a strict fair-coin machine outputs each value with a dyadic probability, so it can make the draw only when q is a power of two. The efficient reduction is PrimeOrderGroupFamily.blindedCDHPairToCDHAdversary (certified by PrimeOrderGroupFamily.isPPT_blindedCDHPairToCDHAdversary), which draws with PrimeOrderGroupFamily.sampleExp and loses 1 / 2 ^ n (PrimeOrderGroupFamily.succProbability_blindedCDHPairGame_le).

noncomputable def Cslib.Crypto.blindedCDHExperiment {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (A : G → G → G → G → ProbComp (BlindedCDHAnswer q G)) :

The problem of [BS23], Lemma 21.7, in the group generated by g: the challenger draws uniform exponents and gives the adversary a = α • g, b = β • g, u = x • g, v = y • g; the adversary wins when its value is blindedDH at its exponent. The name is this library's.

noncomputable def Cslib.Crypto.blindedCDHAdvantage {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (A : G → G → G → G → ProbComp (BlindedCDHAnswer q G)) :

The success probability of A in blindedCDHExperiment.

noncomputable def Cslib.Crypto.blindedCDHPairExperiment {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (A : G → G → G → ProbComp (BlindedCDHPairAnswer q G)) :

The problem of [BS23], Lemma 21.8, in the group generated by g: the challenger draws uniform exponents and gives the adversary a = α • g, b = β • g, u = x • g; the adversary wins when its two exponents differ and both values are blindedDH at its v. The name is this library's.

noncomputable def Cslib.Crypto.blindedCDHPairAdvantage {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (A : G → G → G → ProbComp (BlindedCDHPairAnswer q G)) :

The success probability of A in blindedCDHPairExperiment.

theorem Cslib.Crypto.eval_cdhExperiment_bind {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] {ρ : Type} (R : ProbComp ρ) (B : ρ → G → G → ProbComp G) :
ProbComp.eval (cdhExperiment q g fun (s t : G) => do let r ← R B r s t) = R.eval.bind fun (r : ρ) => ProbComp.eval (cdhExperiment q g (B r))

A CDH solver that first draws r from R and then runs B r has, in the CDH experiment, the average over r of the laws for B r.

The law of blindedCDHExperiment is the law of the CDH experiment for blindedCDHToCDHWith, averaged over uniform blinding exponents.

With exactly uniform blinding exponents, the reduction of [BS23], Lemma 21.7, has in the CDH experiment the law of the adversary in blindedCDHExperiment.

theorem Cslib.Crypto.cdhAdvantage_blindedCDHToCDH {G : Type} [AddCommGroup G] (q : ℕ) [Module (ZMod q) G] (g : G) [NeZero q] [DecidableEq G] (A : G → G → G → G → ProbComp (BlindedCDHAnswer q G)) :

[BS23], Lemma 21.7, in one group, with exactly uniform blinding: the reduction solves its CDH instance with exactly the adversary's success probability in blindedCDHExperiment. Beyond NeZero q, which the uniform draws need, there is no hypothesis on q or g: q need not be prime and g need not generate G.

For prime q, blindedCDHPairExperiment accepts with probability at most that of the CDH experiment for blindedCDHPairToCDHWith, averaged over a uniform blinding exponent.

[BS23], Lemma 21.8, in one group of prime order, with exactly uniform blinding: whenever the adversary wins blindedCDHPairExperiment, the reduction solves its CDH instance. The inequality can be strict, since the reduction can also be right when the adversary loses.