ecc_make_pub_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– ecc_make_pub_key(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual ✨ β€” yes, the actual kernel API manual, and yes we're about to talk about computing an ECC public key like it's the most iconic thing that's ever happened to us. this page lives in ecc_make_pub_key(9) land and it's short, it's sweet, and it's lowkey carrying half the crypto stack. πŸŽ€


🌸 NAME 🌸

ecc_make_pub_key β€” compute an ECC public key πŸ’…

like, that's it. that's the whole gig. you give it a private key, it hands you back the corresponding public key. main character energy fr fr.


πŸ¦‹ SYNOPSIS πŸ¦‹

int ecc_make_pub_key (const unsigned int curve_id , unsigned int ndigits
, const u64 *private_key , u64 *public_key );

so the return type is int (we'll get to what it means, don't stress 🫢), and it takes four things. four! we love a manageable function signature.


✨ ARGUMENTS ✨

  • curve_id β€” the id representing the curve to use πŸŒ€ β€” like, which elliptic curve are we doing today bestie, pick one
  • ndigits β€” the curve's number of digits πŸ”’ β€” how many digits long the curve's numbers are, that's the vibe
  • private_key β€” a pregenerated private key for the given curve πŸ” β€” key word pregenerated, meaning it's already been made before you got here, you're not generating it in this function
  • public_key β€” a buffer for storing the generated public key πŸ“¦ β€” this is where the output goes, it's your little gift bag

⭐ RETURN ⭐

0 if the public key was generated successfully πŸŽ‰ β€” slay, everything worked.

a negative value if an error occurred 😭 β€” not slay, but at least it tells you.

ngl, "negative value" is the whole error story here. no fancy named error codes on this page. if it's below zero, something went sideways. periodt. πŸ’€

🧚 SEE ALSO 🧚

okay this is the group chat of related functions and i'm obsessed with how long this list is:

Kernel file ./include/crypto/internal/ecc.h

ecc_swap_digits(9), ecc_digits_from_bytes(9), ecc_is_key_valid(9), ecc_gen_privkey(9), crypto_ecdh_shared_secret(9), ecc_is_pubkey_valid_partial(9), ecc_is_pubkey_valid_full(9), vli_is_zero(9), vli_cmp(9), vli_sub(9), vli_from_be64(9), vli_from_le64(9), vli_mod_inv(9), vli_mod_mult_slow(9), vli_num_bits(9), ecc_alloc_point(9), ecc_free_point(9), ecc_point_is_zero(9), ecc_point_mult_shamir(9)

like genuinely go read those too, they're all doing their little part πŸ’œ


that's the whole page bestie, you ate it up πŸ“ β€” this gem dropped from ./include/crypto/internal in October 2026, mwah πŸ’‹

πŸ“¦ where this page comes from