STRUCT SKCIPHER_ALG(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐ŸŒธ struct skcipher_alg(9) โ€” Kernel API Manual ๐ŸŒธ

okay so bestie, welcome to section 9 of the Kernel API Manual ๐Ÿ’– โ€” we're decoding struct skcipher_alg, and it's literally the blueprint for a symmetric key cipher. no cap, this is the main character struct. let's get into it โœจ

๐ŸŽ€ NAME ๐ŸŽ€

struct skcipher_alg โ€” symmetric key cipher definition. that's the whole assignment: it defines a symmetric key cipher. periodt ๐Ÿ’…

๐ŸŒธ SYNOPSIS ๐ŸŒธ

here's the struct in all its glory โ€” copy-paste safe, bestie:

       struct skcipher_alg {
           int (*setkey)(struct crypto_skcipher *tfm, const u8 *key, unsigned
       int keylen);
           int (*encrypt)(struct skcipher_request *req);
           int (*decrypt)(struct skcipher_request *req);
           int (*export)(struct skcipher_request *req, void *out);
           int (*import)(struct skcipher_request *req, const void *in);
           int (*init)(struct crypto_skcipher *tfm);
           void (*exit)(struct crypto_skcipher *tfm);
           unsigned int walksize;
           union {
             struct SKCIPHER_ALG_COMMON;
             struct skcipher_alg_common co;
           };
        };

โœจ Members โœจ

okay now the member-by-member breakdown, because every single one matters ๐Ÿ‘‘

  • setkey โ€” sets the key for the transformation. This function is used to either program a supplied key into the hardware or store the key in the transformation context for programming it later. Note that this function does modify the transformation context. It can be called multiple times during the existence of the transformation object, so you gotta make sure the key is properly reprogrammed into the hardware. It's also responsible for checking the key length for validity. In case a software fallback was put in place in the cra_init call, this function might need to use the fallback if the algorithm doesn't support all of the key sizes. slay, but carefully ๐Ÿ’…
  • encrypt โ€” encrypts a scatterlist of blocks. This function is used to encrypt the supplied scatterlist containing the blocks of data. The crypto API consumer is responsible for aligning the entries of the scatterlist properly and making sure the chunks are correctly sized. In case a software fallback was put in place in the cra_init call, this function might need to use the fallback if the algorithm doesn't support all of the key sizes. In case the key was stored in transformation context, the key might need to be re-programmed into the hardware in this function. This function shall not modify the transformation context, because it may be called in parallel with the same transformation object. no cap, respect the parallelism ๐Ÿซถ
  • decrypt โ€” decrypts a single block. It's the reverse counterpart to encrypt, and the conditions are exactly the same. matching energy, matching rules โœจ
  • export โ€” exports partial state of the transformation. This function dumps the entire state of the ongoing transformation into a provided block of data so it can be import'ed back later on. It's useful in case you want to save a partial result of the transformation after processing a certain amount of data and reload this partial result multiple times later on for multiple re-use. No data processing happens at this point. it's giving save-game energy ๐Ÿ’พ
  • import โ€” imports partial state of the transformation. This function loads the entire state of the ongoing transformation from a provided block of data so the transformation can continue from this point onward. No data processing happens at this point. load game, resume, periodt ๐ŸŽฎ
  • init โ€” initializes the cryptographic transformation object. This function is used to initialize the cryptographic transformation object. It's called only once at the instantiation time, right after the transformation context was allocated. In case the cryptographic hardware has some special requirements which need to be handled by software, this function shall check for the precise requirement of the transformation and put any software fallbacks in place. one-time setup arc ๐Ÿ‘‘
  • exit โ€” deinitializes the cryptographic transformation object. It's a counterpart to init, used to remove various changes set in init. cleanup queen ๐Ÿงน
  • walksize โ€” equal to the chunk size except in cases where the algorithm is considerably more efficient if it can operate on multiple chunks in parallel. Should be a multiple of chunksize. don't skip the multiple rule, bestie โš ๏ธ
  • {unnamed_union} โ€” anonymous. it's an anonymous union, living its best unnamed life ๐Ÿ’€
  • SKCIPHER_ALG_COMMON โ€” see struct skcipher_alg_common.
  • co โ€” see struct skcipher_alg_common.

๐Ÿ’œ Description ๐Ÿ’œ

All fields except ivsize are mandatory and must be filled.

๐Ÿšจ bestie, real talk: "mandatory" means mandatory. all fields except ivsize must be filled. no ghosting required fields. ๐Ÿ’€

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

go read these too, they're all connected bestie:


that's the whole page, bestie ๐Ÿ’– โ€” source: ./include/crypto, date: October 2026, and the page is struct skcipher_alg(9) from the Kernel API Manual. mwah ๐Ÿ’‹โœจ

๐Ÿ“ฆ where this page comes from