summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/DH_set_method.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-02 09:11:53 +0000
committerschwarze <>2016-11-02 09:11:53 +0000
commitb50ac7faef96a45291b0c3201b82185f7579e826 (patch)
tree9166b196a2c833fc7a0154973d11551824a6bfb9 /src/lib/libcrypto/man/DH_set_method.3
parent506350d1237710b9d86fdb3a794c6e6265f71221 (diff)
downloadopenbsd-b50ac7faef96a45291b0c3201b82185f7579e826.tar.gz
openbsd-b50ac7faef96a45291b0c3201b82185f7579e826.tar.bz2
openbsd-b50ac7faef96a45291b0c3201b82185f7579e826.zip
convert DES and DH manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/DH_set_method.3')
-rw-r--r--src/lib/libcrypto/man/DH_set_method.3223
1 files changed, 223 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/DH_set_method.3 b/src/lib/libcrypto/man/DH_set_method.3
new file mode 100644
index 0000000000..86dae1728c
--- /dev/null
+++ b/src/lib/libcrypto/man/DH_set_method.3
@@ -0,0 +1,223 @@
1.Dd $Mdocdate: November 2 2016 $
2.Dt DH_SET_METHOD 3
3.Os
4.Sh NAME
5.Nm DH_set_default_method ,
6.Nm DH_get_default_method ,
7.Nm DH_set_method ,
8.Nm DH_new_method ,
9.Nm DH_OpenSSL ,
10.Nm DH_set_default_openssl_method ,
11.Nm DH_get_default_openssl_method
12.Nd select DH method
13.Sh SYNOPSIS
14.In openssl/dh.h
15.In openssl/engine.h
16.Ft void
17.Fo DH_set_default_method
18.Fa "const DH_METHOD *meth"
19.Fc
20.Ft const DH_METHOD *
21.Fo DH_get_default_method
22.Fa void
23.Fc
24.Ft int
25.Fo DH_set_method
26.Fa "DH *dh"
27.Fa "const DH_METHOD *meth"
28.Fc
29.Ft DH *
30.Fo DH_new_method
31.Fa "ENGINE *engine"
32.Fc
33.Ft const DH_METHOD *
34.Fo DH_OpenSSL
35.Fa void
36.Fc
37.Sh DESCRIPTION
38A
39.Vt DH_METHOD
40specifies the functions that OpenSSL uses for Diffie-Hellman operations.
41By modifying the method, alternative implementations such as hardware
42accelerators may be used.
43See the
44.Sx CAVEATS
45section for how these DH API functions are affected by the use of
46.Xr engine 3
47API calls.
48.Pp
49Initially, the default
50.Vt DH_METHOD
51is the OpenSSL internal implementation as returned by
52.Fn DH_OpenSSL .
53.Pp
54.Fn DH_set_default_method
55makes
56.Fa meth
57the default method for all
58.Vt DH
59structures created later.
60.Sy NB :
61This is true only whilst no
62.Vt ENGINE
63has been set as a default for DH, so this function is no longer
64recommended.
65.Pp
66.Fn DH_get_default_method
67returns a pointer to the current default
68.Vt DH_METHOD .
69However, the meaningfulness of this result is dependent on whether the
70.Xr engine 3
71API is being used, so this function is no longer recommended.
72.Pp
73.Fn DH_set_method
74selects
75.Fa meth
76to perform all operations using the key
77.Fa dh .
78This will replace the
79.Vt DH_METHOD
80used by the
81.Fa dh
82key and if the previous method was supplied by an
83.Vt ENGINE ,
84the handle to that
85.Vt ENGINE
86will be released during the change.
87It is possible to have
88.Vt DH
89keys that only work with certain
90.Vt DH_METHOD
91implementations (eg. from an
92.Vt ENGINE
93module that supports embedded hardware-protected keys),
94and in such cases attempting to change the
95.Vt DH_METHOD
96for the key can have unexpected results.
97.Pp
98.Fn DH_new_method
99allocates and initializes a
100.Vt DH
101structure so that
102.Fa engine
103will be used for the DH operations.
104If
105.Fa engine
106is
107.Dv NULL ,
108the default
109.Vt ENGINE
110for DH operations is used, and if no default
111.Vt ENGINE
112is set, the
113.Vt DH_METHOD
114controlled by
115.Fn DH_set_default_method
116is used.
117.Sh THE DH_METHOD STRUCTURE
118.Bd -literal
119typedef struct dh_meth_st
120{
121 /* name of the implementation */
122 const char *name;
123
124 /* generate private and public DH values for key agreement */
125 int (*generate_key)(DH *dh);
126
127 /* compute shared secret */
128 int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh);
129
130 /* compute r = a ^ p mod m (May be NULL for some implementations) */
131 int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
132 const BIGNUM *m, BN_CTX *ctx,
133 BN_MONT_CTX *m_ctx);
134
135 /* called at DH_new */
136 int (*init)(DH *dh);
137
138 /* called at DH_free */
139 int (*finish)(DH *dh);
140
141 int flags;
142
143 char *app_data; /* ?? */
144
145} DH_METHOD;
146.Ed
147.Sh RETURN VALUES
148.Fn DH_OpenSSL
149and
150.Fn DH_get_default_method
151return pointers to the respective
152.Sy DH_METHOD Ns s.
153.Pp
154.Fn DH_set_method
155returns non-zero if the provided
156.Fa meth
157was successfully set as the method for
158.Fa dh
159(including unloading the
160.Vt ENGINE
161handle if the previous method was supplied by an
162.Vt ENGINE ) .
163.Pp
164.Fn DH_new_method
165returns
166.Dv NULL
167and sets an error code that can be obtained by
168.Xr ERR_get_error 3
169if the allocation fails.
170Otherwise it returns a pointer to the newly allocated structure.
171.Sh SEE ALSO
172.Xr dh 3 ,
173.Xr DH_new 3
174.Sh HISTORY
175.Fn DH_set_default_method ,
176.Fn DH_get_default_method ,
177.Fn DH_set_method ,
178.Fn DH_new_method
179and
180.Fn DH_OpenSSL
181were added in OpenSSL 0.9.4.
182.Pp
183.Fn DH_set_default_openssl_method
184and
185.Fn DH_get_default_openssl_method
186replaced
187.Fn DH_set_default_method
188and
189.Fn DH_get_default_method
190respectively, and
191.Fn DH_set_method
192and
193.Fn DH_new_method
194were altered to use
195.Vt ENGINE Ns s
196rather than
197.Vt DH_METHOD Ns s
198during development of the engine version of OpenSSL 0.9.6.
199For 0.9.7, the handling of defaults in the
200.Xr engine 3
201API was restructured so that this change was reversed, and behaviour
202of the other functions resembled more closely the previous behaviour.
203The behaviour of defaults in the
204.Xr engine 3
205API now transparently overrides the behaviour of defaults in the
206DH API without requiring changing these function prototypes.
207.Sh CAVEATS
208As of version 0.9.7,
209.Vt DH_METHOD
210implementations are grouped together with other algorithmic APIs
211(eg. RSA_METHOD, EVP_CIPHER, etc) in
212.Vt ENGINE
213modules.
214If a default
215.Vt ENGINE
216is specified for DH functionality using an
217.Xr engine 3
218API function, that will override any DH defaults set using the DH API
219.Pq ie. Fn DH_set_default_method .
220For this reason, the
221.Xr engine 3
222API is the recommended way to control default implementations
223for use in DH and other cryptographic algorithms.