aes_ccm_encrypt(9)
π aes_ccm_encrypt(9) β the Kernel API Manual, bestie edition π
okay so. this is aes_ccm_encrypt, and it lives in the Kernel API Manual (yes, the kernel, we're fancy now). it encrypts a message with AES-CCM. that's the whole vibe. β¨
πΈ NAME πΈ
aes_ccm_encrypt β encrypt a message with AES-CCM. that's it, that's the function, she's iconic and she encrypts. π₯
π¦ SYNOPSIS π¦
int aes_ccm_encrypt (u8 *dst , const u8 *src , size_t data_len , u8
*authtag , const u8 *ad , size_t ad_len , const u8 *nonce , size_t
nonce_len , const struct aes_ccm_key *key );
look at her. nine arguments. she's that girl. π
π ARGUMENTS π
dstβ the destination ciphertext data, where the encrypted glow-up lands. she can be in-place or out-of-place, no drama. but for other overlaps? the behavior is unspecified, so like... don't. πsrcβ the source plaintext data. the before picture. πdata_lenβ length of plaintext in bytes (and yes, also the ciphertext length excluding the tag). the cap is at most2^(120 - (8 * nonce_len)) - 1. write that down, it's giving math. πauthtagβ the output authentication tag. her length is theauthtag_lenthat was passed toaes_ccm_preparekey. usually protocols using AES-CCM put the tag at the end of the ciphertext, and in that case you should set this todst + data_lenβ anddstmust have room for the tag. plan ahead, bestie. π«Άadβ the associated data. the plus-one that doesn't get encrypted but is very much part of the group chat. πad_lenβ length of associated data in bytes. βnonceβ the nonce. and listen: all(key, nonce)pairs used MUST be distinct. MUST. it's in caps, so you know it's serious. no cap. π¨nonce_lenβ length of the nonce in bytes: between 7 and 13 inclusive. outside that range? she's not doing it. πkeyβ the key, already prepared usingaes_ccm_preparekey. don't hand her a raw key, she's not doing that today. π§
π CONTEXT π
Any context. literally anywhere, she doesn't mind, lowkey the most flexible friend in the crypto header. π
π RETURN π
0on success β ate, no notes π-EINVALifnonce_lenis invalid β the nonce length vibe check failed π-EOVERFLOWifdata_lenis too large for the selectednonce_lenβ too much data, not enough nonce energy π
β¨ SEE ALSO β¨
Kernel file ./include/crypto/aes-ccm.h, plus the whole aes-ccm friend group β struct aes_ccm_key(9), struct aes_ccm_ctx(9), aes_ccm_preparekey(9), aes_ccm_decrypt(9), aes_ccm_init(9), aes_ccm_auth_update(9), aes_ccm_encrypt_update(9), aes_ccm_decrypt_update(9), aes_ccm_encrypt_final(9), aes_ccm_decrypt_final(9). go say hi, they're all in the same header and they're all slaying. π¦π
and that's the page!! brought to you by ./include/crypto, October 2026 β mwah, love u, go encrypt responsibly πβ¨π
π¦ 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