mldsa_verify(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ 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 check
  • sig_len β€” how long the signature is, in bytes. this should match the MLDSA*_SIGNATURE_SIZE constant that goes with alg, otherwise you get -EBADMSG handed back to you like a sad little note 😭
  • msg β€” the message
  • msg_len β€” the message's length, in bytes
  • pk β€” the public key
  • pk_len β€” how many bytes the public key is. this should match the MLDSA*_PUBLIC_KEY_SIZE constant for alg, or boom, -EBADMSG again πŸ™ˆ
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