Documentation

CslibFrontier.Crypto.Computational.SchnorrProofOfKnowledge

Schnorr's protocol is a proof of knowledge of discrete logarithms #

Schnorr's Sigma protocol schnorrFamily ([BS23]), indexed by a unary security parameter n and a group description d, is a proof of knowledge of the discrete logarithm of the statement u. The knowledge extractor schnorrKnowledgeExtractor A is the generic rewinding extractor of CslibFrontier.Crypto.Protocols.SigmaProtocol.ProofOfKnowledge for a prover A on words. It draws its two challenges with the fair-coin sampler schnorrSampleChallenge and computes (c - c')⁻¹ (z - z') modulo the group order q with schnorrExtractWord.

Combined with a discrete-logarithm assumption, this yields the average-key proof-of-knowledge reduction succProbability_schnorrPoKGame_le / DiscreteLog.negligible_schnorrPoKGame (any uniform strict PPT prover succeeds in schnorrPoKGame with negligible probability under DiscreteLog) and is the extraction step behind the security of Schnorr identification; negligible_schnorrDirectProbGame in CslibFrontier.Crypto.Computational.SchnorrEavesdrop proves that security with k-bit challenges. This module also instantiates the andProof, orProofWith, and parallelRepetition compositions of CslibFrontier.Crypto.Protocols.SigmaProtocol.Composition and CslibFrontier.Crypto.Protocols.SigmaProtocol.Efficient on the fair-coin Schnorr Sigma protocol schnorrProbFamily (original instantiations combining [BS23], Examples 19.1–19.3 with Theorems 19.18–19.19 and Exercise 19.6). In the OR composition (schnorrOrProbFamily), the honest prover draws the simulated side's challenge with schnorrSampleChallenge, simulates the other side with schnorrSimulator, and commits on its witness side with schnorrProbFamily. Because a strict-PPT fair-coin machine cannot sample ZMod q with zero error when q is not a power of two, Definition 19.5(ii)'s identical transcript distribution is relaxed to 4 / 2 ^ n (andProof), 6 / 2 ^ n (schnorrOrProbFamily), and 2 * k / 2 ^ n (parallelRepetition) statistical closeness and to Definition 20.6 (ComputationalSpecialHVZK) with exact zero acceptance error.

Main definitions #

Main results #

References #

The rewinding knowledge extractor for Schnorr's protocol: run the prover A to its commitment, answer two challenges sampled by schnorrSampleChallenge from the same state, and apply schnorrExtractWord to the two conversations.

Schnorr's protocol is a proof of knowledge of discrete logarithms. At the security parameter n, in the group described by d of order q, and on every statement u, if the prover A convinces the honest verifier with probability ε, the knowledge extractor outputs the binary encoding of the discrete logarithm of u with probability ε' such that ε ≤ 1 / q + 2 / 2 ^ n + √ε'.

Average-statement extraction for Schnorr's protocol. At security parameter n, in the group described by d of order q, and for any statement distribution μ : PMF (F.Carrier d), the honest verifier's average acceptance probability ε of A over u ← μ and the average probability ε' over u ← μ that schnorrKnowledgeExtractor A outputs the binary encoding of the discrete logarithm of u satisfy ε ≤ 1 / q + 2 / 2 ^ n + √ε'.

Average-key proof of knowledge under DiscreteLog #

Average-key proof-of-knowledge experiment for schnorrFamily at security parameter n: draw group parameters d ← setup n and a uniform secret key α ← PMF.uniformOfFintype (ZMod (F.order d)), and run acceptanceGame of A on the public key α • F.generator d against the honest verifier.

Discrete-logarithm adversary built from schnorrKnowledgeExtractor: on security parameter n and (d, u_word), run F.schnorrKnowledgeExtractor A ((n, d), u_word).

Quantitative average-key reduction from schnorrPoKGame to discreteLogGame. When every group in the support of setup n has order at least m > 0, a prover's average acceptance probability in schnorrPoKGame is at most 1 / m + 2 / 2 ^ n + √ε', where ε' is the discrete-logarithm success probability of schnorrPoKToDLogSolver A.

theorem Cslib.Crypto.PrimeOrderGroupFamily.DiscreteLog.negligible_schnorrPoKGame {F : PrimeOrderGroupFamily} {setup : ℕ → PMF F.Desc} (hDL : F.DiscreteLog setup) {m : ℕ → ℕ} (hm0 : ∀ (n : ℕ), 0 < m n) (hm : ∀ (n : ℕ), ∀ d ∈ (setup n).support, m n ≤ F.order d) (hinv : Negligible fun (n : ℕ) => 1 / ↑(m n)) {A : Protocols.SigmaProtocol.MaliciousProver (ℕ × F.Desc)} (hA : Protocols.SigmaProtocol.MaliciousProver.IsPPT (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary F.encDesc) A) :
Negligible fun (n : ℕ) => (F.schnorrPoKGame setup A n).succProbability

Average-key proof-of-knowledge security of schnorrFamily under DiscreteLog. When every group in the support of setup n has order at least m n > 0 with 1 / m n negligible, every uniform strict PPT prover succeeds in schnorrPoKGame with negligible probability under F.DiscreteLog setup.

Composed fair-coin Schnorr protocols (andProof, schnorrOrProbFamily, #

parallelRepetition)

Word-level challenge subtraction (c - c₀) mod q for schnorrFamily and schnorrProbFamily.

Conjunction (andProof) #

Efficient special soundness of the conjunction of two fair-coin Schnorr protocols (original instantiation combining [BS23], Example 19.2, p. 773, with Theorem 19.18, pp. 787–788).

On every valid pair (x, y) and challenge c, the honest transcript of the fair-coin AND protocol (F.schnorrProbFamily i).andProof (F.schnorrProbFamily i) and the strict PPT simulator andSimulator F.schnorrSimulator F.schnorrSimulator are within statistical distance 4 / 2 ^ n (2 / 2 ^ n from the two honest commitment nonces and 2 / 2 ^ n from the two simulated responses; original instantiation combining [BS23], Example 19.3, p. 774, with Theorem 19.18, pp. 787–788, relaxing Definition 19.5(ii)'s identical transcript distribution to 4 / 2 ^ n statistical closeness in the strict-PPT fair-coin model).

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_chvzkGame_andProof_schnorrProbFamily_le (F : PrimeOrderGroupFamily) {σ : Type} (setup : ℕ → PMF F.Desc) (A : Protocols.SigmaProtocol.CHVZKAdversary (ℕ × F.Desc) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2) × ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2) × ZMod (F.order i.2)) σ) (n : ℕ) :
(Protocols.SigmaProtocol.chvzkRealGame (fun (i : ℕ × F.Desc) => (F.schnorrProbFamily i).andProof (F.schnorrProbFamily i)) (fun (i : ℕ × F.Desc) (x : ZMod (F.order i.2) × ZMod (F.order i.2)) (y : F.Carrier i.2 × F.Carrier i.2) => x.1 • F.generator i.2 = y.1 ∧ x.2 • F.generator i.2 = y.2) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) A n).advantage (Protocols.SigmaProtocol.chvzkSimGame (fun (i : ℕ × F.Desc) (x : ZMod (F.order i.2) × ZMod (F.order i.2)) (y : F.Carrier i.2 × F.Carrier i.2) => x.1 • F.generator i.2 = y.1 ∧ x.2 • F.generator i.2 = y.2) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) (Protocols.SigmaProtocol.andSimulator F.schnorrSimulator F.schnorrSimulator) A n) ≤ 4 / 2 ^ n

