Documentation

CslibFrontier.Crypto.Computational.TCRSignature.ManyTime

Many-time fresh-key TCR hash-and-sign on arbitrary-length bit words #

TCRSignature.scheme instantiates construction (13.2) of [BS23], Section 13.2.1 over a one-time signature scheme S to build a capacity-1 IndexedSignatureScheme. This module formalizes [BS23], Section 13.2.1 (construction (13.2) on p. 533 and Theorem 13.2 on p. 534) in its full many-time form: given any stateless many-time EUFCMA-secure SignatureScheme S on fixed-length bit strings and any unrestricted target collision-resistant KeyedHashFamily H on List Bool, TCRSignature.wordScheme S H is a stateless many-time WordSignatureScheme satisfying WordSignatureScheme.EUFCMA on arbitrary-length List Bool messages:

  1. Construction (TCRSignature.wordScheme): reuses TCRSignature.keyGen S H, signs any msg : List Bool via TCRSignature.sign S H sk 0 msg (sampling a fresh H.keyLen n-bit hash key k per signature and signing otsMsg H n k (H.eval n k msg) under S), and verifies via TCRSignature.verify S H pk 0 msg sig.
  2. Many-query security reduction (exists_reduction_wordScheme_eufCmaGame_le, SignatureScheme.EUFCMA.eufCMA_wordScheme): following the proof of [BS23], Theorem 13.2 (p. 534), every valid forgery (m*, (k*, ots*)) against wordScheme S H after arbitrarily many adaptive signing queries (m_1, k_1), …, (m_Q, k_Q) satisfies one of two cases:
    • Type I (manyTimeForger): M* = otsMsg H n k* (H.eval n k* m*) differs from every word otsMsg H n k_r (H.eval n k_r m_r) signed during the run, winning S.eufCmaGame with factor 1.
    • Type II (tcrMultiAdversary): M* = otsMsg H n k_r (H.eval n k_r m_r) for some signing query step, so otsMsg_inj forces k* = k_r and H.eval n k_r m_r = H.eval n k_r m* while freshness m* ∉ queried forces m_r ≠ m*. Guessing the challenge machine step via sampleDyadicIndex (fuelUpper ... n) commits m_r before k_r is sampled, implants the external challenge hash key at that step, and finishes the remaining steps locally under S, winning targetCollisionGame with polynomial loss dyadicSize (fuelUpper ... n).
  3. Cryptographic consequences (WordSignatureScheme.EUFCMA.exists_oneWay, OneWay.exists_wordEUFCMA_of_targetCollisionResistant, OneWayPermutation.exists_wordEUFCMA): combining OneWay.exists_eufCMA_of_targetCollisionResistant with eufCMA_wordScheme yields stateless many-time WordSignatureSchemes on unrestricted List Bool messages from any one-way function plus a target collision-resistant KeyedHashFamily (and unconditionally from any OneWayPermutation via naorYungHash).

Main definitions #

Main results #

References #

Stateless many-time WordSignatureScheme via fresh-key TCR hash-and-sign #

Fresh-key TCR hash-and-sign stateless WordSignatureScheme ([BS23], Section 13.2.1, construction (13.2), p. 533): signs arbitrary-length List Bool messages by sampling a fresh H.keyLen n-bit hash key k inside every signature and signing otsMsg H n k (H.eval n k m) under the fixed-length signature scheme S at security parameter otsParam H n.

@[simp]
theorem Cslib.Crypto.TCRSignature.wordScheme_sign (S : SignatureScheme) (H : KeyedHashFamily) (sk msg : List Bool) :
(wordScheme S H).sign sk msg = sign S H sk 0 msg
@[simp]
theorem Cslib.Crypto.TCRSignature.wordScheme_verify (S : SignatureScheme) (H : KeyedHashFamily) (pk msg sig : List Bool) :
(wordScheme S H).verify pk msg sig = verify S H pk 0 msg sig

Type-I reduction: open stateless signing-oracle simulation (manyTimeForger) #

Open stateless handler answering each signing query msg at parameter n by sampling a fresh H.keyLen n-bit hash key k, querying the external S-signing oracle on otsMsg H n k (H.eval n k msg) (truncated to sigBound n), and returning (k, ots).

noncomputable def Cslib.Crypto.TCRSignature.manyTimeForger (H : KeyedHashFamily) (sigBound : ℕ → ℕ) (adversary : Forger) :

