.\" $OpenBSD: dh.3,v 1.3 2016/11/06 15:57:38 schwarze Exp $ .\" .Dd $Mdocdate: November 6 2016 $ .Dt DH 3 .Os .Sh NAME .Nm dh .Nd Diffie-Hellman key agreement .Sh SYNOPSIS .In openssl/dh.h .Sh DESCRIPTION These functions implement the Diffie-Hellman key agreement protocol. The generation of shared DH parameters is described in .Xr DH_generate_parameters 3 ; .Xr DH_generate_key 3 describes how to perform a key agreement. .Pp The .Vt DH structure consists of several .Vt BIGNUM components. .Bd -literal typedef struct { BIGNUM *p; // prime number (shared) BIGNUM *g; // generator of Z_p (shared) BIGNUM *priv_key; // private DH value x BIGNUM *pub_key; // public DH value g^x // ... } DH; .Ed .Pp Note that DH keys may use non-standard .Vt DH_METHOD implementations, either directly or by the use of .Vt ENGINE modules. In some cases (e.g. an .Vt ENGINE providing support for hardware-embedded keys), these .Vt BIGNUM values will not be used by the implementation or may be used for alternative data storage. For this reason, applications should generally avoid using .Vt DH structure elements directly and instead use API functions to query or modify keys. .Sh SEE ALSO .Xr bn 3 , .Xr d2i_DHparams 3 , .Xr DH_generate_key 3 , .Xr DH_generate_parameters 3 , .Xr DH_get_ex_new_index 3 , .Xr DH_new 3 , .Xr DH_set_method 3 , .Xr DH_size 3 , .Xr DHparams_print 3 , .Xr dsa 3 , .Xr DSA_dup_DH 3 , .Xr engine 3 , .Xr ERR 3 , .Xr rsa 3