diff options
author | tb <> | 2023-07-08 20:01:26 +0000 |
---|---|---|
committer | tb <> | 2023-07-08 20:01:26 +0000 |
commit | e108bdd594d0abf372522a363a7fe61141ce960e (patch) | |
tree | 7609b518f190e73d5407a425634e286dfc399f2b /src | |
parent | e0ef7083653e390d9be4117fed44de8ee12bf146 (diff) | |
download | openbsd-e108bdd594d0abf372522a363a7fe61141ce960e.tar.gz openbsd-e108bdd594d0abf372522a363a7fe61141ce960e.tar.bz2 openbsd-e108bdd594d0abf372522a363a7fe61141ce960e.zip |
Import EVP_MD_meth_new.3 from OpenSSL 1.1.1 head
As usual, this has a lot of room for improvement, but it is better than
nothing at all. It leaves a dangling reference to EVP_MD_CTX_md_data(),
which I leave for schwarze to document. This is a terrible API and the
way it is used in the wild is terrifying.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/EVP_MD_meth_new.3 | 292 |
1 files changed, 292 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EVP_MD_meth_new.3 b/src/lib/libcrypto/man/EVP_MD_meth_new.3 new file mode 100644 index 0000000000..704c516107 --- /dev/null +++ b/src/lib/libcrypto/man/EVP_MD_meth_new.3 | |||
@@ -0,0 +1,292 @@ | |||
1 | .\" $OpenBSD: EVP_MD_meth_new.3,v 1.1 2023/07/08 20:01:26 tb Exp $ | ||
2 | .\" selective merge up to: | ||
3 | .\" OpenSSL man3/EVP_MD_meth_new 0388d212 Dec 14 12:47:07 2018 -0800 | ||
4 | .\" | ||
5 | .\" This file was written by Richard Levitte <levitte@openssl.org> | ||
6 | .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" | ||
12 | .\" 1. Redistributions of source code must retain the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer. | ||
14 | .\" | ||
15 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer in | ||
17 | .\" the documentation and/or other materials provided with the | ||
18 | .\" distribution. | ||
19 | .\" | ||
20 | .\" 3. All advertising materials mentioning features or use of this | ||
21 | .\" software must display the following acknowledgment: | ||
22 | .\" "This product includes software developed by the OpenSSL Project | ||
23 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
24 | .\" | ||
25 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | .\" endorse or promote products derived from this software without | ||
27 | .\" prior written permission. For written permission, please contact | ||
28 | .\" openssl-core@openssl.org. | ||
29 | .\" | ||
30 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
31 | .\" nor may "OpenSSL" appear in their names without prior written | ||
32 | .\" permission of the OpenSSL Project. | ||
33 | .\" | ||
34 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
35 | .\" acknowledgment: | ||
36 | .\" "This product includes software developed by the OpenSSL Project | ||
37 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
38 | .\" | ||
39 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | .\" | ||
52 | .Dd $Mdocdate: July 8 2023 $ | ||
53 | .Dt EVP_MD_METH_NEW 3 | ||
54 | .Os | ||
55 | .Sh NAME | ||
56 | .Nm EVP_MD_meth_dup , | ||
57 | .Nm EVP_MD_meth_new , | ||
58 | .Nm EVP_MD_meth_free , | ||
59 | .Nm EVP_MD_meth_set_input_blocksize , | ||
60 | .Nm EVP_MD_meth_set_result_size , | ||
61 | .Nm EVP_MD_meth_set_app_datasize , | ||
62 | .Nm EVP_MD_meth_set_flags , | ||
63 | .Nm EVP_MD_meth_set_init , | ||
64 | .Nm EVP_MD_meth_set_update , | ||
65 | .Nm EVP_MD_meth_set_final , | ||
66 | .Nm EVP_MD_meth_set_copy , | ||
67 | .Nm EVP_MD_meth_set_cleanup , | ||
68 | .Nm EVP_MD_meth_set_ctrl | ||
69 | .Nd Routines to build up EVP_MD methods | ||
70 | .Sh SYNOPSIS | ||
71 | .In openssl/evp.h | ||
72 | .Ft EVP_MD * | ||
73 | .Fo EVP_MD_meth_new | ||
74 | .Fa "int md_type" | ||
75 | .Fa "int pkey_type" | ||
76 | .Fc | ||
77 | .Ft void | ||
78 | .Fo EVP_MD_meth_free | ||
79 | .Fa "EVP_MD *md" | ||
80 | .Fc | ||
81 | .Ft EVP_MD * | ||
82 | .Fo EVP_MD_meth_dup | ||
83 | .Fa "const EVP_MD *md" | ||
84 | .Fc | ||
85 | .Ft int | ||
86 | .Fo EVP_MD_meth_set_input_blocksize | ||
87 | .Fa "EVP_MD *md" | ||
88 | .Fa "int blocksize" | ||
89 | .Fc | ||
90 | .Ft int | ||
91 | .Fo EVP_MD_meth_set_result_size | ||
92 | .Fa "EVP_MD *md" | ||
93 | .Fa "int resultsize" | ||
94 | .Fc | ||
95 | .Ft int | ||
96 | .Fo EVP_MD_meth_set_app_datasize | ||
97 | .Fa "EVP_MD *md" | ||
98 | .Fa "int datasize" | ||
99 | .Fc | ||
100 | .Ft int | ||
101 | .Fo EVP_MD_meth_set_flags | ||
102 | .Fa "EVP_MD *md" | ||
103 | .Fa "unsigned long flags" | ||
104 | .Fc | ||
105 | .Ft int | ||
106 | .Fo EVP_MD_meth_set_init | ||
107 | .Fa "EVP_MD *md" | ||
108 | .Fa "int (*init)(EVP_MD_CTX *ctx)" | ||
109 | .Fc | ||
110 | .Ft int | ||
111 | .Fo EVP_MD_meth_set_update | ||
112 | .Fa "EVP_MD *md" | ||
113 | .Fa "int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count)" | ||
114 | .Fc | ||
115 | .Ft int | ||
116 | .Fo EVP_MD_meth_set_final | ||
117 | .Fa "EVP_MD *md" | ||
118 | .Fa "int (*final)(EVP_MD_CTX *ctx, unsigned char *md)" | ||
119 | .Fc | ||
120 | .Ft int | ||
121 | .Fo EVP_MD_meth_set_copy | ||
122 | .Fa "EVP_MD *md" | ||
123 | .Fa "int (*copy)(EVP_MD_CTX *to, const EVP_MD_CTX *from)" | ||
124 | .Fc | ||
125 | .Ft int | ||
126 | .Fo EVP_MD_meth_set_cleanup | ||
127 | .Fa "EVP_MD *md" | ||
128 | .Fa "int (*cleanup)(EVP_MD_CTX *ctx)" | ||
129 | .Fc | ||
130 | .Ft int | ||
131 | .Fo EVP_MD_meth_set_ctrl | ||
132 | .Fa "EVP_MD *md" | ||
133 | .Fa "int (*ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)" | ||
134 | .Fc | ||
135 | .Sh DESCRIPTION | ||
136 | The | ||
137 | .Vt EVP_MD | ||
138 | type is a structure for digest method implementation. | ||
139 | It can also have associated public/private key signing and verifying | ||
140 | routines. | ||
141 | .Pp | ||
142 | .Fn EVP_MD_meth_new | ||
143 | creates a new | ||
144 | .Vt EVP_MD | ||
145 | structure. | ||
146 | .Pp | ||
147 | .Fn EVP_MD_meth_dup | ||
148 | creates a copy of | ||
149 | .Fa md . | ||
150 | .Pp | ||
151 | .Fn EVP_MD_meth_free | ||
152 | destroys a | ||
153 | .Vt EVP_MD | ||
154 | structure. | ||
155 | .Pp | ||
156 | .Fn EVP_MD_meth_set_input_blocksize | ||
157 | sets the internal input block size for the method | ||
158 | .Fa md | ||
159 | to | ||
160 | .Fa blocksize | ||
161 | bytes. | ||
162 | .Pp | ||
163 | .Fn EVP_MD_meth_set_result_size | ||
164 | sets the size of the result that the digest method in | ||
165 | .Fa md | ||
166 | is expected to produce to | ||
167 | .Fa resultsize | ||
168 | bytes. | ||
169 | .Pp | ||
170 | The digest method may have its own private data, which OpenSSL will | ||
171 | allocate for it. | ||
172 | .Fn EVP_MD_meth_set_app_datasize | ||
173 | should be used to set the size for it to | ||
174 | .Fa datasize . | ||
175 | .Pp | ||
176 | .Fn EVP_MD_meth_set_flags | ||
177 | sets the flags to describe optional behaviours in the particular | ||
178 | .Fa md . | ||
179 | Several flags can be or'd together. | ||
180 | The available flags are: | ||
181 | .Bl -tag -width Ds | ||
182 | .It EVP_MD_FLAG_ONESHOT | ||
183 | This digest method can only handle one block of input. | ||
184 | .It EVP_MD_FLAG_DIGALGID_NULL | ||
185 | When setting up a DigestAlgorithmIdentifier, this flag will have the | ||
186 | parameter set to NULL by default. | ||
187 | Use this for PKCS#1. | ||
188 | .Em Note: if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override. | ||
189 | .It EVP_MD_FLAG_DIGALGID_ABSENT | ||
190 | When setting up a DigestAlgorithmIdentifier, this flag will have the | ||
191 | parameter be left absent by default. | ||
192 | .Em Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. | ||
193 | .It EVP_MD_FLAG_DIGALGID_CUSTOM | ||
194 | Custom DigestAlgorithmIdentifier handling via ctrl, with | ||
195 | .Sy EVP_MD_FLAG_DIGALGID_ABSENT | ||
196 | as default. | ||
197 | .Em Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. | ||
198 | Currently unused. | ||
199 | .It EVP_MD_FLAG_FIPS | ||
200 | This digest method is suitable for use in FIPS mode. | ||
201 | Currently unused. | ||
202 | .El | ||
203 | .Pp | ||
204 | .Fn EVP_MD_meth_set_init | ||
205 | sets the digest init function for | ||
206 | .Fa md . | ||
207 | The digest init function is called by | ||
208 | .Xr EVP_Digest 3 , | ||
209 | .Xr EVP_DigestInit 3 , | ||
210 | .Xr EVP_DigestInit_ex 3 , | ||
211 | EVP_SignInit, | ||
212 | .Xr EVP_SignInit_ex 3 , | ||
213 | .Xr EVP_VerifyInit 3 | ||
214 | and | ||
215 | .Xr EVP_VerifyInit_ex 3 . | ||
216 | .Pp | ||
217 | .Fn EVP_MD_meth_set_update | ||
218 | sets the digest update function for | ||
219 | .Fa md . | ||
220 | The digest update function is called by | ||
221 | .Xr EVP_Digest 3 , | ||
222 | .Xr EVP_DigestUpdate 3 | ||
223 | and | ||
224 | .Xr EVP_SignUpdate 3 . | ||
225 | .Pp | ||
226 | .Fn EVP_MD_meth_set_final | ||
227 | sets the digest final function for | ||
228 | .Fa md . | ||
229 | The digest final function is called by | ||
230 | .Xr EVP_Digest 3 , | ||
231 | .Xr EVP_DigestFinal 3 , | ||
232 | .Xr EVP_DigestFinal_ex 3 , | ||
233 | .Xr EVP_SignFinal 3 | ||
234 | and | ||
235 | .Xr EVP_VerifyFinal 3 . | ||
236 | .Pp | ||
237 | .Fn EVP_MD_meth_set_copy | ||
238 | sets the function for | ||
239 | .Fa md | ||
240 | to do extra computations after the method's private data structure has | ||
241 | been copied from one | ||
242 | .Vt EVP_MD_CTX | ||
243 | object to another. | ||
244 | If all that's needed is to copy the data, there is no need for this copy | ||
245 | function. | ||
246 | The copy function is passed two | ||
247 | .Vt EVP_MD_CTX | ||
248 | objects, the private data structure is then available with | ||
249 | .Xr EVP_MD_CTX_md_data 3 . | ||
250 | This copy function is called by | ||
251 | .Xr EVP_MD_CTX_copy 3 | ||
252 | and | ||
253 | .Xr EVP_MD_CTX_copy_ex 3 . | ||
254 | .Pp | ||
255 | .Fn EVP_MD_meth_set_cleanup | ||
256 | sets the function for | ||
257 | .Fa md | ||
258 | to do extra cleanup before the method's private data structure is | ||
259 | cleaned out and freed. | ||
260 | The cleanup function is passed an | ||
261 | .Vt EVP_MD_CTX | ||
262 | object, the private data structure is then available with | ||
263 | .Xr EVP_MD_CTX_md_data 3 . | ||
264 | This cleanup function is called by | ||
265 | .Xr EVP_MD_CTX_reset 3 | ||
266 | and | ||
267 | .Xr EVP_MD_CTX_free 3 . | ||
268 | .Pp | ||
269 | .Fn EVP_MD_meth_set_ctrl | ||
270 | sets the control function for | ||
271 | .Fa md . | ||
272 | See | ||
273 | .Xr EVP_MD_CTX_ctrl 3 | ||
274 | for the available controls. | ||
275 | .Sh RETURN VALUES | ||
276 | .Fn EVP_MD_meth_new | ||
277 | and | ||
278 | .Fn EVP_MD_meth_dup | ||
279 | return a pointer to a newly created | ||
280 | .Vt EVP_MD , | ||
281 | or NULL on failure. | ||
282 | All | ||
283 | .Fn EVP_MD_meth_set_* | ||
284 | functions return 1. | ||
285 | .Sh SEE ALSO | ||
286 | .Xr EVP_DigestInit 3 , | ||
287 | .Xr EVP_SignInit 3 , | ||
288 | .Xr EVP_VerifyInit 3 | ||
289 | .Sh HISTORY | ||
290 | All these functions | ||
291 | first appeared in OpenSSL 1.1.0 and have been available since | ||
292 | .Ox 7.0 . | ||