Documentation

CslibFrontier.Crypto.Computational.MLDSA.MatrixOracle

The Module-LWE key switch for ML-DSA with a public matrix oracle #

The public matrix seed selects an entry of a classical random function. Sampling its first matrix on demand gives the same joint law as planting the challenger's matrix at the published seed and continuing with the resulting cache. The post-key computation receives the unrounded vector so that it can construct the actual public bytes and perform verification. A byte-forgery experiment must implement the adversary view in that computation.

The secret and error are independently uniform coefficientwise on [-η,η], the short-secret law in [BDK+21], §§6.1–6.2.1. This ideal matrix experiment supplies the key switch used by the shared-digest ML-DSA reduction.

Embed the uniform digit indexing [-η,η] as a short coefficient modulo the FIPS modulus.

The short-secret MLWE coefficient law, uniform on the signed interval [-η,η].

One short-secret MLWE polynomial. Its 256 coefficients are independent uniform elements of the interval [-η,η], reduced modulo 8380417.

noncomputable def Cslib.Crypto.MLDSA.FIPS204.MatrixOracle.shortVectorLaw (s : Level) (rows : ℕ) :
PMF (Fin rows → Poly)

The Dilithium short-vector law: every coefficient independently uniform in {-η,…,η}, represented in the negacyclic ring modulo 8380417.

Sample every matrix coefficient independently by a uniform integer below the modulus.

@[simp]

Sampling the matrix coefficientwise gives the uniform matrix law.

@[reducible, inline]

The post-key computation sees the published seed, the matrix, the full vector for rounding and the matrix-oracle cache left by key generation. Its verification algorithm and optional digest-oracle state are supplied by the client.

The key generator samples its short secret and error, obtains its matrix through the public seed oracle and passes the populated cache to the supplied post-key computation.

noncomputable def Cslib.Crypto.MLDSA.FIPS204.MatrixOracle.planted (s : Level) (observe : Observable s) (A : PublicMatrix s) (t : Fin s.params.k → Poly) :

Given the full challenger instance, sample a fresh seed and plant its matrix as the first cache entry. All later oracle and verification operations belong to the same observable.

The post-key computation runs in the real Module-LWE experiment whenever the supplied program realizes its behavior at a planted seed. The seed and short-vector sampling laws and the initial matrix lookup are discharged here for every such program.