ECDH_COMPUTE_KEY(3)
okay bestie, welcome to ECDH_COMPUTE_KEY(3) from the Library Functions Manual β this is the elliptic-curve key-exchange glow-up you didnβt know you needed π
β¨
π NAME π
ECDH_compute_key,ECDH_sizeβ Elliptic Curve Diffie-Hellman key exchange
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/ec.h>
int
ECDH_compute_key(void *out, size_t outlen, const EC_POINT *public_key,
EC_KEY *ecdh,
void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
int
ECDH_size(const EC_KEY *ecdh);
π¦ DESCRIPTION π¦
okay so ECDH_compute_key() performs Elliptic Curve Diffie-Hellman key agreement. it combines the private key contained in ecdh with the other partyβs public_key, takes the x component of the affine coordinates, and optionally applies the key derivation function KDF. then it stores the resulting symmetric key in the buffer out, which is outlen bytes long. if KDF is NULL, outlen must be at least ECDH_size(ecdh). no cap, that part matters π
ECDH_size() returns the number of bytes needed to store an affine coordinate of a point on the elliptic curve used by ecdh, which is one eighth of the degree of the finite field underlying that elliptic curve, rounded up to the next integer number. itβs giving very specific math girlie and honestly? iconic π₯
πΈ RETURN VALUES πΈ
ECDH_compute_key()returns the length of the computed key in bytes or-1if an error occurs.ECDH_size()returns the number of bytes needed to store an affine coordinate.
π SEE ALSO π
π§ HISTORY π§
ECDH_compute_key() first appeared in OpenSSL 0.9.8 and has been available since OpenBSD 4.5.
ECDH_size() first appeared in OpenBSD 6.1.
byeee, this page is from Debian, dated June 8, 2025 β stay cryptographic, bestie π«Άπ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms