STRUCT AKCIPHER_ALG(9)
π struct akcipher_alg(9) β the Kernel API Manual, bestie edition β¨
okay so this page is struct akcipher_alg(9) from the Kernel API Manual, and it's literally the blueprint for a generic public key cipher algorithm β like, the whole personality of an akcipher lives in this struct π
πΈ NAME πΈ
struct akcipher_alg β the generic public key cipher algorithm struct. that's it, that's the whole vibe π
β¨ SYNOPSIS β¨
here's the struct in all its glory, no cap, every member exactly where it belongs π
struct akcipher_alg {
int (*encrypt)(struct akcipher_request *req);
int (*decrypt)(struct akcipher_request *req);
int (*set_pub_key)(struct crypto_akcipher *tfm, const void *key,
unsigned int keylen);
int (*set_priv_key)(struct crypto_akcipher *tfm, const void *key,
unsigned int keylen);
unsigned int (*max_size)(struct crypto_akcipher *tfm);
int (*init)(struct crypto_akcipher *tfm);
void (*exit)(struct crypto_akcipher *tfm);
struct crypto_alg base;
};
π¦ Members π¦
okay, member-by-member tour, bestie β grab a snack π
encryptβ this one does an encrypt operation, as defined by the public key algorithm. and lowkey important: if there's an error wheredst_lenwas insufficient, thenreq->dst_lengets updated to the size required for the operation π so like, it tells you how much room you actually needed.decryptβ same energy, opposite direction: performs a decrypt operation as defined by the public key algorithm. and again, in case of error wheredst_lenwas insufficient,req->dst_lenwill be updated to the size required for the operation πset_pub_keyβ this function invokes the algorithm-specific set public key function, which β and this is the iconic part β knows how to decode and interpret the BER encoded public key and parameters πset_priv_keyβ the sibling: invokes the algorithm-specific set private key function, which knows how to decode and interpret the BER encoded private key and parameters πmax_sizeβ returns the dest buffer size required for a given key. like a little size-check bestie πinitβ initializes the cryptographic transformation object. yes, that's the actual description, and yes it says it again: this function is used to initialize the cryptographic transformation object π and here's the when: it's called only once at the instantiation time, right after the transformation context was allocated. also, if the cryptographic hardware has some special requirements that need to be handled by software, this function shall check for the precise requirement of the transformation and put any software fallbacks in place π§β¨exitβ deinitializes the cryptographic transformation object. it's the counterpart toinit, used to remove the various changes set ininit. the breakup arc, if you will π«Άbaseβ the common crypto API algorithm data structure. the main character foundation, fr fr π
π SEE ALSO π
go read these next, iykyk:
- Kernel file
./include/crypto/akcipher.h struct akcipher_request(9)struct crypto_akcipher(9)Generic Public Key Cipher API(9)crypto_alloc_akcipher(9)crypto_free_akcipher(9)akcipher_request_alloc(9)akcipher_request_free(9)akcipher_request_set_callback(9)akcipher_request_set_crypt(9)crypto_akcipher_maxsize(9)crypto_akcipher_encrypt(9)crypto_akcipher_decrypt(9)crypto_akcipher_sync_encrypt(9)crypto_akcipher_sync_decrypt(9)crypto_akcipher_set_pub_key(9)crypto_akcipher_set_priv_key(9)
that's the whole page, no skips, no crumbs left behind π
and finally, the cute little sign-off: this one lives at ./include/crypto, dated October 2026, and it's struct akcipher_alg(9) β go be a cipher icon bestie ππΈβ¨
π¦ 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