summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/dh.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/dh.3')
-rw-r--r--src/lib/libcrypto/man/dh.3148
1 files changed, 148 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/dh.3 b/src/lib/libcrypto/man/dh.3
new file mode 100644
index 0000000000..2a8f172e2b
--- /dev/null
+++ b/src/lib/libcrypto/man/dh.3
@@ -0,0 +1,148 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt DH 3
3.Os
4.Sh NAME
5.Nm dh
6.Nd Diffie-Hellman key agreement
7.Sh SYNOPSIS
8.In openssl/dh.h
9.In openssl/engine.h
10.Ft DH *
11.Fn DH_new void
12.Ft void
13.Fo DH_free
14.Fa "DH *dh"
15.Fc
16.Ft int
17.Fo DH_size
18.Fa "const DH *dh"
19.Fc
20.Ft DH *
21.Fo DH_generate_parameters
22.Fa "int prime_len"
23.Fa "int generator"
24.Fa "void (*callback)(int, int, void *)"
25.Fa "void *cb_arg"
26.Fc
27.Ft int
28.Fo DH_check
29.Fa "const DH *dh"
30.Fa "int *codes"
31.Fc
32.Ft int
33.Fo DH_generate_key
34.Fa "DH *dh"
35.Fc
36.Ft int
37.Fo DH_compute_key
38.Fa "unsigned char *key"
39.Fa "BIGNUM *pub_key"
40.Fa "DH *dh"
41.Fc
42.Ft void
43.Fo DH_set_default_method
44.Fa "const DH_METHOD *meth"
45.Fc
46.Ft const DH_METHOD *
47.Fn DH_get_default_method void
48.Ft int
49.Fo DH_set_method
50.Fa "DH *dh"
51.Fa "const DH_METHOD *meth"
52.Fc
53.Ft DH *
54.Fo DH_new_method
55.Fa "ENGINE *engine"
56.Fc
57.Ft const DH_METHOD *
58.Fn DH_OpenSSL void
59.Ft int
60.Fo DH_get_ex_new_index
61.Fa "long argl"
62.Fa "char *argp"
63.Fa "int (*new_func)()"
64.Fa "int (*dup_func)()"
65.Fa "void (*free_func)()"
66.Fc
67.Ft int
68.Fo DH_set_ex_data
69.Fa "DH *d"
70.Fa "int idx"
71.Fa "char *arg"
72.Fc
73.Ft char *
74.Fo DH_get_ex_data
75.Fa "DH *d"
76.Fa "int idx"
77.Fc
78.Ft DH *
79.Fo d2i_DHparams
80.Fa "DH **a"
81.Fa "unsigned char **pp"
82.Fa "long length"
83.Fc
84.Ft int
85.Fo i2d_DHparams
86.Fa "const DH *a"
87.Fa "unsigned char **pp"
88.Fc
89.Ft int
90.Fo DHparams_print_fp
91.Fa "FILE *fp"
92.Fa "const DH *x"
93.Fc
94.Ft int
95.Fo DHparams_print
96.Fa "BIO *bp"
97.Fa "const DH *x"
98.Fc
99.Sh DESCRIPTION
100These functions implement the Diffie-Hellman key agreement protocol.
101The generation of shared DH parameters is described in
102.Xr DH_generate_parameters 3 ;
103.Xr DH_generate_key 3
104describes how to perform a key agreement.
105.Pp
106The
107.Vt DH
108structure consists of several
109.Vt BIGNUM
110components.
111.Bd -literal
112typedef struct {
113 BIGNUM *p; // prime number (shared)
114 BIGNUM *g; // generator of Z_p (shared)
115 BIGNUM *priv_key; // private DH value x
116 BIGNUM *pub_key; // public DH value g^x
117 // ...
118} DH;
119.Ed
120.Pp
121Note that DH keys may use non-standard
122.Vt DH_METHOD
123implementations, either directly or by the use of
124.Vt ENGINE
125modules.
126In some cases (eg. an
127.Vt ENGINE
128providing support for hardware-embedded keys), these
129.Vt BIGNUM
130values will not be used by the implementation or may be used for
131alternative data storage.
132For this reason, applications should generally avoid using
133.Vt DH
134structure elements directly and instead use API functions to query
135or modify keys.
136.Sh SEE ALSO
137.Xr bn 3 ,
138.Xr d2i_DHparams 3 ,
139.Xr DH_compute_key 3 ,
140.Xr DH_generate_parameters 3 ,
141.Xr DH_get_ex_new_index 3 ,
142.Xr DH_new 3 ,
143.Xr DH_set_method 3 ,
144.Xr dsa 3 ,
145.Xr engine 3 ,
146.Xr ERR 3 ,
147.Xr rsa 3 ,
148.Xr RSA_print 3