Documentation

CslibFrontier.Crypto.Computational.TreeSignature.Reduction

Stateless tree signature reduction and coin-request interface #

Defines the intermediate lazy tree game lazyTreeGame and the planted-node indexed-forgery reduction indexedForger for the security proof of TreeSignature.scheme ([BS23], Section 14.6.3, Theorem 14.6, p. 600, binary case q = 2). Splitting these definitions and coin-request width/injectivity lemmas out of CslibFrontier.Crypto.Computational.TreeSignature.Security lets the three main proof components (ForgerEfficiency, IdealToLazy, and LazyToIndexed) elaborate in parallel without sharing private imports.

Main definitions #

Main results #

References #

Request lengths, injectivity, and coin/signature budgets #

@[reducible, inline]

Admissible messages signed inside the tree scheme at security parameter n: either outer n-bit user messages or supported node verification keys from S.keyGen n.

theorem Cslib.Crypto.TreeSignature.padRequest_keyInput_injective {M d : ℕ} (hM : 2 * d + 4 ≤ M) {p q : List Bool} (hp : p.length < d) (hq : q.length < d) (h : padRequest M (keyInput p) = padRequest M (keyInput q)) :
p = q
theorem Cslib.Crypto.TreeSignature.padRequest_signInput_injective {M d : ℕ} (hM : 2 * d + 4 ≤ M) {p q : List Bool} {u v : ℕ} (hp : p.length < d) (hq : q.length < d) (hu : u ≤ 1) (hv : v ≤ 1) (h : padRequest M (signInput p u) = padRequest M (signInput q v)) :
p = q ∧ u = v
theorem Cslib.Crypto.TreeSignature.padRequest_keyInput_ne_signInput {M d : ℕ} (hM : 2 * d + 4 ≤ M) {p q : List Bool} {u : ℕ} (hp : p.length < d) (hq : q.length < d) (hu : u ≤ 1) :
theorem Cslib.Crypto.TreeSignature.exists_treeCoinBudget (S : IndexedSignatureScheme) (T : S.Seeded) {depth : ℕ → ℕ} (hdepth : Turing.MultiTapeTM.ComputableInPolyTime depth Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) :
∃ (budget : ℕ → ℕ), Turing.MultiTapeTM.ComputableInPolyTime budget Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary ∧ (∀ (n : ℕ), 2 * depth n + 4 ≤ budget n) ∧ (∀ (n : ℕ), T.keyGenBudget n ≤ budget n) ∧ ∀ (n : ℕ), ∀ keys ∈ (S.keyGen n).eval.support, ∀ u ≤ 1, ∀ (msg : List Bool), TreeMsg S n msg → T.signBudget keys.2 u msg ≤ budget n

Every seeded indexed signature scheme admits a polynomial-time unary coin budget covering all tree request widths (2 * depth n + 4), key-generation budgets, and signing budgets on supported keys and messages (n-bit messages or supported public keys).

theorem Cslib.Crypto.TreeSignature.exists_sigCap_polyTime (S : IndexedSignatureScheme) :
∃ (sigCap : ℕ → ℕ), Turing.MultiTapeTM.ComputableInPolyTime sigCap Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary ∧ ∀ (n : ℕ), ∀ keys ∈ (S.keyGen n).eval.support, ∀ u ≤ 1, ∀ (msg : List Bool), TreeMsg S n msg → ∀ σ ∈ (S.sign keys.2 u msg).eval.support, σ.length ≤ sigCap n

Every indexed signature scheme admits a polynomial-time unary upper bound on the length of every supported signature issued on n-bit messages or supported public keys at index u ≤ 1.

Lazy tree game definitions #

@[reducible, inline]

Association-list cache assigning node paths to pre-sampled slot indices.

@[reducible, inline]

Association-list cache memoizing node keys (pk, sk) by path.

@[reducible, inline]

Association-list cache memoizing signatures by (path, u).

Per-game signing query log shared by the lazy and planted tree handlers: queried messages, sampled leaves, and the leaf-collision abort flag.

  • queried : List (List Bool)

    Messages submitted to the signing oracle (most recent first).

  • seenLeaves : List (List Bool)

    Leaves sampled during non-aborting signing queries (most recent first).

  • bad : Bool

    Sticky abort flag set once a sampled leaf repeats a member of seenLeaves.

