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