ECDH_compute_key

Perform ECDH and optionally apply a KDF to the shared secret (deprecated).

Synopsis

Declared in <openssl/ec.h>

[[deprecated]]
int
ECDH_compute_key(
    void* out,
    size_t outlen,
    EC_POINT const* pub_key,
    EC_KEY const* ecdh,
    void*(* KDF)(void const*, size_t, void*, size_t*));

WARNING

Deprecated. Use of this entity is allowed but discouraged.

Return Value

Number of bytes written to out on success, or 0 on error.

Parameters

NameDescription
outBuffer that receives the derived key material (or KDF output).
outlenSize of out in bytes; also passed to KDF as initial output capacity.
pub_keyPeer's public EC point.
ecdhLocal private EC_KEY used for the agreement.
KDFOptional key-derivation callback; if NULL, copies min(outlen, secret length) raw shared secret bytes into out.