aes_gcm_decrypt_final(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… aes_gcm_decrypt_final(9) β€” like, the finale of your AES-GCM decrypt arc

Okay bestie, welcome to aes_gcm_decrypt_final, straight out of the Kernel API Manual (section 9, kernel API, iykyk). This is the last little step when you're decrypting a message with AES-GCM and you need to check the vibe β€” er, the authentication tag β€” before you trust anything you just decrypted. ✨


✨ SYNOPSIS ✨

int aes_gcm_decrypt_final (struct aes_gcm_ctx *ctx , const u8 *authtag
);

That's the whole signature, no cap. Returns an int, takes your context and the tag. Simple. Iconic. πŸŽ€


🌸 ARGUMENTS 🌸

  • ctx β€” An AES-GCM context. Like, the whole state of your operation lives in here, and spoiler alert: it's about to get zeroized (more on that in a sec πŸ‘€).
  • authtag β€” The stored authentication tag. And its length? It's the authtag_len that was passed to aes_gcm_preparekey. So whatever length you told aes_gcm_preparekey about back at the start, that's the length here. Matching energy only, fr fr. πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

This is the "wrap it up" call β€” you finish decrypting and it checks your authentication tag.

And here's the cute little bonus: this also zeroizes ctx, so the caller doesn't need to do it. The function cleans up after itself. Main character energy, honestly. 🧹✨


🌈 CONTEXT 🌈

Any context. Literally any. No restrictions, go off. 🫢


⭐ RETURN ⭐

  • 0 on success. And listen β€” this is the only case where any decrypted or associated data can be used. Like, periodt. If you didn't get 0, that data stays in the group chat unsent. πŸ’€
  • -EBADMSG if the message is inauthentic. Not authentic, not usable, do not pass go. πŸ™ˆ
Bestie please internalize this: if the return value isn't 0, the decrypted data is not trustworthy. That's the whole point of the authentication tag. Don't be out here using unverified plaintext. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

All the siblings in the AES-GCM family, plus the header they live in:


πŸ’œ Okay that's the whole page, bestie β€” go forth and verify your tags. This lil' cutie came from ./include/crypto, dated October 2026, and it's filed under aes_gcm_decrypt_final(9). Slay, stay safe, and always check your return value. πŸŽ€βœ¨πŸ”₯

πŸ“¦ where this page comes from