aes_cmac_preparekey(9)
π 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, andAES_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 π₯
0on success π-EINVALif 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
- 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