In Attack Game 20.4 (chvzkRealGame vs chvzkSimGame), the fair-coin AND-proof of two Schnorr protocols and andSimulator F.schnorrSimulator F.schnorrSimulator differ in distinguishing advantage by at most 4 / 2 ^ n against every adversary (including computationally unbounded ones).

Computational special HVZK of the conjunction of two fair-coin Schnorr protocols (original instantiation combining [BS23], Example 19.3, p. 774, and Theorem 19.18, pp. 787–788, with Definition 20.6, p. 840): against the fair-coin honest prover of (F.schnorrProbFamily i).andProof (F.schnorrProbFamily i), the strict PPT simulator andSimulator F.schnorrSimulator F.schnorrSimulator satisfies Definition 20.6 with exact zero acceptance error (δ = fun _ => 0), relaxing Theorem 19.18's exact transcript identity to 4 / 2 ^ n statistical closeness (closeTo_transcript_andProof_schnorrProbFamily_simulator) and Definition 20.6 in the strict-PPT fair-coin model.

Disjunction (schnorrOrProbFamily) #

@[reducible, inline]
noncomputable abbrev Cslib.Crypto.PrimeOrderGroupFamily.schnorrOrProbFamily (F : PrimeOrderGroupFamily) (i : ℕ × F.Desc) :
Protocols.SigmaProtocol (ZMod (F.order i.2) ⊕ ZMod (F.order i.2)) (F.Carrier i.2 × F.Carrier i.2) (F.Carrier i.2 × F.Carrier i.2) (ZMod (F.order i.2)) (ZMod (F.order i.2) × ZMod (F.order i.2) × ZMod (F.order i.2))

