aes_gcm_encrypt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 most 2^36 - 32. that's a real number, bestie, respect it. πŸ”₯
  • authtag β€” the output authentication tag. Its length is the authtag_len that was passed to aes_gcm_preparekey. Usually protocols using AES-GCM put the tag at the end of the ciphertext, in which case this should be set to dst + data_len and dst must have room for the tag. iykyk. ⭐
  • ad β€” the associated data.
  • ad_len β€” length of associated data in bytes: at most 2^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 using aes_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:


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