ml_dsa_65.nx
buildroot/runtime/ml_dsa_65.nx
about
ml_dsa_65.nx -- ML-DSA-65 post-quantum digital signature.
NIST FIPS 204 (August 2024). Lattice-based (Module-LWE +
rejection sampling). Drop-in replacement for Ed25519 once
fault-tolerant quantum computers exist -- Ed25519 is broken
by Shor's algorithm.
Parameters (FIPS 204 Table 2, ML-DSA-65 = NIST security
category 3, AES-192 equivalent):
n = 256 polynomial degree
q = 8380417 prime modulus
d = 13 dropped-bits parameter
tau = 49 signing challenge weight
lambda = 192 collision-resistance security parameter
gamma1 = 524288
gamma2 = 261888
(k, l) = (6, 5) matrix dimensions
eta = 4
beta = tau * eta = 196
omega = 55
Key / signature sizes:
public key = 1952 bytes
secret key = 4032 bytes
signature = 3309 bytes
Status (2026-04-23): SKELETON. Same scaffolded-then-filled
approach as ml_kem_768.nx -- API locked so TLS / X.509 / OTR
/ email crypto callers can write against the signatures now;
the NTT + ExpandA + Keccak-streamed sampling core lands as a
separate push (~800 LoC).
Dependencies (pending full impl):
- sha3.nx: SHAKE-256 for ExpandA, ExpandS, challenge c
- rand.nx: 32-byte seed at keygen
- ct.nx: constant-time rejection sampling
Invariants:
DSA1 Output bytes match FIPS 204 Appendix A test vectors.
DSA2 Verify ALWAYS accepts a genuine signature from the
dependencies 1 imports · 0 importers
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 47 | const MLDSA_N: i64 = 256 |
| 48 | const MLDSA_Q: i64 = 8380417 |
| 49 | const MLDSA_D: i64 = 13 |
| 50 | const MLDSA_TAU: i64 = 49 |
| 51 | const MLDSA_LAMBDA: i64 = 192 |
| 52 | const MLDSA_K: i64 = 6 |
| 53 | const MLDSA_L: i64 = 5 |
| 54 | const MLDSA_ETA: i64 = 4 |
| 55 | const MLDSA_BETA: i64 = 196 |
| 56 | const MLDSA_OMEGA: i64 = 55 |
| 58 | const MLDSA_PK_BYTES: i64 = 1952 |
| 59 | const MLDSA_SK_BYTES: i64 = 4032 |
| 60 | const MLDSA_SIG_BYTES: i64 = 3309 |
| 62 | const MLDSA_ERR_PENDING: i64 = -1 |
| 63 | const MLDSA_ERR_RANDOM: i64 = -2 |
| 64 | const MLDSA_ERR_VERIFY: i64 = -3 |
functions
| 67 | func ml_dsa_65_keygen(pk_out: *u8, sk_out: *u8) -> i64 {
called by 1: main |
| 77 | func ml_dsa_65_sign(sk_in: *u8,
called by 1: main |
| 87 | func ml_dsa_65_verify(pk_in: *u8,
called by 1: main |
| 94 | func main() -> i64 { |