summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/man/DH_generate_key.3
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2016-11-02 09:11:53 +0000
committerschwarze <schwarze@openbsd.org>2016-11-02 09:11:53 +0000
commit526c24c9561000760f09a3cb68d9208ff462ee44 (patch)
tree4ed3827df1ce7f786a0d156d23856a4e1bfda206 /lib/libcrypto/man/DH_generate_key.3
parentpoison the TAILQ_ENTRY in items in the per cpu pool cache. (diff)
downloadwireguard-openbsd-526c24c9561000760f09a3cb68d9208ff462ee44.tar.xz
wireguard-openbsd-526c24c9561000760f09a3cb68d9208ff462ee44.zip
convert DES and DH manuals from pod to mdoc
Diffstat (limited to 'lib/libcrypto/man/DH_generate_key.3')
-rw-r--r--lib/libcrypto/man/DH_generate_key.371
1 files changed, 71 insertions, 0 deletions
diff --git a/lib/libcrypto/man/DH_generate_key.3 b/lib/libcrypto/man/DH_generate_key.3
new file mode 100644
index 00000000000..6e2edbadb3e
--- /dev/null
+++ b/lib/libcrypto/man/DH_generate_key.3
@@ -0,0 +1,71 @@
+.Dd $Mdocdate: November 2 2016 $
+.Dt DH_GENERATE_KEY 3
+.Os
+.Sh NAME
+.Nm DH_generate_key ,
+.Nm DH_compute_key
+.Nd perform Diffie-Hellman key exchange
+.Sh SYNOPSIS
+.In openssl/dh.h
+.Ft int
+.Fo DH_generate_key
+.Fa "DH *dh"
+.Fc
+.Ft int
+.Fo DH_compute_key
+.Fa "unsigned char *key"
+.Fa "BIGNUM *pub_key"
+.Fa "DH *dh"
+.Fc
+.Sh DESCRIPTION
+.Fn DH_generate_key
+performs the first step of a Diffie-Hellman key exchange by generating
+private and public DH values.
+By calling
+.Fn DH_compute_key ,
+these are combined with the other party's public value to compute the
+shared key.
+.Pp
+.Fn DH_generate_key
+expects
+.Fa dh
+to contain the shared parameters
+.Sy dh->p
+and
+.Sy dh->g .
+It generates a random private DH value unless
+.Sy dh->priv_key
+is already set, and computes the corresponding public value
+.Sy dh->pub_key ,
+which can then be published.
+.Pp
+.Fn DH_compute_key
+computes the shared secret from the private DH value in
+.Fa dh
+and the other party's public value in
+.Fa pub_key
+and stores it in
+.Fa key .
+.Fa key
+must point to
+.Fn DH_size dh
+bytes of memory.
+.Sh RETURN VALUES
+.Fn DH_generate_key
+returns 1 on success, 0 otherwise.
+.Pp
+.Fn DH_compute_key
+returns the size of the shared secret on success, -1 on error.
+.Pp
+The error codes can be obtained by
+.Xr ERR_get_error 3 .
+.Sh SEE ALSO
+.Xr dh 3 ,
+.Xr DH_size 3 ,
+.Xr ERR_get_error 3 ,
+.Xr rand 3
+.Sh HISTORY
+.Fn DH_generate_key
+and
+.Fn DH_compute_key
+are available in all versions of SSLeay and OpenSSL.