Instances For
    theorem Cslib.Crypto.TreeSignature.TreeLog.ext {x y : TreeLog} (queried : x.queried = y.queried) (seenLeaves : x.seenLeaves = y.seenLeaves) (bad : x.bad = y.bad) :
    x = y

    Full signing-handler state pairing an algorithm-specific cache inner : σ with TreeLog.

    • inner : σ

      Algorithm-specific key and signature cache state.

    • log : TreeLog

      Shared signing-query, sampled-leaf, and collision-abort log.

    Instances For
      theorem Cslib.Crypto.TreeSignature.TreeState.ext {σ : Type} {x y : TreeState σ} (inner : x.inner = y.inner) (log : x.log = y.log) :
      x = y
      @[instance_reducible]
      @[instance_reducible]

      Lazily populated node-key and edge-signature caches of lazyTreeGame.

      • nodes : NodeKeyCache

        Memoized (pk, sk) node key pairs indexed by tree path.

      • edges : EdgeSigCache

        Memoized edge signatures indexed by (path, u).

      Instances For
        theorem Cslib.Crypto.TreeSignature.LazyCaches.ext {x y : LazyCaches} (nodes : x.nodes = y.nodes) (edges : x.edges = y.edges) :
        x = y
        @[reducible, inline]

        State of the lazy tree signing handler: node keys, edge signatures, and signing log TreeLog.

        Chain state during certifyLazy: active certification chain paired with LazyCaches.

        • chain : CertState

          Active certification chain along the leaf prefix.

        • caches : LazyCaches

          Lazily populated node-key and edge-signature caches.

        Instances For

          One step of lazy certification along leaf: memoize the child's key from S.keyGen n and memoize the parent's signature on the child's public key from S.sign.

          noncomputable def Cslib.Crypto.TreeSignature.certifyLazy (S : IndexedSignatureScheme) (depth : ℕ → ℕ) (n : ℕ) (root : List Bool × List Bool) (leaf : List Bool) (caches : LazyCaches) :

          Lazily certify the path along leaf from root for depth n - 1 steps.

          Signing handler of lazyTreeGame: check msg.length = n, sample a uniform leaf, abort with [] if a leaf collision occurs (or has already occurred), and otherwise lazily certify the path and sign msg.

          noncomputable def Cslib.Crypto.TreeSignature.lazyTreeGame (S : IndexedSignatureScheme) (depth : ℕ → ℕ) (adversary : Forger) (n : ℕ) :

          Intermediate tree forging game ([BS23], proof of Theorem 14.6): node keys and internal/leaf signatures are sampled lazily from S.keyGen and S.sign, and signing returns [] once any leaf is sampled twice.

          The planted-node reduction (indexedForger) #

          Visited node-to-slot and edge-signature caches of plantedTreeHandler.

          • visited : NodeSlotCache

            Memoized slot assignments (path, slotIdx) for visited tree nodes.

          • edges : EdgeSigCache

            Memoized edge signatures indexed by (path, u).

          Instances For
            @[reducible, inline]

            State of plantedTreeHandler: visited node-to-slot cache, edge-signature cache, and signing log TreeLog.

            Initial state of plantedTreeHandler: the root [] occupies slot 0.

            noncomputable def Cslib.Crypto.TreeSignature.plantNodeKeys (S : IndexedSignatureScheme) (slotBound : ℕ → ℕ) (n target : ℕ) (vk : List Bool) :

            Pre-sample dyadicSize (slotBound n) node key pairs, planting (vk, []) at min target (dyadicSize (slotBound n) - 1).

            Assign path its cached slot or the next available slot min visited.length cap.

            Produce an edge signature at slot idx and index u on msg, querying the external indexed signing oracle when idx = target and running S.sign locally otherwise, capped at sigCap bits.

            noncomputable def Cslib.Crypto.TreeSignature.signEdgeM (S : IndexedSignatureScheme) (keys : List (List Bool × List Bool)) (target sigCap : ℕ) (path : List Bool) (idx u : ℕ) (msg : List Bool) (edges : EdgeSigCache) :

            Memoize signEdgeRaw on (path, u) in edges.

            Certification-chain prefix state referencing node keys by their slot index slot.

            • node : List Bool

              Current tree node path from the root.

            • slot : ℕ

              Pre-sampled key-table slot assigned to node.

            • certificates : List (List Bool × List Bool)

              Certified child public keys and their signatures (childPk, sig) along node.

            Instances For
              theorem Cslib.Crypto.TreeSignature.SlotCertState.ext {x y : SlotCertState} (node : x.node = y.node) (slot : x.slot = y.slot) (certificates : x.certificates = y.certificates) :
              x = y

              Chain state during certifyPlanted: SlotCertState paired with PlantedCaches.

              • Active slot-indexed certification chain along the leaf prefix.

              • caches : PlantedCaches

                Visited node-to-slot and edge-signature caches.

              Instances For

                One step of planted certification along leaf.

                Certify depth n - 1 steps from the root [] at slot 0 using planted keys.

                Signing handler of indexedForgerAt: answer n-bit signing queries along uniform leaves, aborting with [] on leaf collisions, and delegating signatures at slot target to the external indexed signing oracle.

                Extract a candidate indexed forgery (u, m, σ) for the key planted at target from a tree forgery (msg, sig) and the visited-node cache visited: look up the unique path assigned to target, and output either the child-key certificate at depth path.length (when internal) or the final message signature (u, msg, last) (when at depth d - 1).

                noncomputable def Cslib.Crypto.TreeSignature.indexedForgerAt (S : IndexedSignatureScheme) (depth slotBound sigCap : ℕ → ℕ) (adversary : Forger) (target : ℕ) :

                The indexed forger with its challenge verification key planted at slot target.

                noncomputable def Cslib.Crypto.TreeSignature.indexedForger (S : IndexedSignatureScheme) (depth slotBound sigCap : ℕ → ℕ) (adversary : Forger) :

                The indexed forger: sample a uniform dyadic slot target < dyadicSize (slotBound n) and run indexedForgerAt.