crypto_lskcipher_setkey(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… crypto_lskcipher_setkey(9) β€” like, the kernel API manual page, bestie ✨

Okay so this is a page from the Kernel API Manual, and the function we're talking about is crypto_lskcipher_setkey β€” yes the (9) is part of the name, that's just how kernel docs do πŸŽ€


✨ NAME ✨

crypto_lskcipher_setkey β€” set the key for a cipher, that's the whole vibe πŸ”‘


🌸 SYNOPSIS 🌸

int crypto_lskcipher_setkey (struct crypto_lskcipher *tfm , const u8
*key , unsigned int keylen );

Like, it returns an int, bestie, and you hand it three things β€” periodt πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • tfm β€” the cipher handle, your main character 🫢
  • key β€” the buffer holding the key, no cap πŸ”‘
  • keylen β€” length of the key, in bytes (yes, bytes, don't come at me with bits πŸ’€)

πŸ‘‘ DESCRIPTION πŸ‘‘

So the caller-provided key gets set for the lskcipher that's referenced by the cipher handle. That's it. That's the whole thing ✨

But wait β€” important lore: the key length literally determines the cipher type. It's giving "your key's size is its whole personality" ngl. Many block ciphers implement different cipher modes depending on the key size β€” iconic examples 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 what gets performed. Sixteen bytes in, AES-128 out, slay πŸ’–


⭐ RETURN ⭐

  • 0 if setting the key was successful πŸŽ‰
  • < 0 if an error occurred 😭

🌈 SEE ALSO 🌈

So here's the whole friendship group, literally all of them, in the order the page gives them β€” and I mean the Kernel file reference too, don't skip it πŸ™ˆ

Kernel file ./include/crypto/skcipher.h, struct skcipher_request(9), struct skcipher_alg(9), struct lskcipher_alg(9), Symmetric Key Cipher API(9), crypto_alloc_skcipher(9), crypto_alloc_lskcipher(9), crypto_free_skcipher(9), crypto_free_lskcipher(9), crypto_has_skcipher(9), crypto_skcipher_ivsize(9), crypto_lskcipher_ivsize(9), crypto_skcipher_blocksize(9), crypto_lskcipher_blocksize(9), crypto_skcipher_chunksize(9), crypto_lskcipher_chunksize(9), crypto_skcipher_statesize(9), crypto_lskcipher_statesize(9), crypto_skcipher_setkey(9), crypto_skcipher_reqtfm(9), crypto_skcipher_encrypt(9), crypto_skcipher_decrypt(9), crypto_skcipher_export(9), crypto_skcipher_import(9), crypto_lskcipher_encrypt(9), crypto_lskcipher_decrypt(9), Symmetric Key Cipher Request Handle(9), crypto_skcipher_reqsize(9), skcipher_request_set_tfm(9), skcipher_request_alloc(9), skcipher_request_free(9), skcipher_request_set_callback(9), skcipher_request_set_crypt(9)


okay that's the whole page, mwah πŸ’‹ This one's from the ./include/crypto source, dated October 2026 β€” so yeah, remember to cite her correctly, iykyk πŸ§šπŸ’œ

πŸ“¦ where this page comes from