STRUCT SKCIPHER_ALG(9)
๐ธ 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 thecra_initcall, 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 thecra_initcall, 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 toencrypt, 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 beimport'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 toinit, used to remove various changes set ininit. 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 ofchunksize. don't skip the multiple rule, bestie โ ๏ธ{unnamed_union}โ anonymous. it's an anonymous union, living its best unnamed life ๐SKCIPHER_ALG_COMMONโ seestruct skcipher_alg_common.coโ seestruct 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:
- Kernel file
./include/crypto/skcipher.h struct skcipher_request(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_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)
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
- 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