summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/DH_generate_key.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/DH_generate_key.3')
-rw-r--r--src/lib/libcrypto/man/DH_generate_key.371
1 files changed, 71 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/DH_generate_key.3 b/src/lib/libcrypto/man/DH_generate_key.3
new file mode 100644
index 0000000000..6e2edbadb3
--- /dev/null
+++ b/src/lib/libcrypto/man/DH_generate_key.3
@@ -0,0 +1,71 @@
1.Dd $Mdocdate: November 2 2016 $
2.Dt DH_GENERATE_KEY 3
3.Os
4.Sh NAME
5.Nm DH_generate_key ,
6.Nm DH_compute_key
7.Nd perform Diffie-Hellman key exchange
8.Sh SYNOPSIS
9.In openssl/dh.h
10.Ft int
11.Fo DH_generate_key
12.Fa "DH *dh"
13.Fc
14.Ft int
15.Fo DH_compute_key
16.Fa "unsigned char *key"
17.Fa "BIGNUM *pub_key"
18.Fa "DH *dh"
19.Fc
20.Sh DESCRIPTION
21.Fn DH_generate_key
22performs the first step of a Diffie-Hellman key exchange by generating
23private and public DH values.
24By calling
25.Fn DH_compute_key ,
26these are combined with the other party's public value to compute the
27shared key.
28.Pp
29.Fn DH_generate_key
30expects
31.Fa dh
32to contain the shared parameters
33.Sy dh->p
34and
35.Sy dh->g .
36It generates a random private DH value unless
37.Sy dh->priv_key
38is already set, and computes the corresponding public value
39.Sy dh->pub_key ,
40which can then be published.
41.Pp
42.Fn DH_compute_key
43computes the shared secret from the private DH value in
44.Fa dh
45and the other party's public value in
46.Fa pub_key
47and stores it in
48.Fa key .
49.Fa key
50must point to
51.Fn DH_size dh
52bytes of memory.
53.Sh RETURN VALUES
54.Fn DH_generate_key
55returns 1 on success, 0 otherwise.
56.Pp
57.Fn DH_compute_key
58returns the size of the shared secret on success, -1 on error.
59.Pp
60The error codes can be obtained by
61.Xr ERR_get_error 3 .
62.Sh SEE ALSO
63.Xr dh 3 ,
64.Xr DH_size 3 ,
65.Xr ERR_get_error 3 ,
66.Xr rand 3
67.Sh HISTORY
68.Fn DH_generate_key
69and
70.Fn DH_compute_key
71are available in all versions of SSLeay and OpenSSL.