Documentation

CslibFrontier.Crypto.Computational.MLDSA.SharedDigest

The ML-DSA key-only game with shared classical matrix and commitment oracles #

For a published rounded byte key, the corrected witness in [BDK+21], §6.2.1, equation (10), has its low component, response and challenge in the columns of [I | A | -t]. The verifier queries its reconstructed commitment, and that commitment times 2γ₂ is the module product of the witness.

Systematic self-target matrix with the standard Hermite right block [A | −t].

Integer lift of the three blocks of a self-target witness, with the challenge last.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.systematic_liftWitness (s : Level) (A : PublicMatrix s) (t : Fin s.params.k → Poly) (y : SelfTargetCandidate s.params) :
(moduleSISMap (systematic s A t) fun (i : Fin (s.params.k + s.params.ℓ + 1)) (j : Fin 256) => ↑(liftWitness s y i j)) = selfTargetMap s.params { A := A, t := t } y.u y.z y.c

Multiplying the three lifted blocks by the systematic matrix gives the full self-target product, including the public-key rounding correction in any corrected low block.

Recover the matrix and full vector from the nonidentity blocks of a systematic instance.

@[simp]

Projecting the nonidentity blocks of the systematic matrix recovers its public-key data.

Key-only byte verification with a classical commitment query. The query contains the message representative and the hinted high commitment on its canonical 2γ₂ grid. The digest bytes in the signature must match the oracle reply exactly.

The concrete SHAKE digest at a grid point, represented by the parameter set's number of bytes. This is the deterministic oracle used to recover the FIPS byte verifier.

Supplying concrete SHAKE replies to the oracle verifier reproduces byte verification at the supplied matrix A (verifyWithExpansion s (fun _ => some A)) on the same byte key, context, message and signature. Concrete Algorithm 3 expands A from the 32-byte public seed via expandA s ([NIST24a], Algorithm 8, line 5, p. 27), so recovering concrete Algorithm 3 specializes this equivalence under successful seed expansion (verifyWithExpansion_encodePublic).

The raw FIPS address of a module product and message representative. Products with the same high bits give the same word.

Inject arbitrary raw hash words into the algebraic oracle. A canonical FIPS word uses its decoded verifier point. Other words use disjoint internal memoization keys.

The raw simulator's address coincides with the algebraic verifier's query.

@[reducible, inline]

A fixed-width message representative and a ring product on the verifier's grid.

The FIPS raw address is injective on full grid points, including its message prefix.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.interpret_verify_congr {m : Type → Type} [Monad m] [LawfulMonad m] {s : Level} (bytes : List Byte) (A : PublicMatrix s) (f : Forgery) (R S : ModuleSIS.SelfTarget.Point s.params.k 256 8380417 → m (FixedBytes (digestBytes s))) (agree : ∀ (p : ModuleSIS.SelfTarget.Point s.params.k 256 8380417), p.1.length = 512 → OnCommitmentGrid s p.2 → R p = S p) :
OracleComp.interpret R (verify s bytes A f) = OracleComp.interpret S (verify s bytes A f)

The byte verifier only queries canonical grid points with a 512-bit message prefix.

@[reducible, inline]

Adversary with saved private randomness and a joint interface for matrix-seed and commitment-digest queries.

Saved randomness used by the two runs of the fork. Every query has a fresh independent matrix available, and cached seeds keep their original answer.

  • coins : Coins

    The forger's private coins.

  • seed : FixedBytes 32

    Public matrix seed sampled independently of the challenge.

  • matrices : List (PublicMatrix s)

    An independent matrix for each query position up to the forger's budget.

Draw private coins, a fresh matrix seed, and Q independent responses from the matrix sampler. The default samples exactly uniform matrices.

Read the corrected systematic self-target vector and message from the final byte forgery. A malformed opening maps to the zero vector.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.accepts_extract_of_verify {s : Level} (rho : FixedBytes 32) (A : PublicMatrix s) (t : Fin s.params.k → Poly) (reply : ModuleSIS.SelfTarget.Point s.params.k 256 8380417 → FixedBytes (digestBytes s)) (f : Forgery) (accept : OracleComp.interpret reply (verify s (encodePublic s rho.toList t) A f) = true) :
have y := extract s { A := A, t := t } (encodePublic s rho.toList t) f; have v := ModuleSIS.SelfTarget.product (systematic s A t) y.2; (y.1.length = 512 ∧ OnCommitmentGrid s v) ∧ ModuleSIS.SelfTarget.accepts (expandDigest s) (compressedSelfTargetRadius s.params 13) y.2 (reply (y.1, v)) = true

Fixed-table extraction from an accepted byte output. The verifier checks the complete digest, and the last witness coordinate is the Algorithm 29 expansion of that very digest. The adversary that produced the bytes may have accessed its table coherently.

Run the byte-key adversary on the original matrix seed and rounded bytes while it queries the same digest oracle as the final self-target check.

def Cslib.Crypto.MLDSA.FIPS204.SharedDigest.distinguisherFromSaved {Coins : Type} (s : Level) (saved : ProbComp (Saved s Coins)) (adv : Forger s Coins) (A : PublicMatrix s) (t : Fin s.params.k → Poly) :

Run the byte forger and verifier on a full Module-LWE challenge with the indicated distribution of private coins, a public seed, and saved matrix answers. Their digest cache is shared through verification.