Fair-coin OR-proof of two Schnorr protocols ([BS23], Section 19.7.2, pp. 788–789): the honest prover draws the simulated side's challenge with schnorrSampleChallenge, simulates the other side with schnorrSimulator, and commits on its witness side with schnorrProbFamily.

theorem Cslib.Crypto.PrimeOrderGroupFamily.schnorrOrProbFamily_complete (F : PrimeOrderGroupFamily) (i : ℕ × F.Desc) :
(F.schnorrOrProbFamily i).Complete (Protocols.SigmaProtocol.orRelation (fun (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) fun (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u)

Completeness of the fair-coin OR-proof of two Schnorr protocols (original instantiation combining [BS23], Examples 19.1 and 19.3, pp. 773–774, with Theorem 19.19, p. 789): every simulated conversation of schnorrSimulator is accepting, so every honest conversation of schnorrOrProbFamily is accepting.

Efficient special soundness of the fair-coin OR-proof of two Schnorr protocols (original instantiation combining [BS23], Example 19.2, p. 773, with Theorem 19.19, p. 789).

On every valid pair (x, y) and challenge c, the honest transcript of schnorrOrProbFamily and the strict PPT simulator orSimulator F.schnorrSampleChallenge F.schnorrSimulator F.schnorrSimulator are within statistical distance 6 / 2 ^ n (3 / 2 ^ n from the honest OR prover's three sampleExp draws and 3 / 2 ^ n from the OR simulator's three sampleExp draws; original instantiation combining [BS23], Example 19.3, p. 774, with Theorem 19.19, p. 789, relaxing Definition 19.5(ii)'s identical transcript distribution to 6 / 2 ^ n statistical closeness in the strict-PPT fair-coin model).

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_chvzkGame_schnorrOrProbFamily_le (F : PrimeOrderGroupFamily) {σ : Type} (setup : ℕ → PMF F.Desc) (A : Protocols.SigmaProtocol.CHVZKAdversary (ℕ × F.Desc) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2) ⊕ ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2) × ZMod (F.order i.2) × ZMod (F.order i.2)) σ) (n : ℕ) :
(Protocols.SigmaProtocol.chvzkRealGame F.schnorrOrProbFamily (fun (i : ℕ × F.Desc) => Protocols.SigmaProtocol.orRelation (fun (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) fun (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) A n).advantage (Protocols.SigmaProtocol.chvzkSimGame (fun (i : ℕ × F.Desc) => Protocols.SigmaProtocol.orRelation (fun (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) fun (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) (Protocols.SigmaProtocol.orSimulator F.schnorrSampleChallenge F.schnorrSimulator F.schnorrSimulator) A n) ≤ 6 / 2 ^ n

In Attack Game 20.4 (chvzkRealGame vs chvzkSimGame), the fair-coin OR-proof schnorrOrProbFamily and orSimulator F.schnorrSampleChallenge F.schnorrSimulator F.schnorrSimulator differ in distinguishing advantage by at most 6 / 2 ^ n against every adversary (including computationally unbounded ones).

Computational special HVZK of the fair-coin OR-proof of two Schnorr protocols (original instantiation combining [BS23], Example 19.3, p. 774, and Theorem 19.19, p. 789, with Definition 20.6, p. 840): against the fair-coin honest prover of schnorrOrProbFamily, the strict PPT simulator orSimulator F.schnorrSampleChallenge F.schnorrSimulator F.schnorrSimulator satisfies Definition 20.6 with exact zero acceptance error (δ = fun _ => 0), relaxing Theorem 19.19's exact transcript identity to 6 / 2 ^ n statistical closeness (closeTo_transcript_schnorrOrProbFamily_simulator) and Definition 20.6 in the strict-PPT fair-coin model.

k-fold parallel repetition (parallelRepetition) #

Efficient special soundness of the k-fold parallel repetition of the fair-coin Schnorr protocol (original instantiation combining [BS23], Example 19.2, p. 773, with Exercise 19.6(b), pp. 810–811, allowing k = 0).

On every valid pair (α, u) and challenge tuple c, the honest transcript of the k-fold parallel repetition (F.schnorrProbFamily i).parallelRepetition (k i) and the strict PPT simulator parallelSimulator F.schnorrSimulator k are within statistical distance 2 * k i / 2 ^ n (k i / 2 ^ n from the k i honest commitment nonces and k i / 2 ^ n from the k i simulated responses; original instantiation combining [BS23], Example 19.3, p. 774, with Exercise 19.6(c), pp. 810–811, allowing k = 0 and relaxing Definition 19.5(ii)'s identical transcript distribution to 2 * k i / 2 ^ n statistical closeness in the strict-PPT fair-coin model).

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_chvzkGame_parallelRepetition_schnorrProbFamily_le (F : PrimeOrderGroupFamily) {σ : Type} (k : ℕ × F.Desc → ℕ) (setup : ℕ → PMF F.Desc) (n K : ℕ) (hk : ∀ d ∈ (setup n).support, k (n, d) ≤ K) (A : Protocols.SigmaProtocol.CHVZKAdversary (ℕ × F.Desc) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => F.Carrier i.2) (fun (i : ℕ × F.Desc) => Fin (k i) → F.Carrier i.2) (fun (i : ℕ × F.Desc) => Fin (k i) → ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => Fin (k i) → ZMod (F.order i.2)) σ) :
(Protocols.SigmaProtocol.chvzkRealGame (fun (i : ℕ × F.Desc) => (F.schnorrProbFamily i).parallelRepetition (k i)) (fun (i : ℕ × F.Desc) (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) A n).advantage (Protocols.SigmaProtocol.chvzkSimGame (fun (i : ℕ × F.Desc) (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) (Protocols.SigmaProtocol.parallelSimulator F.schnorrSimulator k) A n) ≤ 2 * ↑K / 2 ^ n

When k (n, d) ≤ K across (setup n).support, Attack Game 20.4 distinguishing advantage for the k-fold parallel repetition of schnorrProbFamily and parallelSimulator F.schnorrSimulator k is at most 2 * K / 2 ^ n against every adversary (including computationally unbounded ones).

theorem Cslib.Crypto.PrimeOrderGroupFamily.computationalSpecialHVZK_parallelRepetition_schnorr (F : PrimeOrderGroupFamily) (k : ℕ × F.Desc → ℕ) (setup : ℕ → PMF F.Desc) {K : ℕ → ℕ} (hK : PolynomiallyBounded K) (hk : ∀ (n : ℕ), ∀ d ∈ (setup n).support, k (n, d) ≤ K n) :
Protocols.SigmaProtocol.ComputationalSpecialHVZK (fun (i : ℕ × F.Desc) => (F.schnorrProbFamily i).parallelRepetition (k i)) (fun (i : ℕ × F.Desc) (α : ZMod (F.order i.2)) (u : F.Carrier i.2) => α • F.generator i.2 = u) (F.schnorrEncoding.parallelRepetition k) (fun (i : ℕ × F.Desc) => F.encScalar i.2) (fun (n : ℕ) => PMF.map (fun (x : F.Desc) => (n, x)) (setup n)) (Protocols.SigmaProtocol.parallelSimulator F.schnorrSimulator k) fun (x : ℕ × F.Desc) => 0

Computational special HVZK of the k-fold parallel repetition of the fair-coin Schnorr protocol (original instantiation combining [BS23], Example 19.3, p. 774, and Exercise 19.6(c), pp. 810–811, with Definition 20.6, p. 840): when k (n, d) ≤ K n across (setup n).support for a polynomially bounded K : ℕ → ℕ, the strict PPT simulator parallelSimulator F.schnorrSimulator k satisfies Definition 20.6 against (F.schnorrProbFamily i).parallelRepetition (k i) with exact zero acceptance error (δ = fun _ => 0), allowing k = 0 and relaxing Exercise 19.6(c)'s exact transcript identity to 2 * k / 2 ^ n statistical closeness (closeTo_transcript_parallelRepetition_schnorrProbFamily_simulator) and Definition 20.6 in the strict-PPT fair-coin model.