crypto_aead_decrypt(9)
π crypto_aead_decrypt β Kernel API Manual
okay bestie, buckle up, we're doing kernel crypto today β¨ this is crypto_aead_decrypt(9), straight out of the Kernel API Manual, and honestly? she's iconic.
πΈ NAME πΈ
crypto_aead_decrypt β decrypt ciphertext. that's it. that's the whole job. she decrypts. π
π SYNOPSIS π
int crypto_aead_decrypt (struct aead_request *req );
π¦ ARGUMENTS π¦
reqβ a reference to theaead_requesthandle that's holding all the info needed to actually run the cipher operation. think of it as the little purse π carrying everything the crypto op needs. no purse, no decrypt, periodt.
β¨ DESCRIPTION β¨
so what does she do? she decrypts ciphertext data using that aead_request handle. the whole deal with that data structure β like, how it gets filled up with data in the first place β is discussed over with the aead_request_* functions. go read those if you're lost, iykyk. π«Ά
β οΈ IMPORTANT NOTE β οΈ the caller must concatenate the ciphertext followed by the authentication data / tag. and that authentication data / tag has to have the size defined by the crypto_aead_setauthsize invocation. no cap, if you get this order or size wrong, the auth check is gonna fail and you're gonna have a bad time. π
π₯ RETURN π₯
0β cipher operation was successful, slay, we ate. π-EBADMSGβ so here's the thing: an AEAD cipher operation performs authentication of the data during the decryption operation. that means this error comes back when the authentication of the ciphertext was unsuccessful β i.e. the integrity of the ciphertext or the associated data was violated. π somebody tampered with something, or something got messed up.< 0β if an error occurred. any other negative value, basically. it's giving "something went wrong, check your vibes." π
π SEE ALSO π
go read the kernel file ./include/crypto/aead.h and the Authenticated Encryption With Associated Data (AEAD) Cipher API(9), plus all these besties:
struct aead_request(9)struct aead_alg(9)crypto_alloc_aead(9)crypto_free_aead(9)crypto_has_aead(9)crypto_aead_ivsize(9)crypto_aead_authsize(9)crypto_aead_blocksize(9)crypto_aead_setkey(9)crypto_aead_setauthsize(9)crypto_aead_encrypt(9)- Asynchronous AEAD Request Handle(9)
crypto_aead_reqsize(9)aead_request_set_tfm(9)aead_request_alloc(9)aead_request_free(9)aead_request_set_callback(9)aead_request_set_crypt(9)aead_request_set_ad(9)
and that's the whole page, bestie π§β¨ this one came from ./include/crypto, dated October 2026, in the Kernel API Manual β literally stamped and everything. go forth and decrypt 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