mldsa_verify(9)
π mldsa_verify β bestie's guide to checking an ML-DSA signature
okay so real talk, this is mldsa_verify from the kernel API manual (section 9, kernel-space girlies only β¨), and it does exactly one thing: it checks whether an ML-DSA signature actually checks out. no cap, that's the whole gig.
β¨ SYNOPSIS β¨
int mldsa_verify (enum mldsa_alg alg , const u8 *sig , size_t sig_len ,
const u8 *msg , size_t msg_len , const u8 *pk , size_t pk_len );
that's the whole vibe β seven args, one int back. she's thorough π
π ARGUMENTS π
algβ the ML-DSA parameter set you're rolling with. pick your fighter πsigβ the signature itself, the thing we're literally here to checksig_lenβ how long the signature is, in bytes. this should match theMLDSA*_SIGNATURE_SIZEconstant that goes withalg, otherwise you get-EBADMSGhanded back to you like a sad little note πmsgβ the messagemsg_lenβ the message's length, in bytespkβ the public keypk_lenβ how many bytes the public key is. this should match theMLDSA*_PUBLIC_KEY_SIZEconstant foralg, or boom,-EBADMSGagain π
double-check those two lengths against the constants before you even call her. it's giving "preventable heartbreak."
πΈ DESCRIPTION πΈ
so this verifies a signature using pure ML-DSA with whichever parameter set you passed in. the context string is assumed to be empty β no ctx content in here, don't come looking for one π«Ά
it maps directly onto FIPS 204 Algorithm 3 "ML-DSA.Verify", with the ctx parameter set to the empty string, and with the signature and key lengths handed in explicitly by you, the caller. so like, you're the one holding the measuring tape, bestie πβ¨
π¦ CONTEXT π¦
might sleep π΄
(that's it. that's the whole context. plan accordingly.)
π₯ RETURN π₯
0β the signature is valid. slay. iconic. ate and left no crumbs π-EBADMSGβ the signature and/or the public key is malformed. something's shaped wrong, not just wrong-wrong π-EKEYREJECTEDβ the signature is invalid but otherwise well-formed. it's shaped right, it's just lying to you π-ENOMEMβ out of memory, so the validity of the signature is unknown. not a yes, not a no, just vibes (bad ones) π
heads up: -ENOMEM means you literally cannot conclude anything about whether the signature is good. don't treat it as a fail, and definitely don't treat it as a pass, fr fr.
π SEE ALSO π
- Kernel file
./include/crypto/mldsa.hβ go read it, iykyk π§
okay that's the whole page, you're officially educated π this was written down from ./include/crypto land, October 2026 vintage β go verify responsibly, mwah π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms