aes_cmac_preparekey(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… aes_cmac_preparekey(9) β€” the Kernel API Manual glow-up

okay bestie so you're in the Kernel API Manual (section 9, kernel space, very demure, very mindful) and you want to prepare a key for AES-CMAC. Say less. πŸŽ€


✨ NAME ✨

aes_cmac_preparekey β€” literally just prepare a key for AES-CMAC, that's the whole vibe 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

int aes_cmac_preparekey (struct aes_cmac_key *key , const u8 *in_key ,
size_t key_len );

look at that signature. iconic. no notes. πŸ’…


πŸ’œ ARGUMENTS πŸ’œ

  • key β€” (output) the key struct you're initializing. it's giving "fill me in bestie" 🫢
  • in_key β€” the raw AES key. the actual key-key. πŸ”₯
  • key_len β€” length of the raw key, in bytes. and ngl, only these three values are supported: AES_KEYSIZE_128, AES_KEYSIZE_192, and AES_KEYSIZE_256. pick one, no freestyling 🚫

🌈 DESCRIPTION 🌈

so on success, the caller should make sure the prepared key gets zeroized at the end of its lifetime β€” like, wipe it, don't leave it lying around. you can do this e.g. by calling aes_cmac_zeroize_key or kfree_sensitive. hydrate, moisturize, zeroize. ✨

seriously though, zeroize it. that's the whole point of the note. 🧚

⭐ CONTEXT ⭐

Any context. yes queen, literally anywhere, no restrictions πŸ’€πŸ‘‘


πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • -EINVAL if the given key length is invalid πŸ™ˆ

and that's it β€” no other errors are possible. so if you're a caller who always passes a valid key length, you don't even need to check for errors. main character energy fr fr. πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/crypto/aes-cbc-macs.h, struct aes_cmac_key(9), aes_cmac_zeroize_key(9), struct aes_cmac_ctx(9), aes_cmac_zeroize_ctx(9), aes_xcbcmac_preparekey(9), aes_cmac_init(9), aes_cmac_update(9), aes_cmac_final(9), aes_cmac(9)

go read the whole aes-cmac cinematic universe, iykyk πŸ“


okay that's the page!! brought to you by the good people at ./include/crypto, dated October 2026 β€” slay, periodt, and don't forget to zeroize your keys πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from