Skip to content

proof(xmss): bound a forgery by the adversary's queries and signing requests - #463

Closed
tcoratger wants to merge 1 commit into
ethereum:masterfrom
tcoratger:xmss-query-bound
Closed

tcoratger wants to merge 1 commit into
ethereum:masterfrom
tcoratger:xmss-query-bound

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

This research pull request restates the leanXMSS unforgeability bound in the exact-security form, with the adversary's own hash queries qH and its signing requests qS as separate terms.
The new theorem follows from the existing one, so it makes the cost of a signing request visible but does not make the bound stronger.
It is not meant to be merged before the maintainer has reviewed it.

The problem

Unforgeability.unforgeable bounds a forgery by q / 2^127.
Its q counts every hash call of the worst run of the game: key generation, the signer, the adversary and the final verification.
A reader who sees "127 bits" expects q to count only the adversary's queries.
That is the convention of the exact-security definitions of Bellare and Rogaway (EUROCRYPT 1996, section 2.2).
Their forger makes q_sig signing queries and q_hash hash queries of its own.
With the signer's calls inside q, the cost of each signing request is hidden in the hypothesis.

The idea

Count the calls of each part of the game, then apply the existing bound.

  • MakesAtMost adversary qH qS says that, whatever the public key and the oracle answers, the adversary makes at most qH hash queries and at most qS signing requests.
    It is a VCVio IsQueryBoundP bound on the adversary's own computation.
  • New lemmas bound the hash calls of EthLib's signWith, verifyWith and keyGenWith on every path.
  • A simulation lemma charges each hash query 1 call and each signing request the signer's maximum.

The result is unforgeable_queries:

before:  for every q >= 1 and every adversary whose game makes at most q hash calls in every run,
         Pr[forge] <= q / 2^127

after:   for every adversary with at most qH hash queries and qS signing requests,
         Pr[forge] <= (qH + 8,630,239,199 * qS + 13,435,265) / 2^127

The constant 13,435,265 is key generation's 13,434,881 calls plus verification's 384.
The coefficient 8,630,239,199, about 2^33.007, is the most calls one signing request can make:

  • 2 calls for S and P;
  • on each layer, the randomizer base, up to 2^32 randomizer trials, 29 chain starts, at most 174 chain steps, and a path that rebuilds every sibling subtree;
  • the root of the bottom tree.

Both numbers are proved (signQueries_eq, verifyQueries_eq).

Example

An adversary that makes 2^40 hash queries and requests one signature at each of the 2^32 leaf indices:

  • qH / 2^127 = 2^-87;
  • 8,630,239,199 * 2^32 / 2^127 is about 2^-61.99;
  • so the bound is about 2^-62, as the audit of the current statement found.

An adversary with 2^40 hash queries and no signing request gets about 2^-87.

For reviewers

  • The coefficient of qS is the signer's worst case, not what the adversary learns from a signature.
    The underlying proof charges two units of 2^-128 for every hash call after key generation, the signer's included, and it bounds the number of calls in the worst run.
    So no restatement on top of it can give qS a coefficient much below the signer's worst case.
  • The leanSig paper counts a signing request in the same way.
    Its classical random-oracle bound for the message hash is (q' + 1)/|H| + q' * p * K / |R| with q' = q + p * K, where p is the number of signing queries and K the hash calls of each one (Drake, Khovratovich, Kudinov and Wagner, IACR CiC 2(1), 2025, Table 1 in section 3.1, applied with p = qs in Corollary 2 of section 5.2).
    Its main theorem (Theorem 1, section 4.2) is in the standard model, so only this heuristic table is comparable.
  • In the XMSS-T analysis of Hülsing, Rijneveld and Song (PKC 2016, Table 1 in section 2.2), the classical generic bound of multi-target extended target collision resistance is (q + 1) p / 2^n + q p / 2^k for p targets, the signed messages.
    There too the number of signatures multiplies a term.
  • MakesAtMost quantifies over every oracle answer, not only the answers the game can give.
    That is the usual query-bound convention, and it is stronger than the game needs.
  • The new file lives next to the game and imports it, so no file of the 56,000-line proof is rebuilt.

Checks

  • lake build --wfail EthLib.Cryptography.Proofs.Xmss EthLib.Cryptography.Proofs: success.
  • lake env lean EthLib/Cryptography/Proofs/Xmss/Unforgeability/Queries.lean: 4.0 s, 2.2 GB peak.
  • LEAN_NUM_THREADS=1 lake env leanchecker EthLib.Cryptography.Proofs.Xmss.Unforgeability.Queries: no error, 3.5 GB peak.
  • #print axioms of unforgeable_queries under #guard_msgs: propext, Classical.choice, Quot.sound.
  • lake exe check-decls: 0 findings.
  • scripts/soundness_facts.py --check, scripts/check_layers.py, scripts/check_lean_layout.py on the changed files: pass.

Open questions

  • Is the restated form what decision 17 asks for, or should the pull request also change the proof?
    A bound in which qS has a small coefficient needs the two lanes of the proof to count only the adversary's and the verifier's calls.
    The proof's own outline suggests that the signer's trials raise no bad event of their own.
    A signer trial that lands on a digest the adversary computed is charged to the adversary's query.
    The remaining partner term is quadratic in the number of digest calls, over 2^256.
    That change reaches the trace and hazard machinery of lane 1 and the expected-count bound of lane 2, thousands of lines.
  • An intermediate step would charge the expected number of trials, about 2^20 per layer, instead of 2^32.
    Lane 2 already works with expected counts, but lane 1 bounds hazard queries in the worst run.

🤖 Generated with Claude Code

…equests

The leanXMSS bound q / 2^127 counts in q every hash call of the worst run, the signer's included.
This change restates it in the exact-security form, with the adversary's own hash queries qH and its signing requests qS apart.

An adversary with at most qH hash queries and qS signing requests forges with probability at most (qH + 8,630,239,199 * qS + 13,435,265) / 2^127.
The coefficient of qS is the most hash calls of one signing request, up to 2^32 randomizer trials on each layer included.
The constant is the calls of key generation and of a verification.

The proof bounds the hash calls of EthLib's signer, verifier and key generation on every path, then applies the existing bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added type: proof New or changed theorems, with no change to the library code crypto Cryptography: EthLib/Cryptography crypto: xmss XMSS hash-based signatures docs Markdown documentation proofs Theorems under a Proofs directory labels Nov 19, 2026
@tcoratger

Copy link
Copy Markdown
Collaborator Author

XMSS was removed from EthLib in #5461; the formalization of leanVM, including its hash-based signatures, now lives in https://github.com/leanEthereum/leanVM. Closing this pull request here.

@tcoratger tcoratger closed this Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crypto: xmss XMSS hash-based signatures crypto Cryptography: EthLib/Cryptography docs Markdown documentation proofs Theorems under a Proofs directory type: proof New or changed theorems, with no change to the library code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant