crypto_ecdh_encode_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ crypto_ecdh_encode_key(9) πŸ’œ

okay so bestie, welcome to the Kernel API Manual ✨ β€” this is the page for crypto_ecdh_encode_key, and it's literally the glow-up step where your private key gets turned into its packet form πŸŽ€


🌸 NAME 🌸

crypto_ecdh_encode_key β€” encode the private key πŸ’…


✨ SYNOPSIS ✨

int crypto_ecdh_encode_key (char *buf , unsigned int len , const struct
ecdh *p );

like, that's the whole signature, no cap 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • buf β€” the buffer your caller-self allocated to hold the packet ECDH private key πŸ’– and listen, it should be at least crypto_ecdh_key_len bytes in size, so don't be out here under-sizing it bestie 😭
  • len β€” the length of the packet private key buffer πŸ“
  • p β€” the buffer holding the caller-specified private key πŸ‘‘

⭐ DESCRIPTION ⭐

so the tea is: the ECDH implementations operate on a packet representation of the private key πŸ”₯ that's it, that's the vibe β€” this is the function that gets you there πŸ’«


πŸ“ RETURN πŸ“

  • -EINVAL β€” returned if the buffer has insufficient size πŸ™ˆ (the vibe check failed, the buffer was too small)
  • 0 β€” on success πŸ‘‘ slay

🌈 SEE ALSO 🌈


ngl this one's short and sweet β€” just make sure your buf is big enough before you call it, fr fr 🧚

and that's the page!! πŸŽ€ from ./include/crypto, October 2026, crypto_ecdh_encode_key(9), Kernel API Manual β€” mwah, go encode those keys bestie πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from