aes_gcm_encrypt(9)
π aes_gcm_encrypt(9) β the Kernel API Manual, but make it make sense π
okay bestie, so this is a page from the Kernel API Manual and it's all about aes_gcm_encrypt β yes it's giving cryptography, yes it's giving kernel space, and yes we're gonna get through it together. π«Ά
β¨ NAME β¨
aes_gcm_encrypt β Encrypt a message with AES-GCM π
πΈ SYNOPSIS πΈ
void aes_gcm_encrypt (u8 *dst , const u8 *src , size_t data_len , u8
*authtag , const u8 *ad , size_t ad_len , const u8 nonce[static 12] ,
const struct aes_gcm_key *key );
likeβ¦ look at her. ten arguments. main character energy fr fr. π
π ARGUMENTS π
okay so here's the tea on every single one of these, no skipping, we're doing all of them:
dstβ your destination ciphertext data. It can be in-place or out-of-place, whichever vibe you're on. For other overlaps the behavior is unspecified β so like, don't. πsrcβ the source plaintext data. the innocent before-picture.data_lenβ length of plaintext in bytes (and ciphertext excluding the tag): at most2^36 - 32. that's a real number, bestie, respect it. π₯authtagβ the output authentication tag. Its length is theauthtag_lenthat was passed toaes_gcm_preparekey. Usually protocols using AES-GCM put the tag at the end of the ciphertext, in which case this should be set todst + data_lenanddstmust have room for the tag. iykyk. βadβ the associated data.ad_lenβ length of associated data in bytes: at most2^61 - 1. big mood, big number. πnonceβ the 12-byte nonce. and likeβ¦ All (key, nonce) pairs used MUST be distinct. not optional. not a suggestion. this is the whole entire rule. πkeyβ the key, already prepared usingaes_gcm_preparekey. don't bring an unprepared key to this function, she will not know what to do with it. π
π¦ DESCRIPTION π¦
So for AES-GMAC (i.e., AES-GCM without any data en/decrypted), use dst=NULL, src=NULL, and data_len=0 to generate the AES-GMAC value. that's the whole move. iconic. β¨
π CONTEXT π
Any context. that's it. she's flexible. she's everywhere. she's unbothered. π
πΊ SEE ALSO πΊ
go look at these, they're all her friends and they're all important:
- Kernel file
./include/crypto/aes-gcm.h struct aes_gcm_key(9)struct aes_gcm_ctx(9)aes_gcm_preparekey(9)aes_gcm_decrypt(9)aes_gcm_init(9)aes_gcm_auth_update(9)aes_gcm_encrypt_update(9)aes_gcm_decrypt_update(9)aes_gcm_encrypt_final(9)aes_gcm_decrypt_final(9)
aaaand that's the page!! π this little number lives over at ./include/crypto and it's dated October 2026 β yes bestie, the future. you read it here. slay. π
β¨πΈ
π¦ 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