Documentation

CslibFrontier.Crypto.Computational.MLDSA.SignedMatrix

The uniform Module-SIS matrix in a seeded ML-DSA signing experiment #

FIPS 204, Algorithm 6 derives the matrix address from a separate SHAKE256 seed expansion. Conditional on that expansion, installing an external uniform matrix in the SHAKE128 prefixes preserves the joint law of the raw oracle, both generated keys and the matrix recovered from the published bytes. Both experiments retain key-generation errors.

succProbability_forgery_le_newDigest_add_collision_add_msis bounds the full classical strong-forgery event in this matrix-prefix experiment. It leaves successes on a new digest as one event and computes a SHAKE256 collision or a short vector on the supplied uniform matrix for the remaining successes. All signing queries and direct reads of either XOF share these streams. The fresh-digest probability, the ambient XOF distribution and the solver's resource costs remain to be bounded for an end-to-end result.

theorem Cslib.Crypto.MLDSA.FIPS204.uniform_keyGen_programMatrixPrefixes (H : Xofs) (s : Level) (seed : FixedBytes 32) :
have rho := List.take 32 (H.expandKeySeed s seed); PMF.map (fun (x : MatrixPrefixes s × PublicMatrix s) => match x with | (t, A) => have G := H.withMatrixPrefixes s rho (programMatrixPrefixes s t A); (G, Option.map (fun (keys : KeyPair) => (A, keys)) (G.keyGen s seed))) (Probability.PMF.uniformOfFintype (MatrixPrefixes s × PublicMatrix s)) = PMF.map (fun (t : MatrixPrefixes s) => have G := H.withMatrixPrefixes s rho t; (G, do let keys ← G.keyGen s seed let A ← G.expandA s (List.take 32 keys.publicKey) pure (A, keys))) (Probability.PMF.uniformOfFintype (MatrixPrefixes s))

Draw an external uniform coefficient matrix and program the literal SHAKE128 matrix addresses derived by Algorithm 6. The joint law of the entire XOF, both byte keys and the external matrix agrees with running key generation on fresh matrix prefixes and recovering the matrix from its published seed. All remaining streams are fixed in both experiments.

Public data used to check a final forgery after the signed execution.

  • xofs : Xofs

    Shared raw SHAKE128 and SHAKE256 oracles.

  • matrix : PublicMatrix s

    Matrix at the seed in the public key.

  • publicKey : List Byte

    Actual encoded public key.

  • forgery : Forgery

    Output of the signing forger.

  • Successful responses returned by the signer, with their original messages and contexts.

Public calls available to the adaptive classical adversary. XOF inputs are raw bit strings, and the requested output length counts bytes.

Signing may fail, while a raw XOF request returns the requested output bytes.

@[reducible, inline]

A classical forger gets the published bytes and can interleave signing, raw XOF reads and private randomness.

Answer direct reads from the same raw streams as the signer and verifier, forwarding each signing call unchanged.

Sample the seed and the SHAKE128 matrix prefixes at its derived public address. The entire shared XOF and optional setup are retained for subsequent signing and public queries.

Install the given coefficient matrix by programming the literal FIPS SHAKE128 addresses before key generation. Draw all 32 seed bytes and the 894-byte prefixes explicitly.

Averaging over the supplied matrix reproduces the complete seeded setup, including errors.

theorem Cslib.Crypto.MLDSA.FIPS204.keyGen_of_mem_programmedMatrixSetup {H G : Xofs} {s : Level} {A B : PublicMatrix s} {keys : KeyPair} (h : (G, some (B, keys)) ∈ (programmedMatrixSetup H s A).eval.support) :
G.h256 = H.h256 ∧ B = A ∧ (∃ (seed : FixedBytes 32), G.keyGen s seed = some keys) ∧ G.expandA s (List.take 32 keys.publicKey) = some A

Every successful programmed setup returns the supplied matrix at the published seed and a key pair generated with its accompanying XOFs. SHAKE256 remains the original stream.

Run the adaptive classical forger after sampling the actual random matrix prefixes.

Simulate the signed execution on an externally supplied coefficient matrix.

On a uniform Hermite right block, the program produces exactly the joint transcript law of the seeded byte signer, including the raw XOFs, final forgery and all failed setups.

Recover the integer vector from an extracted MSIS witness; all other outcomes return zero.

The ordinary Module-SIS solver for the repeated-digest branch. It runs the signed transcript on its given right block and returns the extracted integer vector. The fallback zero vector fails the nonzero test in the source experiment.

The strong chosen-message win event on the completed trial.

The full digest of the output is present in a successful signing reply.

A strong forgery whose full digest is absent from the signing log.

Run the log extractor and check its two raw inputs at the full FIPS digest length in the same SHAKE256 oracle that answered verification and signing.

A fresh accepting byte triple either uses a new digest or the concrete log extractor returns a raw collision or a short vector against the published matrix.

Average the three outcomes of SignedMatrixTrial.cases_of_win on a uniform right block. Both the classical signing program and the retained quantum execution use this counting step.

In the experiment with fresh SHAKE128 matrix prefixes, bound the whole strong forgery event by the remaining fresh-digest event, a computed SHAKE256 collision and success of an explicit solver on a uniform Hermite Module-SIS matrix. All signing and public hash queries are adaptive classical queries to the same streams.