When ML-DSA Signing Quietly Goes Deterministic: The Entropy Fallback Nobody Reviews

The ML-DSA misconfiguration that keeps coming back is not a memory bug or a timing leak. It is a signer that, when the entropy source fails, swaps the per-signature randomness for a constant and keeps going. Every signature it produces still verifies, every test still passes, and the change usually lands in a Cargo manifest or a wrapper crate that no cryptographer ever reads.

How hedged signing degrades without an error

The NIST post-quantum signature standards, FIPS 204 for ML-DSA in particular, define hedged signing as the default. A fresh 256-bit rnd value goes into the derivation of the per-signature mask, alongside the secret key material and the message representative. The deterministic variant is the same algorithm with rnd fixed to zero. That is why the fallback is so easy to write and so hard to catch: a wrapper that catches an error from getrandom, or a feature flag that routes signing through a seeded test RNG, produces output that matches the specification byte for byte, and no verifier anywhere can tell the difference. What you lose is fault resistance. With rnd fixed, signing the same message twice repeats the same internal computation, and that repetition is exactly what differential fault attacks and some power analysis need. Rust's memory safety makes no difference here, because nothing unsafe is happening: the code does what it was configured to do.

Why it survives code review

Cargo unifies features across every crate built together, so a test helper crate or a benchmarking member of the workspace that turns on a deterministic or seeded RNG feature can change how the release binary signs, even though nobody touched the signing code. The reviewer looks at the diff, sees a dev convenience in an unrelated Cargo.toml, and approves it. The other common route is a retry wrapper written for availability: an SRE notices that signing fails during early boot on minimal VMs, before the kernel entropy pool is ready, and adds a fallback so the service does not crash. That reads as a resilience fix. In practice it turns a loud, recoverable outage into a silent loss of a security property that will never page anyone.

A detection step you can run today

Use one key to sign the same message twice through the exact code path production uses, in a build with release features, and compare the two signatures: in hedged mode they must differ, so identical output means your signer is deterministic, whatever the configuration claims. Run it as a smoke test after deploy, and run it in CI against the release artifact, not the test profile, because feature unification differs between the two. Next to that, run cargo tree in its inverted feature view on your ML-DSA crate and fail the build if any feature name containing deterministic, seed or test turns up in the release graph. Neither check needs access to internals, so both work on a vendored library you cannot modify.

The decision rule is simple: signing fails closed when entropy is unavailable, the deterministic variant is reachable only through an explicit allowlisted build target, and keeping the service up during an entropy stall is handled by queueing or by draining traffic to healthy instances, never by weakening the signature. The cost is real: on cold-start-heavy fleets you will see signing requests stall or error during boot (roughly the first few seconds on minimal images, as an estimate), and someone will ask for the fallback again, so the probe above needs to stay in CI permanently, not just run once.

Is deterministic ML-DSA ever the right configuration?

Yes, on platforms with no trustworthy entropy source and no exposure to physical fault injection, or when reproducible signatures are a hard audit requirement. Even then it should be a deliberate build target with its own name, never something a failed RNG call falls back to at runtime.

Back to MLDSASafe · Domains

← Back to MLDSASafe
Engineering & Architecture Brief

When ML-DSA Signing Quietly Goes Deterministic: The Entropy Fallback Nobody Reviews

The ML-DSA misconfiguration that keeps coming back is not a memory bug or a timing leak. It is a signer that, when the entropy source fails, swaps the per-signature randomness for a constant and keeps going. Every signature it produces still verifies, every test still passes, and the change usually lands in a Cargo manifest or a wrapper crate that no cryptographer ever reads.

How hedged signing degrades without an error

The NIST post-quantum signature standards, FIPS 204 for ML-DSA in particular, define hedged signing as the default. A fresh 256-bit rnd value goes into the derivation of the per-signature mask, alongside the secret key material and the message representative. The deterministic variant is the same algorithm with rnd fixed to zero. That is why the fallback is so easy to write and so hard to catch: a wrapper that catches an error from getrandom, or a feature flag that routes signing through a seeded test RNG, produces output that matches the specification byte for byte, and no verifier anywhere can tell the difference. What you lose is fault resistance. With rnd fixed, signing the same message twice repeats the same internal computation, and that repetition is exactly what differential fault attacks and some power analysis need. Rust's memory safety makes no difference here, because nothing unsafe is happening: the code does what it was configured to do.

Why it survives code review

Cargo unifies features across every crate built together, so a test helper crate or a benchmarking member of the workspace that turns on a deterministic or seeded RNG feature can change how the release binary signs, even though nobody touched the signing code. The reviewer looks at the diff, sees a dev convenience in an unrelated Cargo.toml, and approves it. The other common route is a retry wrapper written for availability: an SRE notices that signing fails during early boot on minimal VMs, before the kernel entropy pool is ready, and adds a fallback so the service does not crash. That reads as a resilience fix. In practice it turns a loud, recoverable outage into a silent loss of a security property that will never page anyone.

A detection step you can run today

Use one key to sign the same message twice through the exact code path production uses, in a build with release features, and compare the two signatures: in hedged mode they must differ, so identical output means your signer is deterministic, whatever the configuration claims. Run it as a smoke test after deploy, and run it in CI against the release artifact, not the test profile, because feature unification differs between the two. Next to that, run cargo tree in its inverted feature view on your ML-DSA crate and fail the build if any feature name containing deterministic, seed or test turns up in the release graph. Neither check needs access to internals, so both work on a vendored library you cannot modify.

The decision rule is simple: signing fails closed when entropy is unavailable, the deterministic variant is reachable only through an explicit allowlisted build target, and keeping the service up during an entropy stall is handled by queueing or by draining traffic to healthy instances, never by weakening the signature. The cost is real: on cold-start-heavy fleets you will see signing requests stall or error during boot (roughly the first few seconds on minimal images, as an estimate), and someone will ask for the fallback again, so the probe above needs to stay in CI permanently, not just run once.

Technical FAQ: Is deterministic ML-DSA ever the right configuration?

Yes, on platforms with no trustworthy entropy source and no exposure to physical fault injection, or when reproducible signatures are a hard audit requirement. Even then it should be a deliberate build target with its own name, never something a failed RNG call falls back to at runtime.

Related Architecture Specifications (PQCECOSYSTEM): mlkemcert.com · mlkemsec.com · otacrypt.com

More Technical Articles on mldsasafe.com

Benchmarking Bootloader Verification Delays: ML-DSA vs SLH-DSA vs Classical RSA-3072 →Remote Attestation for Sovereign Cloud Hyperscalers Using Post-Quantum TPM Quotes →The Cargo Feature That Quietly Turns Off Hedged ML-DSA Signing →The ML-DSA fallback that keeps the dashboard green →ML-DSA Reference Architecture: Aligning Memory-Safe Implementations with FIPS 204, LAMPS X.509 Profiles and ACVP Validation →