Documentation

CslibFrontier.Crypto.Computational.SchnorrSignature.ForkPass

One native pass of the Schnorr forking reduction #

The security proof of Schnorr signatures in the random-oracle model (succProbability_eufCmaGame_schnorrWordROMScheme_le) runs the forger twice through the existing FiatShamir.forkingProgram: signing calls are answered from presampled simulated transcripts (t, c, z), which also program the oracle at (msg, t), and hash calls are answered from a table or from a list of presampled answers. That program is a typed distribution-level object with no runtime bound. This module gives one native pass of it, for a native forger given as a guarded saved-coin replay (savedWordReplay), and proves that the pass is strict PPT and computes exactly what the typed program computes.

The native state (SchnorrForkState) holds the oracle table, the signed messages, the number of own hash queries and the number of handled calls; challenges and transcripts are words. One call (schnorrForkStep) mirrors ForkingReduction.handler: every call consumes a transcript, and a new hash point consumes the next answer. When the answers run out, a new point gets the empty reply and changes nothing. This keeps each table tag at most the number of answers, so the state grows by an amount bounded by the input and the request (IsOraclePPTOn.run_interpret_preprocess). The final check (schnorrForkFinish) decodes the forgery with the existing total pair decoder, verifies it with schnorrSigVerifyBits, and returns the code of the named index (forkIndexCode, mirroring validIndex), the challenge and the response.

eval_schnorrForkPass shows that on a canonical public key, at least B transcripts and B + 1 answers, where B = savedCoinBudget … bounds the forger's calls, the pass returns exactly the index, challenge and response that forkingAlgorithm reads from FiatShamir.forkingProgram for schnorrWordROMScheme and the decoded saved-coin forger. Exhaustion of the banks is ruled out by the call budget, not assumed, so the typed program's default answer is never used.

Sampling the banks, the second pass with spliced answers, extraction, and the discrete-logarithm theorem are separate steps (#2568).

Main definitions #

Main results #

References #

An entry of the oracle table of a native forking pass.

  • point : List Bool

    The hash point.

  • challenge : List Bool

    The challenge word at the point.

  • tag : ℕ

    0 for a point programmed by a signing call, i + 1 for the pass's own query number i.

theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkEntry_point_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SchnorrForkEntry} :
theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkEntry_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 : γ → List Bool} {x2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBits budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encUnary budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { point := x0 x, challenge := x1 x, tag := x2 x }) encIn encSchnorrForkEntry budget
theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkEntry_tag_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SchnorrForkEntry} :

The encoding of a table entry: the point and challenge words, then the tag in unary.

theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkEntry_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 x2 T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBits T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encUnary T2 S2) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { point := x0 x, challenge := x1 x, tag := x2 x }) encIn encSchnorrForkEntry (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)

The state of a native forking pass.

  • The oracle table, newest entry first.

  • log : List (List Bool)

    The signed messages, newest first.

  • count : ℕ

    The number of the pass's own hash queries.

  • used : ℕ

    The number of handled calls, which is also the number of consumed transcripts.

The encoding of a pass state, with both counters in unary.

theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkState_used_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SchnorrForkState} :
theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkState_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List SchnorrForkEntry} {T0 S0 : γ → ℕ} {x1 : γ → List (List Bool)} {T1 S1 x2 T2 S2 x3 T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Turing.MultiTapeTM.encList encSchnorrForkEntry) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits) T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encUnary T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encUnary T3 S3) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { table := x0 x, log := x1 x, count := x2 x, used := x3 x }) encIn encSchnorrForkState (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkState_count_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SchnorrForkState} :

The presampled values of one pass.

The encoding of the banks: the transcripts as a list of encBits-framed word triples (t, c, z), then the answers as a list of encBits-framed words.

One call of the native forking pass. A signing call on msg takes the next transcript (t, c, z), returns (t, z), programs the point (msg, t) with c and logs msg. A hash call returns the table's challenge for its point, or else the next unused answer, which it records as the pass's own query. Every call consumes one transcript, as in ForkingReduction.handler. Once the answers run out, a new point gets the empty reply and changes nothing, which keeps every tag at most the number of answers.

The native pass #

The input of one native forking pass.

  • secParam : ℕ

    The security parameter.

  • publicKey : List Bool

    The public-key word given to the forger.

  • tape : List Bool

    The forger's saved coin tape.

  • The presampled transcripts and answers.

The encoding of a pass input: the security parameter in unary, the public-key and tape words, then the banks.

theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkPassInput_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget x0 : γ → ℕ} {x1 x2 : γ → List Bool} {x3 : γ → SchnorrForkBanks} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn encSchnorrForkBanks budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { secParam := x0 x, publicKey := x1 x, tape := x2 x, banks := x3 x }) encIn encSchnorrForkPassInput budget
theorem Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrForkPassInput_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : γ → SchnorrForkBanks} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn encSchnorrForkBanks T3 S3) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { secParam := x0 x, publicKey := x1 x, tape := x2 x, banks := x3 x }) encIn encSchnorrForkPassInput (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
noncomputable def Cslib.Crypto.PrimeOrderGroupFamily.schnorrForkRun {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Bool) (c e keyC keyD : ℕ) (input : SchnorrForkPassInput) :

Run the guarded saved-coin replay of a native forger against schnorrForkStep, from the empty table. Returns the forger's output words and the final state.

The native forking run is strict PPT in its full input: the security parameter, public-key word, saved tape and both banks, for every guarded replay machine.

The final check #

The final check of a native pass on the forger's output (msg, sig). The signature word is decoded to (t, z) with the existing total pair decoder. The challenge of the point (msg, t) is the table's, or else the next unused answer, which then counts as the pass's last own query. The forgery wins when schnorrSigVerifyBits accepts and msg was never signed.

The result is the named index, the challenge word and the response word. The index is j + 1 when the forgery wins and its point is the pass's own query number j, with j below both the number of answers and the number of own queries; otherwise it is 0. This mirrors validIndex applied to ForkingReduction.verdict.

noncomputable def Cslib.Crypto.PrimeOrderGroupFamily.schnorrForkPass (F : PrimeOrderGroupFamily) {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Bool) (c e keyC keyD : ℕ) (d : F.Desc) (input : SchnorrForkPassInput) :

One native pass of the Schnorr forking reduction: run the forger's guarded saved-coin replay against schnorrForkStep, then make the final check schnorrForkFinish.

One native forking pass is strict PPT in the full group description and pass input: security parameter, public-key word, saved tape and both banks.

Agreement with the typed forking program #

The native code of a named fork index: 0 for none and j + 1 for index j.

The words a native pass returns for one run of the typed forking algorithm: the code of the named index, the forgery's challenge as a word, and its response.

theorem Cslib.Crypto.PrimeOrderGroupFamily.eval_schnorrForkPass (F : PrimeOrderGroupFamily) {m k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Bool) (c e keyC keyD n : ℕ) (d : F.Desc) (hm : 2 ^ m ≤ F.order d) (y : F.Carrier d) (coins : List Bool) (trs : List (List Bool × BitString m × List Bool)) (htrs : Probability.savedCoinBudget c e keyC keyD n ≤ trs.length) (answers : Fin (Probability.savedCoinBudget c e keyC keyD n + 1) → BitString m) (default : BitString m) :

One native pass agrees with the typed forking program. Let B be the saved-coin budget. On a canonical public key, at least B transcripts and B + 1 answers, the native pass returns exactly forkRunWords of forkingAlgorithm for the existing FiatShamir.forkingProgram of the word Schnorr scheme and the decoded saved-coin forger: the code of the named index and the forgery's challenge and response. The default answer of forkingAlgorithm is never used.