Derive the DH shared secret with NIST SP 800‐56A leading‐zero padding (deprecated).

Synopsis

Declared in <openssl/dh.h>

[[deprecated]]
int
DH_compute_key_padded(
    unsigned char* key,
    BIGNUM const* pub_key,
    DH* dh);
Warning

Deprecated. Use of this entity is allowed but discouraged.

Description

Like DH_compute_key() but always writes DH_size(dh) bytes, retaining leading zeros (constant‐time w.r.t. the secret length). Prefer EVP_PKEY_derive for new code.

Return Value

DH_size(dh) on success, or ‐1 on error.

Parameters

Name

Description

key

Output buffer of at least DH_size(dh) bytes.

pub_key

Peer public value.

dh

DH object holding the private key and domain parameters.

Created with MrDocs