STRUCT LSKCIPHER_ALG(9)
π 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 thecra_initcall, 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 thesivfield shall be as long asivsize + 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 toencryptand 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 toinit, and it's used to remove various changes set ininit. cleanup crew, we appreciate you π§Ήπcoβ seestruct 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:
struct skcipher_request(9)struct skcipher_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_lskcipher_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)
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
- 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