Documentation

CslibFrontier.Crypto.Computational.MLDSA.SecretExpansionLaw

The FIPS secret expansion and the short-secret MLWE law #

FIPS 204, Algorithms 15 and 31, read two nibbles per byte and keep the first 256 accepted short coefficients. The accepted positions determine whether the capped sampler fails. On success their values are independently uniform in the same interval used in MLWE.

Algorithm 31 on uniform bytes has an exact two-stage law: test the native prefix for exhaustion, then on success return one independent short-secret MLWE polynomial. This applies at every input length, including the 481-byte Appendix C limit.

theorem Cslib.Crypto.MLDSA.FIPS204.uniformPrefixes_expandS (base : Xofs) (s : Level) (rho : FixedBytes 64) {a b : ℕ} (ha : 528 ≤ a) (hb : 481 ≤ b) :
have R := base.uniformPrefixes a b; PMF.map (fun (H : Xofs) => H.expandS s rho.toList) R = R.bind fun (H : Xofs) => if (H.expandS s rho.toList).isSome = true then (MatrixOracle.shortVectorLaw s s.params.ℓ).bind fun (x : Fin s.params.ℓ → Poly) => PMF.map (fun (y : Fin s.params.k → Poly) => some (x, y)) (MatrixOracle.shortVectorLaw s s.params.k) else PMF.pure none

Algorithm 33 on the finite random SHAKE256 stream at a fixed 64-byte seed has exactly the joint short-secret MLWE law on success. The two vectors use disjoint little-endian nonces. Both sides retain the native failure probability of the 481-byte cap at every nonce.