Many-time signature forger against S at parameter M = otsParam H n: recovers n := otsParamInv H M, runs adversary n (encPair encUnary encBits (n, otvk)) against manyTimeHandler H sigBound n, and translates any output (m*, (k*, ots*)) into the fixed-length S-forgery (otsMsg H n k* (H.eval n k* m*), ots*).

Deterministic step replay and bounded-growth trace sampling (tcrMultiAdversary) #

One recorded machine step of the many-query trace sampler.

  • coin : Bool

    Fair coin bit supplied to the machine transition at this step.

  • hashKey : List Bool

    Fresh hash key chosen when this step queries the signing oracle.

  • ots : List Bool

    Signature from the underlying signature scheme (or [] when no query occurs).

Instances For
    theorem Cslib.Crypto.TCRSignature.TraceStep.ext {x y : TraceStep} (coin : x.coin = y.coin) (hashKey : x.hashKey = y.hashKey) (ots : x.ots = y.ots) :
    x = y
    @[reducible, inline]

    The tuple of the fields of encTraceStep.

    theorem Cslib.Crypto.TCRSignature.encTraceStep_hashKey_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TraceStep} :
    theorem Cslib.Crypto.TCRSignature.encTraceStep_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Bool} {x1 x2 : γ → List Bool} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBool budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { coin := x0 x, hashKey := x1 x, ots := x2 x }) encIn encTraceStep budget
    theorem Cslib.Crypto.TCRSignature.encTraceStep_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBool T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { coin := x0 x, hashKey := x1 x, ots := x2 x }) encIn encTraceStep (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
    theorem Cslib.Crypto.TCRSignature.encTraceStep_coin_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TraceStep} :
    theorem Cslib.Crypto.TCRSignature.encTraceStep_ots_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TraceStep} :

    Deterministically advance cfg by one TraceStep, truncating any query reply encPair encBits encBits (step.hashKey, step.ots) to limit bits.

    def Cslib.Crypto.TCRSignature.replayCfg {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit : ℕ) (word : List Bool) (trace : List TraceStep) :

    Replay a full List TraceStep from FiniteConfig.init machine.initial word.

    def Cslib.Crypto.TCRSignature.queryOf {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (cfg : Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) (coin : Bool) :

    Inspect whether machine issues an external query from cfg on fair coin coin, returning some (cfg.channels ()).1 when it does and none otherwise.

    replayCfg is computable in plain polynomial time for every finite-control MultiTapePTM.

    noncomputable def Cslib.Crypto.TCRSignature.appendTraceStep {k : ℕ} {Control : Type} (S : SignatureScheme) (H : KeyedHashFamily) (machine : Turing.MultiTapePTM k Bool Control Unit) (n : ℕ) (otsk : List Bool) (limit : ℕ) (word : List Bool) (trace : List TraceStep) (b : Bool) (hashKey : List Bool) :

    Advance trace by one step under coin b and key hashKey, appending ⟨b, hashKey, []⟩ when step trace.length does not query and signing (hashKey, H.eval n hashKey msg) to append ⟨b, hashKey, ots⟩ when it queries msg.

    noncomputable def Cslib.Crypto.TCRSignature.sampleStep {k : ℕ} {Control : Type} (S : SignatureScheme) (H : KeyedHashFamily) (machine : Turing.MultiTapePTM k Bool Control Unit) (n : ℕ) (otsk : List Bool) (limit : ℕ) (word : List Bool) (trace : List TraceStep) :

    Sample one local simulation step on trace, appending ⟨b, k, []⟩ when step trace.length does not query and ⟨b, k, ots⟩ (with ots ← S.sign otsk (otsMsg H n k (H.eval n k msg))) when it queries msg.

    Uniform polynomial upper bound on the machine clock c * ((wordOf n otvk).length + 1) ^ d across all otvk of length at most ckg * (otsParam H n + 1) ^ dkg.

    Saved state passed from tcrMultiAdversary.choose to tcrMultiAdversary.find.

    • active : Bool

      Whether choose sampled a step slot strictly before the machine fuel limit.

    • Verification and signing key pair (pk, sk) sampled once for this execution.

    • coinAtSlot : Bool

      Fair coin bit pre-committed for the target query step.

    • remSteps : ℕ

      Remaining simulation steps after the implanted challenge hash key.

    • preTrace : List TraceStep

      Prefix trace simulated locally before the implanted query step.

    Instances For
      theorem Cslib.Crypto.TCRSignature.TcrSavedState.ext {x y : TcrSavedState} (active : x.active = y.active) (keys : x.keys = y.keys) (coinAtSlot : x.coinAtSlot = y.coinAtSlot) (remSteps : x.remSteps = y.remSteps) (preTrace : x.preTrace = y.preTrace) :
      x = y
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Bool} {x1 : γ → List Bool × List Bool} {x2 : γ → Bool} {x3 : γ → ℕ} {x4 : γ → List TraceStep} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encBool budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBool budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encUnary budget) (h4 : Turing.MultiTapeTM.ComputableInSpace x4 encIn (Turing.MultiTapeTM.encList encTraceStep) budget) :
      Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { active := x0 x, keys := x1 x, coinAtSlot := x2 x, remSteps := x3 x, preTrace := x4 x }) encIn encTcrSavedState budget
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_remSteps_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TcrSavedState} :
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_mk_deg :
      Turing.MultiTapeTM.ComputableInDegree (fun (p : Bool × (List Bool × List Bool) × Bool × ℕ × List TraceStep) => { active := p.1, keys := p.2.1, coinAtSlot := p.2.2.1, remSteps := p.2.2.2.1, preTrace := p.2.2.2.2 }) encTcrSavedStateFields encTcrSavedState 1 1
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_coinAtSlot_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TcrSavedState} :
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_active_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TcrSavedState} :
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Bool} {T0 S0 : γ → ℕ} {x1 : γ → List Bool × List Bool} {T1 S1 : γ → ℕ} {x2 : γ → Bool} {T2 S2 x3 T3 S3 : γ → ℕ} {x4 : γ → List TraceStep} {T4 S4 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encBool T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBool T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encUnary T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO x4 encIn (Turing.MultiTapeTM.encList encTraceStep) T4 S4) :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { active := x0 x, keys := x1 x, coinAtSlot := x2 x, remSteps := x3 x, preTrace := x4 x }) encIn encTcrSavedState (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + T4 x)))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + S4 x)))
      theorem Cslib.Crypto.TCRSignature.encTcrSavedState_preTrace_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → TcrSavedState} :
      noncomputable def Cslib.Crypto.TCRSignature.tcrMultiAdversary {k : ℕ} {Control : Type} (S : SignatureScheme) (H : KeyedHashFamily) (machine : Turing.MultiTapePTM k Bool Control Unit) (ckg dkg c d : ℕ) :

      Many-query two-stage target-collision adversary against H ([BS23], proof of Theorem 13.2, p. 534): choose n samples keys ← S.keyGen (otsParam H n) and a uniform dyadic step index slot ← sampleDyadicIndex (fuelUpper H ckg dkg c d n); when slot < B, it locally simulates slot machine steps via sampleStep, draws the next step coin b, commits the queried message (queryOf machine cfg b).getD [] before hashKey is sampled, and saves the state; find implants the external hashKey at step slot, finishes the remaining B - 1 - slot steps via sampleStep, and outputs the forged message m*.

      theorem Cslib.Crypto.TCRSignature.isPPT_tcrMultiAdversary {k : ℕ} {Control : Type} [Finite Control] (S : SignatureScheme) (H : KeyedHashFamily) (machine : Turing.MultiTapePTM k Bool Control Unit) (ckg dkg c d : ℕ) :
      (tcrMultiAdversary S H machine ckg dkg c d).IsPPT

      Both stages of tcrMultiAdversary are uniformly strict PPT.

      Exact trace coupling and Boneh–Shoup Theorem 13.2 security proof #

      Concrete and asymptotic security theorems ([BS23], Theorem 13.2) #

      theorem Cslib.Crypto.TCRSignature.succProbability_wordScheme_eufCmaGame_le_of_machine {k : ℕ} {Control : Type} (S : SignatureScheme) (H : KeyedHashFamily) (ckg dkg : ℕ) (hpkBound : ∀ (n : ℕ) (pk sk : List Bool), (pk, sk) ∈ (S.keyGen (otsParam H n)).eval.support → pk.length ≤ ckg * (otsParam H n + 1) ^ dkg) (sigBound : ℕ → ℕ) (hsigBound : ∀ (n : ℕ) (pk sk : List Bool), (pk, sk) ∈ (S.keyGen (otsParam H n)).eval.support → ∀ (msg : List Bool), msg.length = otsParam H n → ∀ ots ∈ (S.sign sk msg).eval.support, ots.length ≤ sigBound n) (adversary : Forger) (machine : Turing.MultiTapePTM k Bool Control Unit) (c d : ℕ) (hmachine : ∀ (input : ℕ × List Bool) (State : Type) (oracle : Unit × List Bool → StateT State PMF (List Bool)) (s : State), (OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifOracle m)) oracle) (⇑(Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) <$> adversary input.1 input.2)).run s = (OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifOracle m)) oracle) (machine.runOracle (c * (((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) input).length + 1) ^ d) ((Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) input))).run s) (n : ℕ) :
      Game.succProbability ((wordScheme S H).eufCmaGame adversary n).eval ≤ Game.succProbability (S.eufCmaGame (manyTimeForger H sigBound adversary) (otsParam H n)).eval + ↑(Probability.dyadicSize (fuelUpper H ckg dkg c d n)) * Game.succProbability (targetCollisionGame H.keyLen H.eval (fun (x : ℕ) (x_1 : List Bool) => true) (tcrMultiAdversary S H machine ckg dkg c d) n).eval

      Concrete security bound for TCRSignature.wordScheme with an explicit realizing machine ([BS23], Section 13.2.1, Theorem 13.2, p. 534): at every security parameter n, the adaptive EUF-CMA forging probability against wordScheme S H on unrestricted List Bool messages is at most the SignatureScheme.eufCmaGame forging probability of manyTimeForger against S at otsParam H n plus dyadicSize (fuelUpper H ckg dkg c d n) times the target-collision probability of tcrMultiAdversary against H at n.

      Existential many-query reduction for TCRSignature.wordScheme ([BS23], Section 13.2.1, Theorem 13.2, p. 534): every strict oracle-PPT forger adversary against wordScheme S H induces a strict oracle-PPT forger sigForger against S, a strict PPT two-stage TargetCollisionFinder tcrAdv against H, and a PolynomiallyBounded loss schedule loss bounding adversary's forging probability at every security parameter n.

      Boneh–Shoup Theorem 13.2 ([BS23], Section 13.2.1, p. 534): if S is a secure signature scheme (EUFCMA) and H is target collision resistant, then the derived scheme TCRSignature.wordScheme S H of construction (13.2) (p. 533) is a secure signature scheme, here on messages of any length.

      S is a SignatureScheme, whose message space at security parameter p is the p-bit words. The source's S signs the pairs (r, h) of K_H × T at the same security parameter. Here, at parameter n, the derived scheme runs S at the parameter otsParam H n (injective, computable in polynomial time and above H.keyLen n + H.digestLen n) on the otsParam H n-bit word otsMsg H n r h: r, then h, then zero padding. So the premise S.EUFCMA is Attack Game 13.1 for S on all otsParam H n-bit words, which contain the encoded pairs, and the bound at n uses the advantage against S at otsParam H n, which is negligible in n since otsParam H n ≥ n (TCRSignature.negligible_comp_otsParam). The keys of the derived scheme also carry n; its signature is (r, σ), and verification checks that r has H.keyLen n bits.

      H.TargetCollisionResistant is Attack Game 8.5 and Definition 8.7 (pp. 337–338) with every word a message, and the conclusion is Attack Game 13.1 on every word: security on every message space of polynomially bounded word length at once. Adversaries are uniform strict (oracle) PPT machines. TCRSignature.exists_reduction_wordScheme_eufCmaGame_le gives the certified reductions and the bound, with a polynomially bounded loss in place of the source's factor Q.

      Any EUFCMA-secure WordSignatureScheme implies the existence of a uniform OneWay function.

      Step toward the signatures of [NY89], Section 4, for messages of any length, not the cited result: no inspection of the primary source is recorded (manual/sources.md lists the authors' manuscript without a check), so this statement has not been checked against it (#5293). [BS23], Sections 13.2.1 and 14.6, give the route but state no theorem of this form.

      Any uniform OneWay function and any unrestricted target collision-resistant KeyedHashFamily yield a stateless many-time WordSignatureScheme satisfying EUFCMA on all List Bool messages.

      Step toward the Naor–Yung signature theorem ([NY89], Theorem 2 / Section 4), for messages of any length, not the cited result: no inspection of the primary source is recorded (manual/sources.md lists the authors' manuscript without a check), so this statement has not been checked against it (#5293).

      Every one-way permutation implies the existence of a stateless many-time EUFCMA-secure WordSignatureScheme on arbitrary-length List Bool messages; the extension to all lengths is [BS23], Theorem 13.2 (SignatureScheme.EUFCMA.eufCMA_wordScheme).