crypto_cipher_setkey(9)
π crypto_cipher_setkey π
okay so bestie, welcome to crypto_cipher_setkey(9) β that's section 9 of the Kernel API Manual, and yes we're in kernel-land now, put your seatbelt on π
β¨ NAME β¨
crypto_cipher_setkey β set key for cipher π
πΈ SYNOPSIS πΈ
int crypto_cipher_setkey (struct crypto_cipher *tfm , const u8 *key ,
unsigned int keylen );
that's literally the whole signature, no cap. three things go in, one int comes out π
π¦ ARGUMENTS π¦
tfmβ the cipher handle, aka your main character struct, thestruct crypto_cipher *you're working with π«Άkeyβ the buffer holding the key. that's it, that's the buffer,const u8 *keylenβ length of the key in bytes, anunsigned int, very demure, very mindful
π DESCRIPTION π
so the way this works: the caller-provided key gets set for the single block cipher referenced by the cipher handle. one key, one cipher, slay β¨
note note note π the key length determines the cipher type. like, it literally decides who the cipher is that day.
many block ciphers implement different cipher modes depending on the key size β the iconic example being AES-128 vs AES-192 vs. AES-256 π₯ so when you provide a 16 byte key for an AES cipher handle, AES-128 is performed. periodt. 16 bytes = AES-128, that's the vibe check π
π RETURN π
0β yay! the setting of the key was successful π< 0β uh oh bestie, an error occurred π (literally anything less than zero)
π§ SEE ALSO π§
- Kernel file
./include/crypto/internal/cipher.hπ Single Block Cipher API(9)crypto_alloc_cipher(9)crypto_free_cipher(9)crypto_has_cipher(9)crypto_cipher_blocksize(9)crypto_cipher_encrypt_one(9)crypto_cipher_decrypt_one(9)
go read all of them, iykyk π¦
okay that's the whole page, mwah π big kiss to ./include/crypto/internal, dated October 2026, filed under crypto_cipher_setkey(9) β and that's on periodt ππ
π¦ 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