STRUCT KPP_ALG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 decode buffer, 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_len gets 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_len gets 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 everything init did. the cleanup era. 🫧
  • base β€” the common crypto API algorithm data structure. the foundation, the moment, the baseline.

🌈 SEE ALSO 🌈


πŸ’€ 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