def Cslib.Crypto.MLDSA.FIPS204.SharedDigest.distinguisher {Coins : Type} (s : Level) (Q : ℕ) (coins : ProbComp Coins) (adv : Forger s Coins) (A : PublicMatrix s) (t : Fin s.params.k → Poly) :

The Module-LWE distinguisher with independent, exactly uniform auxiliary matrices.

noncomputable def Cslib.Crypto.MLDSA.FIPS204.SharedDigest.observe {Coins : Type} (s : Level) (coins : ProbComp Coins) (adv : Forger s Coins) :

Run the byte forger and final digest check with the matrix cache left by key generation and an initially empty digest cache. Both share all digest entries throughout the trial.

@[reducible, inline]

The raw classical matrix-seed and digest-word interfaces.

@[reducible, inline]

Classical byte forgers may query the digest at arbitrary bit strings.

Run a raw byte forger using one algebraic-oracle query for each raw-word query.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.pointForger_bounded {Coins : Type} {s : Level} {adv : RawForger s Coins} {bytes : List Byte} {r : Coins} {Q : ℕ} (h : (adv bytes r).IsQueryBounded Q) :
(pointForger s adv bytes r).IsQueryBounded Q
noncomputable def Cslib.Crypto.MLDSA.FIPS204.SharedDigest.observeRaw {Coins : Type} (s : Level) (coins : ProbComp Coins) (adv : RawForger s Coins) :

The raw classical game runs the verifier on the same digest cache as the adversary. Both use the literal untagged FIPS commitment string.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.observeRaw_eq {Coins : Type} (s : Level) (coins : ProbComp Coins) (adv : RawForger s Coins) :
observeRaw s coins adv = observe s coins (pointForger s adv)

Exact raw-address simulation, including the final byte check, unrestricted adaptive queries, repeated words and words outside the FIPS commitment grid.

The Hermite instance obtained by prefixing the identity to a single uniform right block.

Independent uniform draws of A,t produce precisely the standard Hermite distribution.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.keyOnlyGame_eq_moduleLWE_realGame {Coins : Type} (s : Level) (Q : ℕ) (coins : ProbComp Coins) (adv : Forger s Coins) (hQ : ∀ (bytes : List Byte) (r : Coins), (adv bytes r).IsQueryBounded Q) :

The real Module-LWE challenge with the explicit distinguisher reproduces the entire online key-only acceptance law, including adaptive seed lookups and continued verification with the digest cache. The query bound justifies presampling the reduction's matrix tape.

def Cslib.Crypto.MLDSA.FIPS204.SharedDigest.kernelSolver {Coins : Type} (s : Level) (Q : ℕ) (saved : ProbComp (Saved s Coins)) (adv : Forger s Coins) (B : Matrix (Fin s.params.k) (Fin (s.params.ℓ + 1)) Poly) :
ProbComp (Fin (s.params.k + s.params.ℓ + 1) → Fin 256 → ℤ)

Replay the two forgeries on a Hermite right block. Each of the two tapes has Q + 1 independent FIPS digests, and both runs use the same adversary coins and matrix tape.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.keyOnly_le_moduleLWE_add_fork {Coins : Type} (s : Level) (Q : ℕ) (coins : ProbComp Coins) (rawAdv : RawForger s Coins) (hQ : ∀ (bytes : List Byte) (r : Coins), (rawAdv bytes r).IsQueryBounded Q) :

Raw-word classical key-only forgery is bounded by short-secret MLWE, a two-run Hermite Module-SIS experiment and the collision probability of concrete Algorithm 29 on SHAKE256 digests. Its only bound here is one. A final digest lookup covers a forgery on a fresh point.

theorem Cslib.Crypto.MLDSA.FIPS204.SharedDigest.keyOnly_le_moduleLWE_add_fork_fairMatrices {Coins : Type} (s : Level) (Q attempts : ℕ) (coins : ProbComp Coins) (rawAdv : RawForger s Coins) (hQ : ∀ (bytes : List Byte) (r : Coins), (rawAdv bytes r).IsQueryBounded Q) :
have adv := pointForger s rawAdv; have radius := compressedSelfTargetRadius s.params 13; have saved := sampleSaved s Q coins (MatrixOracle.sampleMatrixFair s attempts); ((MatrixOracle.realKeyGame s (observeRaw s coins rawAdv)) true).toReal ≤ ↑(Q * s.params.k * s.params.ℓ * 256) * (8191 / 8388608) ^ attempts + (↑(ModuleLWE.advantage (MatrixOracle.shortVectorLaw s s.params.ℓ) (MatrixOracle.shortVectorLaw s s.params.k) (distinguisherFromSaved s saved adv)) + (↑(Q + 1) / 256 ^ digestBytes s + √(↑(Q + 1) * ((ModuleSIS.hermiteExperiment (2 * radius) (kernelSolver s Q saved adv)).eval true + ModuleSIS.SelfTarget.collisionMass (expandDigest s)).toReal)))

Classical key-only reduction with bounded fair-bit sampling of every auxiliary matrix. The Q-entry matrix tape is drawn once and replayed across the fork. The challenger supplies the matrix at the public seed. Only the change from the real online oracle to the bounded distinguisher incurs a statistical loss.