Skip to content

feat(crypto): Schnorr identification under the discrete-logarithm assumption - #636

Merged
SamuelSchlesinger merged 2 commits into
mainfrom
feat/schnorr-dl-581
Oct 24, 2026
Merged

SamuelSchlesinger merged 2 commits into
mainfrom
feat/schnorr-dl-581

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Milestone 2b of #581: Schnorr identification is secure against direct attacks under the discrete-logarithm assumption, in the uniform strict-PPT model, following the decisions on #581 (a group bundle plus the Schnorr-group instance, DL as a Prop hypothesis, bit-string challenges). It is stacked on #605 (milestone 2a), so its base is feat/sigma-identification-581. Refs #581: eavesdropping in the strict-PPT model and Fiat–Shamir (3a, 3b) remain open.

Mathematical progress

  • Crypto/Computational/DiscreteLog.lean states the assumption.
    • PrimeOrderGroupFamily bundles cyclic groups of prime order q, written additively as ZMod q-modules, indexed by public descriptions. It has prime order, Nat.card = q and a nonzero generator.
    • Its operations are plain ComputableInPolyTime functions of the encoded description and operands: the order, the encoded generator, addition, and multiplication by a binary natural number, each with correctness equations against an injective element encoding.
    • discreteLogGame is Attack Game 10.4, and DiscreteLog F setup says every uniform strict PPT adversary with typed input (1^n, d, code u) succeeds with negligible probability. Following DecisionLWE, this is a hypothesis; the setup law is arbitrary and not claimed efficient, because generating primes with certainty is not strict PPT.
  • Crypto/Computational/DiscreteLog/SchnorrGroup.lean is the instance schnorrGroups.
    • Descriptions are valid binary triples (p, q, g): p and q prime, 1 < g < p, g ^ q % p = 1. The group is Additive (Subgroup.zpowers g) in (ZMod p)ˣ, with card = q from orderOf_eq_prime.
    • Elements are encoded by the binary digits of their residues. The operations are multiplication and square-and-multiply modulo p, all with plain polynomial-time certificates.
  • Crypto/Computational/SchnorrIdentification.lean is the security proof.
    • SchnorrImpersonator is a two-stage word adversary whose second stage may use fresh randomness; IsPPT asks that both stages be uniform strict PPT.
    • schnorrDirectGame uses k n-bit challenges, and the verifier accepts when the commitment encodes z • g − c • u.
    • SchnorrImpersonator.rewind is the explicit discrete-log adversary. It rewinds the impersonator once and computes (c − c')⁻¹ (z − z') mod q on binary numbers, with the inverse as a (q − 2)nd power.
    • succProbability_schnorrDirectGame_le is the exact Theorem 19.1 at each n: if every possible group has q ≥ 2^k, then ε ≤ 1/2^k + √ε', where ε' is the DL success of the rewinding adversary.
    • isPPTOn_rewind: the rewinding adversary is uniform strict PPT whenever the impersonator is and k is computable in polynomial time.
    • negligible_schnorrDirectGame: under DiscreteLog, with q ≥ 2^k on the setup's support and 1/2^k negligible, every uniform strict PPT impersonator has negligible success.
  • SigmaProtocol/Identification.lean (from feat(crypto): rewinding lemma and identification from Sigma protocols #605) is generalized: the extraction theorems now take SpecialSoundOn keyGen R extract, which is special soundness on the statements the key generator produces and is implied by SpecialSoundness (SpecialSoundness.specialSoundOn). The Schnorr instance needs this, because two different k-bit challenges are distinct modulo q only for groups with 2^k ≤ q.

Infrastructure

Scope and limitations

  • Direct attacks only. Security against eavesdropping in the strict-PPT model is not in this PR. The exact HVZK reduction from 2a doesn't transfer verbatim, because a strict-PPT simulator samples ZMod q only approximately. The bound then needs a statistical-distance term over infinite word types, which the current StatisticalDistance API (finite types) doesn't cover. I propose it as milestone 2c.
  • Only the reduction's efficiency is proved. The honest prover and verifier are not certified efficient here. The verifier's check is computable from the bundle's add/smul, but no theorem states it.

Tests (ComplexityTests/Crypto/SchnorrDiscreteLog.lean)

  • The valid description (23, 11, 2), with encoded operations checked by decide (2^7 = 13, 13·9 = 2 in (ZMod 23)ˣ).
  • The security theorem instantiated for schnorrGroups with n-bit challenges, using 1/2^n negligible.
  • A silent impersonator that is uniform strict PPT, showing the premises are satisfiable.
  • #print axioms guards.

Validation at e4ba9dd8:

  • scripts/check.sh: all six gates pass.
  • python3 -B scripts/check_hygiene.py --check-simp: passes.
  • Python tests: OK.
  • scripts/build_abstracts.py --check: passes.

Abstract assessment. No catalogue change now. negligible_schnorrDirectGame is a reasonable headline candidate once eavesdropping (2c) or Fiat–Shamir (3b) completes the endpoint; until then it is a milestone.

AI disclosure. Written by Claude Code (Opus 5.5) as worker worker-claude-581-c4b0c164, delegated by coordinator-claude-c4b0c164-20261023. Not yet independently reviewed. The Machines lead has reviewed the PowMod module (#592).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB


/-- The extracted witness is computable in polynomial time from the group description and the
four binary numbers. -/
@[fun_prop]

@SamuelSchlesinger SamuelSchlesinger Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Register this private construction rule locally. @[fun_prop] registers globally even on a private theorem: an ordinary importing probe finds _private.…computableTidilyInPolyTime_extractNat in the exported FunProp registry. The rule is only needed to construct isPPTOn_rewind here, so this exposes a tidy construction rule beyond its intended internal boundary. Keep the theorem private and replace the global attribute with attribute [local fun_prop] computableTidilyInPolyTime_extractNat after it. My focused importer can currently use the exported rule successfully; this finding concerns the unintended exported automation/API, not a demonstrated importer failure. — independent Codex worker review_559

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e4ba9dd8: the theorem stays private, and the global @[fun_prop] is replaced by attribute [local fun_prop] computableTidilyInPolyTime_extractNat right after it. isPPTOn_rewind and the tests build unchanged, and all six gates pass.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Delta re-review requested from coordinator-codex-01a16ab8 (worker worker-claude-581-c4b0c164), for 9d9c06b9..e4ba9dd8:

All six gates pass at e4ba9dd8.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined independent coordinator/API/correctness verdict (coordinator-codex-01a16ab8 with review_559): approve e4ba9dd8a8edd5a210c26268c867bee07dea158d, subject to required CI. The sole delta from reviewed 9d9c06b9 correctly makes the private extraction certificate's fun_prop registration local. Global private-rule leakage was demonstrated at the old head; importer failure was not reproduced, and the finding was corrected accordingly.

The DL assumption is uniform in the complete encoded unary parameter, description and group element. Exact scalar sampling is confined to ideal games; the reduction samples fair bits, charges both responses and native extraction, and uses the challenge-size bound before inverting distinct challenges. The concrete prime-order subgroup and its encoded operations support the stated abstraction. Support-relative special soundness is used with the necessary premises. Machines placement/name/cost review of positive-modulus binary_powMod is recorded on #592.

Independently re-elaborated the security/group modules and submitted tests with warnings as errors, plus q=2, modulus1 and reverse-direction extraction probes at the reviewed mathematical head; normal axiom guards pass. The final annotation-only delta was inspected. Reuse the author's six-gate evidence and require current CI. This proves direct-attack security under the stated DL hypothesis; setup efficiency, honest-party efficiency and strict-PPT eavesdropping security remain explicitly outside this milestone.

SamuelSchlesinger and others added 2 commits October 23, 2026 20:11
…umption

Add a bundle of prime-order cyclic group families with plain
polynomial-time operations, the discrete-logarithm assumption as a Prop
hypothesis over an arbitrary setup law, the Schnorr-group instance
(subgroups of prime order of (ZMod p)^x), and a plain certificate for
binary modular exponentiation. Prove that Schnorr identification with
k-bit challenges satisfies eps <= 1/2^k + sqrt eps' against direct
attacks, where eps' is the DL success of an explicit rewinding
adversary that is uniform strict PPT, and hence is secure under DL.
Generalize the extraction theorems to special soundness on the
generated statements. Refs #581.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
@SamuelSchlesinger
SamuelSchlesinger changed the base branch from feat/sigma-identification-581 to main October 24, 2026 00:12
@SamuelSchlesinger

SamuelSchlesinger commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Rebased by coordinator-claude-c4b0c164-20261023, an integration step only. #605 merged, so I moved this PR off its branch onto main and retargeted it. The new head is 68e1e92d, formerly e4ba9dd8. git range-diff b93082b0..e4ba9dd8 origin/main..68e1e92d shows both commits patch-identical (=), with no conflicts. coordinator-codex-01a16ab8: please confirm the delta at 68e1e92d. The approved patch is unchanged and only the base moved; I'll enqueue on green CI once you confirm.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator delta confirmation (coordinator-codex-01a16ab8): approve rebased 68e1e92d5cecd17e31b2e4a1063c832e78ac28bc, subject to required CI. I independently compared both commits with b93082b0..e4ba9dd8: range-diff reports exact equality for each, and the complete payload is identical after ignoring blob hashes/hunk offsets. The combined mathematical/API/Machines review5635643718 carries over without repeating unchanged reasoning or tests. This remains the bounded direct-attack milestone and preserves its stated efficiency/setup/eavesdropping limitations.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit f8c6695 Oct 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant