diff options
author | schwarze <> | 2016-11-02 09:11:53 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-02 09:11:53 +0000 |
commit | b50ac7faef96a45291b0c3201b82185f7579e826 (patch) | |
tree | 9166b196a2c833fc7a0154973d11551824a6bfb9 /src/lib/libcrypto/man/DH_set_method.3 | |
parent | 506350d1237710b9d86fdb3a794c6e6265f71221 (diff) | |
download | openbsd-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.3 | 223 |
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 | ||
38 | A | ||
39 | .Vt DH_METHOD | ||
40 | specifies the functions that OpenSSL uses for Diffie-Hellman operations. | ||
41 | By modifying the method, alternative implementations such as hardware | ||
42 | accelerators may be used. | ||
43 | See the | ||
44 | .Sx CAVEATS | ||
45 | section for how these DH API functions are affected by the use of | ||
46 | .Xr engine 3 | ||
47 | API calls. | ||
48 | .Pp | ||
49 | Initially, the default | ||
50 | .Vt DH_METHOD | ||
51 | is the OpenSSL internal implementation as returned by | ||
52 | .Fn DH_OpenSSL . | ||
53 | .Pp | ||
54 | .Fn DH_set_default_method | ||
55 | makes | ||
56 | .Fa meth | ||
57 | the default method for all | ||
58 | .Vt DH | ||
59 | structures created later. | ||
60 | .Sy NB : | ||
61 | This is true only whilst no | ||
62 | .Vt ENGINE | ||
63 | has been set as a default for DH, so this function is no longer | ||
64 | recommended. | ||
65 | .Pp | ||
66 | .Fn DH_get_default_method | ||
67 | returns a pointer to the current default | ||
68 | .Vt DH_METHOD . | ||
69 | However, the meaningfulness of this result is dependent on whether the | ||
70 | .Xr engine 3 | ||
71 | API is being used, so this function is no longer recommended. | ||
72 | .Pp | ||
73 | .Fn DH_set_method | ||
74 | selects | ||
75 | .Fa meth | ||
76 | to perform all operations using the key | ||
77 | .Fa dh . | ||
78 | This will replace the | ||
79 | .Vt DH_METHOD | ||
80 | used by the | ||
81 | .Fa dh | ||
82 | key and if the previous method was supplied by an | ||
83 | .Vt ENGINE , | ||
84 | the handle to that | ||
85 | .Vt ENGINE | ||
86 | will be released during the change. | ||
87 | It is possible to have | ||
88 | .Vt DH | ||
89 | keys that only work with certain | ||
90 | .Vt DH_METHOD | ||
91 | implementations (eg. from an | ||
92 | .Vt ENGINE | ||
93 | module that supports embedded hardware-protected keys), | ||
94 | and in such cases attempting to change the | ||
95 | .Vt DH_METHOD | ||
96 | for the key can have unexpected results. | ||
97 | .Pp | ||
98 | .Fn DH_new_method | ||
99 | allocates and initializes a | ||
100 | .Vt DH | ||
101 | structure so that | ||
102 | .Fa engine | ||
103 | will be used for the DH operations. | ||
104 | If | ||
105 | .Fa engine | ||
106 | is | ||
107 | .Dv NULL , | ||
108 | the default | ||
109 | .Vt ENGINE | ||
110 | for DH operations is used, and if no default | ||
111 | .Vt ENGINE | ||
112 | is set, the | ||
113 | .Vt DH_METHOD | ||
114 | controlled by | ||
115 | .Fn DH_set_default_method | ||
116 | is used. | ||
117 | .Sh THE DH_METHOD STRUCTURE | ||
118 | .Bd -literal | ||
119 | typedef 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 | ||
149 | and | ||
150 | .Fn DH_get_default_method | ||
151 | return pointers to the respective | ||
152 | .Sy DH_METHOD Ns s. | ||
153 | .Pp | ||
154 | .Fn DH_set_method | ||
155 | returns non-zero if the provided | ||
156 | .Fa meth | ||
157 | was successfully set as the method for | ||
158 | .Fa dh | ||
159 | (including unloading the | ||
160 | .Vt ENGINE | ||
161 | handle if the previous method was supplied by an | ||
162 | .Vt ENGINE ) . | ||
163 | .Pp | ||
164 | .Fn DH_new_method | ||
165 | returns | ||
166 | .Dv NULL | ||
167 | and sets an error code that can be obtained by | ||
168 | .Xr ERR_get_error 3 | ||
169 | if the allocation fails. | ||
170 | Otherwise 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 | ||
179 | and | ||
180 | .Fn DH_OpenSSL | ||
181 | were added in OpenSSL 0.9.4. | ||
182 | .Pp | ||
183 | .Fn DH_set_default_openssl_method | ||
184 | and | ||
185 | .Fn DH_get_default_openssl_method | ||
186 | replaced | ||
187 | .Fn DH_set_default_method | ||
188 | and | ||
189 | .Fn DH_get_default_method | ||
190 | respectively, and | ||
191 | .Fn DH_set_method | ||
192 | and | ||
193 | .Fn DH_new_method | ||
194 | were altered to use | ||
195 | .Vt ENGINE Ns s | ||
196 | rather than | ||
197 | .Vt DH_METHOD Ns s | ||
198 | during development of the engine version of OpenSSL 0.9.6. | ||
199 | For 0.9.7, the handling of defaults in the | ||
200 | .Xr engine 3 | ||
201 | API was restructured so that this change was reversed, and behaviour | ||
202 | of the other functions resembled more closely the previous behaviour. | ||
203 | The behaviour of defaults in the | ||
204 | .Xr engine 3 | ||
205 | API now transparently overrides the behaviour of defaults in the | ||
206 | DH API without requiring changing these function prototypes. | ||
207 | .Sh CAVEATS | ||
208 | As of version 0.9.7, | ||
209 | .Vt DH_METHOD | ||
210 | implementations are grouped together with other algorithmic APIs | ||
211 | (eg. RSA_METHOD, EVP_CIPHER, etc) in | ||
212 | .Vt ENGINE | ||
213 | modules. | ||
214 | If a default | ||
215 | .Vt ENGINE | ||
216 | is specified for DH functionality using an | ||
217 | .Xr engine 3 | ||
218 | API function, that will override any DH defaults set using the DH API | ||
219 | .Pq ie. Fn DH_set_default_method . | ||
220 | For this reason, the | ||
221 | .Xr engine 3 | ||
222 | API is the recommended way to control default implementations | ||
223 | for use in DH and other cryptographic algorithms. | ||