STRUCT KPP_ALG(9)
π struct kpp_alg(9) π
okay so welcome to the Kernel API Manual, bestie β we're talking struct kpp_alg, which is literally the blueprint for generic key-agreement protocol primitives. no cap, it's the whole vibe behind how the kernel does key agreement, and once you get it you're gonna slay.
β¨ NAME β¨
struct kpp_alg β generic key-agreement protocol primitives π«Ά
πΈ SYNOPSIS πΈ
struct kpp_alg {
int (*set_secret)(struct crypto_kpp *tfm, const void *buffer,
unsigned int len);
int (*generate_public_key)(struct kpp_request *req);
int (*compute_shared_secret)(struct kpp_request *req);
unsigned int (*max_size)(struct crypto_kpp *tfm);
int (*init)(struct crypto_kpp *tfm);
void (*exit)(struct crypto_kpp *tfm);
struct crypto_alg base;
};
π MEMBERS π
like, here's the whole cast of function pointers β each one is a main character in their own right:
set_secretβ this one calls the protocol-specific function that stores the secret private key plus its parameters. the implementation is the one that knows how to decodebuffer, so don't come for it πgenerate_public_keyβ generates the public key that gets sent to the counterpart. ok and listen: if there's an error where the output isn't big enough,req->dst_lengets updated to the size required. noted. π¦compute_shared_secretβ computes the shared secret exactly as the algorithm defines it, and the result goes right back to the user. same deal as above: if it errors because the output is too small,req->dst_lengets updated to the size required. πmax_sizeβ returns the size of the output buffer. short and iconic.initβ initializes the object. this gets called only once, at instantiation time β that's the moment, bestie. it's for when the cryptographic hardware needs to be initialized, and any software fallback should be put in place right here. π§exitβ undoes everythinginitdid. the cleanup era. π«§baseβ the common crypto API algorithm data structure. the foundation, the moment, the baseline.
π SEE ALSO π
- kernel file
./include/crypto/kpp.h struct kpp_request(9)struct crypto_kpp(9)Generic Key-agreement Protocol Primitives API(9)crypto_alloc_kpp(9)crypto_free_kpp(9)kpp_request_alloc(9)kpp_request_free(9)kpp_request_set_callback(9)kpp_request_set_input(9)kpp_request_set_output(9)struct kpp_secret(9)crypto_kpp_set_secret(9)crypto_kpp_generate_public_key(9)crypto_kpp_compute_shared_secret(9)crypto_kpp_maxsize(9)
π real talk: this page ships from ./include/crypto and it's dated October 2026 β so yeah, future-coded. anyway bestie, go read the source, ily, bye! πβ¨π
π¦ 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