code wiki / (root) / nx_ml_dsa_65.nx

nx_ml_dsa_65.nx

buildroot/runtime/nx_ml_dsa_65.nx

3935 B116 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic ml
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_ml_dsa_65.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap ml_dsa_65_keygen ml_dsa_65_sign ml_dsa_65_verify

structs

none

consts

57const MLDSA_N: i64 = 256
58const MLDSA_Q: i64 = 8380417
59const MLDSA_D: i64 = 13
60const MLDSA_TAU: i64 = 49
61const MLDSA_LAMBDA: i64 = 192
62const MLDSA_K: i64 = 6
63const MLDSA_L: i64 = 5
64const MLDSA_ETA: i64 = 4
65const MLDSA_BETA: i64 = 196
66const MLDSA_OMEGA: i64 = 55
68const MLDSA_PK_BYTES: i64 = 1952
69const MLDSA_SK_BYTES: i64 = 4032
70const MLDSA_SIG_BYTES: i64 = 3309
72const MLDSA_ERR_PENDING: i64 = -1
73const MLDSA_ERR_RANDOM: i64 = -2
74const MLDSA_ERR_VERIFY: i64 = -3

functions

77func ml_dsa_65_keygen(pk_out: *u8, sk_out: *u8) -> i64
called by 1: main
87func ml_dsa_65_sign(sk_in: *u8,
called by 1: main
97func ml_dsa_65_verify(pk_in: *u8,
called by 1: main
104func main() -> i64