STRUCT LSKCIPHER_ALG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct lskcipher_alg(9) β€” the kernel API manual, but make it make sense

okay bestie, so this page is from the Kernel API Manual and it's literally all about struct lskcipher_alg β€” aka the linear symmetric key cipher definition. yes it's a mouthful, no we're not changing it, it's iconic. πŸŽ€


✨ NAME ✨

struct lskcipher_alg β€” linear symmetric key cipher definition. that's it, that's the vibe. πŸ¦‹


✨ SYNOPSIS ✨

here's the whole struct, laid out exactly like the kernel gods wrote it, no cap:

struct lskcipher_alg {
    int (*setkey)(struct crypto_lskcipher *tfm, const u8 *key, unsigned
int keylen);
    int (*encrypt)(struct crypto_lskcipher *tfm, const u8 *src, u8 *dst,
unsigned len, u8 *siv, u32 flags);
    int (*decrypt)(struct crypto_lskcipher *tfm, const u8 *src, u8 *dst,
unsigned len, u8 *siv, u32 flags);
    int (*init)(struct crypto_lskcipher *tfm);
    void (*exit)(struct crypto_lskcipher *tfm);
    struct skcipher_alg_common co;
 };

like… look at all those function pointers. main character energy from every single one of them πŸ’…


✨ Members ✨

  • setkey β€” sets the key for the transformation, bestie. it's used to either program a supplied key straight into the hardware, or stash the key in the transformation context so you can program it later. and huge heads up: this function does modify the transformation context. also it can be called multiple times over the lifetime of the transformation object, so you gotta make sure the key gets properly reprogrammed into the hardware every time. it's also the one responsible for checking that the key length is valid. and if a software fallback was put in place in the cra_init call, this function might need to use the fallback when the algorithm doesn't support all of the key sizes. multitasking queen ✨
  • encrypt β€” encrypts a number of bytes, literally what it says on the tin. used to encrypt the supplied data. and this one shall not modify the transformation context, because it may be called in parallel with the same transformation object β€” so keep it stateless, okay? 🫢 data may be left over if length is not a multiple of blocks and there is more to come (final == false). the number of left-over bytes should be returned in case of success. also the siv field shall be as long as ivsize + statesize, with the IV placed at the front. the state will be used by the algorithm internally. iykyk 🌸
  • decrypt β€” decrypts a number of bytes. it's the reverse counterpart to encrypt and the conditions are exactly the same. matching set, we love to see it πŸ’–
  • init β€” initialize the cryptographic transformation object. yep, it initializes the cryptographic transformation object (they said it twice, we're keeping it twice). this one is called only once, at the instantiation time, right after the transformation context was allocated. one shot, one opportunity 😭πŸ”₯
  • exit β€” deinitialize the cryptographic transformation object. it's the counterpart to init, and it's used to remove various changes set in init. cleanup crew, we appreciate you πŸ§ΉπŸ’œ
  • co β€” see struct skcipher_alg_common. that's the whole note, she's mysterious like that πŸ™ˆ

🌈 SEE ALSO 🌈

so many links, we're popping off. the kernel file ./include/crypto/skcipher.h, plus:

go read all of them, i believe in you 🫑⭐


okay and the cute little sign-off the page came with: this lives in ./include/crypto, dated October 2026, and the page itself is struct lskcipher_alg(9). slay, go encrypt something responsibly πŸ’…πŸŽ€

πŸ“¦ where this page comes from