diff options
author | schwarze <> | 2024-12-06 14:27:49 +0000 |
---|---|---|
committer | schwarze <> | 2024-12-06 14:27:49 +0000 |
commit | eced54870588db8076b1f1d7056ec7ad5e00d939 (patch) | |
tree | 55241d484c55ec126f649446bf6ef2358a31e41d /src/lib/libcrypto/man/EVP_PKEY_meth_new.3 | |
parent | f86b82fe933b5698893ec827e2c05c6e54522e7d (diff) | |
download | openbsd-eced54870588db8076b1f1d7056ec7ad5e00d939.tar.gz openbsd-eced54870588db8076b1f1d7056ec7ad5e00d939.tar.bz2 openbsd-eced54870588db8076b1f1d7056ec7ad5e00d939.zip |
Delete the manual pages EVP_PKEY_meth_new(3) and EVP_PKEY_meth_get0_info(3)
because tb@ deleted almost all functions documented there from the API
in evp.h 1.127 on March 2 this year, but move the functions
EVP_PKEY_CTX_set_data(3) and EVP_PKEY_CTX_get_data(3) that we still
support to EVP_PKEY_keygen(3), because that page already documents
EVP_PKEY_CTX_set_app_data(3) and EVP_PKEY_CTX_get_app_data(3).
Diffstat (limited to 'src/lib/libcrypto/man/EVP_PKEY_meth_new.3')
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_meth_new.3 | 647 |
1 files changed, 0 insertions, 647 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 b/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 deleted file mode 100644 index 5ec0b12105..0000000000 --- a/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 +++ /dev/null | |||
@@ -1,647 +0,0 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.6 2023/09/09 14:35:23 schwarze Exp $ | ||
2 | .\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200 | ||
3 | .\" | ||
4 | .\" This file is a derived work. | ||
5 | .\" The changes are covered by the following Copyright and license: | ||
6 | .\" | ||
7 | .\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org> | ||
8 | .\" | ||
9 | .\" Permission to use, copy, modify, and distribute this software for any | ||
10 | .\" purpose with or without fee is hereby granted, provided that the above | ||
11 | .\" copyright notice and this permission notice appear in all copies. | ||
12 | .\" | ||
13 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
14 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
15 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
16 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
17 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
20 | .\" | ||
21 | .\" The original file was written by Paul Yang <yang.yang@baishancloud.com>. | ||
22 | .\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. | ||
23 | .\" | ||
24 | .\" Redistribution and use in source and binary forms, with or without | ||
25 | .\" modification, are permitted provided that the following conditions | ||
26 | .\" are met: | ||
27 | .\" | ||
28 | .\" 1. Redistributions of source code must retain the above copyright | ||
29 | .\" notice, this list of conditions and the following disclaimer. | ||
30 | .\" | ||
31 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
32 | .\" notice, this list of conditions and the following disclaimer in | ||
33 | .\" the documentation and/or other materials provided with the | ||
34 | .\" distribution. | ||
35 | .\" | ||
36 | .\" 3. All advertising materials mentioning features or use of this | ||
37 | .\" software must display the following acknowledgment: | ||
38 | .\" "This product includes software developed by the OpenSSL Project | ||
39 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
40 | .\" | ||
41 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
42 | .\" endorse or promote products derived from this software without | ||
43 | .\" prior written permission. For written permission, please contact | ||
44 | .\" openssl-core@openssl.org. | ||
45 | .\" | ||
46 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
47 | .\" nor may "OpenSSL" appear in their names without prior written | ||
48 | .\" permission of the OpenSSL Project. | ||
49 | .\" | ||
50 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
51 | .\" acknowledgment: | ||
52 | .\" "This product includes software developed by the OpenSSL Project | ||
53 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
54 | .\" | ||
55 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
56 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
57 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
58 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
59 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
60 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
61 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
62 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
63 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
64 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
67 | .\" | ||
68 | .Dd $Mdocdate: September 9 2023 $ | ||
69 | .Dt EVP_PKEY_METH_NEW 3 | ||
70 | .Os | ||
71 | .Sh NAME | ||
72 | .Nm EVP_PKEY_meth_new , | ||
73 | .Nm EVP_PKEY_meth_free , | ||
74 | .Nm EVP_PKEY_meth_copy , | ||
75 | .Nm EVP_PKEY_meth_find , | ||
76 | .Nm EVP_PKEY_meth_add0 , | ||
77 | .Nm EVP_PKEY_meth_set_init , | ||
78 | .Nm EVP_PKEY_meth_set_copy , | ||
79 | .Nm EVP_PKEY_meth_set_cleanup , | ||
80 | .Nm EVP_PKEY_meth_set_paramgen , | ||
81 | .Nm EVP_PKEY_meth_set_keygen , | ||
82 | .Nm EVP_PKEY_meth_set_sign , | ||
83 | .Nm EVP_PKEY_meth_set_verify , | ||
84 | .Nm EVP_PKEY_meth_set_verify_recover , | ||
85 | .Nm EVP_PKEY_meth_set_signctx , | ||
86 | .Nm EVP_PKEY_meth_set_verifyctx , | ||
87 | .Nm EVP_PKEY_meth_set_encrypt , | ||
88 | .Nm EVP_PKEY_meth_set_decrypt , | ||
89 | .Nm EVP_PKEY_meth_set_derive , | ||
90 | .Nm EVP_PKEY_meth_set_ctrl , | ||
91 | .Nm EVP_PKEY_meth_set_check , | ||
92 | .Nm EVP_PKEY_meth_set_public_check , | ||
93 | .Nm EVP_PKEY_meth_set_param_check , | ||
94 | .Nm EVP_PKEY_CTX_get_data , | ||
95 | .Nm EVP_PKEY_CTX_set_data | ||
96 | .Nd manipulate an EVP_PKEY_METHOD structure | ||
97 | .Sh SYNOPSIS | ||
98 | .In openssl/evp.h | ||
99 | .Ft EVP_PKEY_METHOD * | ||
100 | .Fo EVP_PKEY_meth_new | ||
101 | .Fa "int id" | ||
102 | .Fa "int flags" | ||
103 | .Fc | ||
104 | .Ft void | ||
105 | .Fo EVP_PKEY_meth_free | ||
106 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
107 | .Fc | ||
108 | .Ft void | ||
109 | .Fo EVP_PKEY_meth_copy | ||
110 | .Fa "EVP_PKEY_METHOD *dst" | ||
111 | .Fa "const EVP_PKEY_METHOD *src" | ||
112 | .Fc | ||
113 | .Ft const EVP_PKEY_METHOD * | ||
114 | .Fo EVP_PKEY_meth_find | ||
115 | .Fa "int type" | ||
116 | .Fc | ||
117 | .Ft int | ||
118 | .Fo EVP_PKEY_meth_add0 | ||
119 | .Fa "const EVP_PKEY_METHOD *pmeth" | ||
120 | .Fc | ||
121 | .Ft void | ||
122 | .Fo EVP_PKEY_meth_set_init | ||
123 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
124 | .Fa "int (*init)(EVP_PKEY_CTX *ctx)" | ||
125 | .Fc | ||
126 | .Ft void | ||
127 | .Fo EVP_PKEY_meth_set_copy | ||
128 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
129 | .Fa "int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)" | ||
130 | .Fc | ||
131 | .Ft void | ||
132 | .Fo EVP_PKEY_meth_set_cleanup | ||
133 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
134 | .Fa "void (*cleanup)(EVP_PKEY_CTX *ctx)" | ||
135 | .Fc | ||
136 | .Ft void | ||
137 | .Fo EVP_PKEY_meth_set_paramgen | ||
138 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
139 | .Fa "int (*paramgen_init)(EVP_PKEY_CTX *ctx)" | ||
140 | .Fa "int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)" | ||
141 | .Fc | ||
142 | .Ft void | ||
143 | .Fo EVP_PKEY_meth_set_keygen | ||
144 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
145 | .Fa "int (*keygen_init)(EVP_PKEY_CTX *ctx)" | ||
146 | .Fa "int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)" | ||
147 | .Fc | ||
148 | .Ft void | ||
149 | .Fo EVP_PKEY_meth_set_sign | ||
150 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
151 | .Fa "int (*sign_init)(EVP_PKEY_CTX *ctx)" | ||
152 | .Fa "int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\ | ||
153 | const unsigned char *tbs, size_t tbslen)" | ||
154 | .Fc | ||
155 | .Ft void | ||
156 | .Fo EVP_PKEY_meth_set_verify | ||
157 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
158 | .Fa "int (*verify_init)(EVP_PKEY_CTX *ctx)" | ||
159 | .Fa "int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig,\ | ||
160 | size_t siglen, const unsigned char *tbs, size_t tbslen)" | ||
161 | .Fc | ||
162 | .Ft void | ||
163 | .Fo EVP_PKEY_meth_set_verify_recover | ||
164 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
165 | .Fa "int (*verify_recover_init)(EVP_PKEY_CTX *ctx)" | ||
166 | .Fa "int (*verify_recover)(EVP_PKEY_CTX *ctx, unsigned char *sig,\ | ||
167 | size_t *siglen, const unsigned char *tbs, size_t tbslen)" | ||
168 | .Fc | ||
169 | .Ft void | ||
170 | .Fo EVP_PKEY_meth_set_signctx | ||
171 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
172 | .Fa "int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)" | ||
173 | .Fa "int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig,\ | ||
174 | size_t *siglen, EVP_MD_CTX *mctx)" | ||
175 | .Fc | ||
176 | .Ft void | ||
177 | .Fo EVP_PKEY_meth_set_verifyctx | ||
178 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
179 | .Fa "int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)" | ||
180 | .Fa "int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,\ | ||
181 | int siglen, EVP_MD_CTX *mctx)" | ||
182 | .Fc | ||
183 | .Ft void | ||
184 | .Fo EVP_PKEY_meth_set_encrypt | ||
185 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
186 | .Fa "int (*encrypt_init)(EVP_PKEY_CTX *ctx)" | ||
187 | .Fa "int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out,\ | ||
188 | size_t *outlen, const unsigned char *in, size_t inlen)" | ||
189 | .Fc | ||
190 | .Ft void | ||
191 | .Fo EVP_PKEY_meth_set_decrypt | ||
192 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
193 | .Fa "int (*decrypt_init)(EVP_PKEY_CTX *ctx)" | ||
194 | .Fa "int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out,\ | ||
195 | size_t *outlen, const unsigned char *in, size_t inlen)" | ||
196 | .Fc | ||
197 | .Ft void | ||
198 | .Fo EVP_PKEY_meth_set_derive | ||
199 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
200 | .Fa "int (*derive_init)(EVP_PKEY_CTX *ctx)" | ||
201 | .Fa "int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)" | ||
202 | .Fc | ||
203 | .Ft void | ||
204 | .Fo EVP_PKEY_meth_set_ctrl | ||
205 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
206 | .Fa "int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)" | ||
207 | .Fa "int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)" | ||
208 | .Fc | ||
209 | .Ft void | ||
210 | .Fo EVP_PKEY_meth_set_check | ||
211 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
212 | .Fa "int (*check)(EVP_PKEY *pkey)" | ||
213 | .Fc | ||
214 | .Ft void | ||
215 | .Fo EVP_PKEY_meth_set_public_check | ||
216 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
217 | .Fa "int (*public_check)(EVP_PKEY *pkey)" | ||
218 | .Fc | ||
219 | .Ft void | ||
220 | .Fo EVP_PKEY_meth_set_param_check | ||
221 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
222 | .Fa "int (*param_check)(EVP_PKEY *pkey)" | ||
223 | .Fc | ||
224 | .Ft void * | ||
225 | .Fo EVP_PKEY_CTX_get_data | ||
226 | .Fa "EVP_PKEY_CTX *ctx" | ||
227 | .Fc | ||
228 | .Ft void | ||
229 | .Fo EVP_PKEY_CTX_set_data | ||
230 | .Fa "EVP_PKEY_CTX *ctx" | ||
231 | .Fa "void *data" | ||
232 | .Fc | ||
233 | .Sh DESCRIPTION | ||
234 | The | ||
235 | .Vt EVP_PKEY_METHOD | ||
236 | structure holds a set of methods | ||
237 | for a specific public key cryptographic algorithm. | ||
238 | Those methods perform tasks such as generating keys, signing, verifying, | ||
239 | encrypting, decrypting, and so on. | ||
240 | .Pp | ||
241 | There are two places where the | ||
242 | .Vt EVP_PKEY_METHOD | ||
243 | objects are stored: one is a built-in static array representing the | ||
244 | standard methods for different algorithms, and the other one is a stack | ||
245 | of user-defined application-specific methods, which can be manipulated | ||
246 | with | ||
247 | .Fn EVP_PKEY_meth_add0 . | ||
248 | .Pp | ||
249 | The | ||
250 | .Vt EVP_PKEY_METHOD | ||
251 | objects are usually referenced by | ||
252 | .Vt EVP_PKEY_CTX | ||
253 | objects. | ||
254 | .Ss Methods | ||
255 | The methods implement the particular public key algorithm represented by the | ||
256 | .Vt EVP_PKEY_CTX | ||
257 | object. | ||
258 | .Bd -unfilled | ||
259 | .Ft int Fn (*init) "EVP_PKEY_CTX *ctx" | ||
260 | .Ft int Fn (*copy) "EVP_PKEY_CTX *dst" "EVP_PKEY_CTX *src" | ||
261 | .Ft void Fn (*cleanup) "EVP_PKEY_CTX *ctx" | ||
262 | .Ed | ||
263 | .Pp | ||
264 | The | ||
265 | .Fn init | ||
266 | method is called by | ||
267 | .Xr EVP_PKEY_CTX_new 3 | ||
268 | and | ||
269 | .Xr EVP_PKEY_CTX_new_id 3 | ||
270 | to initialize the algorithm-specific data when a new | ||
271 | .Vt EVP_PKEY_CTX | ||
272 | is created. | ||
273 | The | ||
274 | .Fn cleanup | ||
275 | method is called by | ||
276 | .Xr EVP_PKEY_CTX_free 3 | ||
277 | when an | ||
278 | .Vt EVP_PKEY_CTX | ||
279 | is freed. | ||
280 | The | ||
281 | .Fn copy | ||
282 | method is called by | ||
283 | .Xr EVP_PKEY_CTX_dup 3 | ||
284 | when an | ||
285 | .Vt EVP_PKEY_CTX | ||
286 | is duplicated. | ||
287 | .Bd -unfilled | ||
288 | .Ft int Fn (*paramgen_init) "EVP_PKEY_CTX *ctx" | ||
289 | .Ft int Fn (*paramgen) "EVP_PKEY_CTX *ctx" "EVP_PKEY *pkey" | ||
290 | .Ed | ||
291 | .Pp | ||
292 | The | ||
293 | .Fn paramgen_init | ||
294 | and | ||
295 | .Fn paramgen | ||
296 | methods deal with key parameter generation. | ||
297 | They are called by | ||
298 | .Xr EVP_PKEY_paramgen_init 3 | ||
299 | and | ||
300 | .Xr EVP_PKEY_paramgen 3 | ||
301 | to handle the parameter generation process. | ||
302 | .Bd -unfilled | ||
303 | .Ft int Fn (*keygen_init) "EVP_PKEY_CTX *ctx" | ||
304 | .Ft int Fn (*keygen) "EVP_PKEY_CTX *ctx" "EVP_PKEY *pkey" | ||
305 | .Ed | ||
306 | .Pp | ||
307 | The | ||
308 | .Fn keygen_init | ||
309 | and | ||
310 | .Fn keygen | ||
311 | methods are used to generate a key for the specified algorithm. | ||
312 | They are called by | ||
313 | .Xr EVP_PKEY_keygen_init 3 | ||
314 | and | ||
315 | .Xr EVP_PKEY_keygen 3 . | ||
316 | .Bd -unfilled | ||
317 | .Ft int Fn (*sign_init) "EVP_PKEY_CTX *ctx" | ||
318 | .Ft int Fo (*sign) | ||
319 | .Fa "EVP_PKEY_CTX *ctx" | ||
320 | .Fa "unsigned char *sig" | ||
321 | .Fa "size_t *siglen" | ||
322 | .Fa "const unsigned char *tbs" | ||
323 | .Fa "size_t tbslen" | ||
324 | .Fc | ||
325 | .Ed | ||
326 | .Pp | ||
327 | The | ||
328 | .Fn sign_init | ||
329 | and | ||
330 | .Fn sign | ||
331 | methods are used to generate the signature of a piece of data using a | ||
332 | private key. | ||
333 | They are called by | ||
334 | .Xr EVP_PKEY_sign_init 3 | ||
335 | and | ||
336 | .Xr EVP_PKEY_sign 3 . | ||
337 | .Bd -unfilled | ||
338 | .Ft int Fn (*verify_init) "EVP_PKEY_CTX *ctx" | ||
339 | .Ft int Fo (*verify) | ||
340 | .Fa "EVP_PKEY_CTX *ctx" | ||
341 | .Fa "const unsigned char *sig" | ||
342 | .Fa "size_t siglen" | ||
343 | .Fa "const unsigned char *tbs" | ||
344 | .Fa "size_t tbslen" | ||
345 | .Fc | ||
346 | .Ed | ||
347 | .Pp | ||
348 | The | ||
349 | .Fn verify_init | ||
350 | and | ||
351 | .Fn verify | ||
352 | methods are used to verify whether a signature is valid. | ||
353 | They are called by | ||
354 | .Xr EVP_PKEY_verify_init 3 | ||
355 | and | ||
356 | .Xr EVP_PKEY_verify 3 . | ||
357 | .Bd -unfilled | ||
358 | .Ft int Fn (*verify_recover_init) "EVP_PKEY_CTX *ctx" | ||
359 | .Ft int Fo (*verify_recover) | ||
360 | .Fa "EVP_PKEY_CTX *ctx" | ||
361 | .Fa "unsigned char *rout" | ||
362 | .Fa "size_t *routlen" | ||
363 | .Fa "const unsigned char *sig" | ||
364 | .Fa "size_t siglen" | ||
365 | .Fc | ||
366 | .Ed | ||
367 | .Pp | ||
368 | The | ||
369 | .Fn verify_recover_init | ||
370 | and | ||
371 | .Fn verify_recover | ||
372 | methods are used to verify a signature and then recover the digest from | ||
373 | the signature (for instance, a signature that was generated by the RSA | ||
374 | signing algorithm). | ||
375 | They are called by | ||
376 | .Xr EVP_PKEY_verify_recover_init 3 | ||
377 | and | ||
378 | .Xr EVP_PKEY_verify_recover 3 . | ||
379 | .Bd -unfilled | ||
380 | .Ft int Fn (*signctx_init) "EVP_PKEY_CTX *ctx" "EVP_MD_CTX *mctx" | ||
381 | .Ft int Fo (*signctx) | ||
382 | .Fa "EVP_PKEY_CTX *ctx" | ||
383 | .Fa "unsigned char *sig" | ||
384 | .Fa "size_t *siglen" | ||
385 | .Fa "EVP_MD_CTX *mctx" | ||
386 | .Fc | ||
387 | .Ed | ||
388 | .Pp | ||
389 | The | ||
390 | .Fn signctx_init | ||
391 | and | ||
392 | .Fn signctx | ||
393 | methods are used to sign a digest represented by an | ||
394 | .Vt EVP_MD_CTX | ||
395 | object. | ||
396 | They are called by the | ||
397 | .Xr EVP_DigestSignInit 3 | ||
398 | functions. | ||
399 | .Bd -unfilled | ||
400 | .Ft int Fn (*verifyctx_init) "EVP_PKEY_CTX *ctx" "EVP_MD_CTX *mctx" | ||
401 | .Ft int Fo (*verifyctx) | ||
402 | .Fa "EVP_PKEY_CTX *ctx" | ||
403 | .Fa "const unsigned char *sig" | ||
404 | .Fa "int siglen" | ||
405 | .Fa "EVP_MD_CTX *mctx" | ||
406 | .Fc | ||
407 | .Ed | ||
408 | .Pp | ||
409 | The | ||
410 | .Fn verifyctx_init | ||
411 | and | ||
412 | .Fn verifyctx | ||
413 | methods are used to verify a signature against the data in an | ||
414 | .Vt EVP_MD_CTX | ||
415 | object. | ||
416 | They are called by the | ||
417 | .Xr EVP_DigestVerifyInit 3 | ||
418 | functions. | ||
419 | .Bd -unfilled | ||
420 | .Ft int Fn (*encrypt_init) "EVP_PKEY_CTX *ctx" | ||
421 | .Ft int Fo (*encrypt) | ||
422 | .Fa "EVP_PKEY_CTX *ctx" | ||
423 | .Fa "unsigned char *out" | ||
424 | .Fa "size_t *outlen" | ||
425 | .Fa "const unsigned char *in" | ||
426 | .Fa "size_t inlen" | ||
427 | .Fc | ||
428 | .Ed | ||
429 | .Pp | ||
430 | The | ||
431 | .Fn encrypt_init | ||
432 | and | ||
433 | .Fn encrypt | ||
434 | methods are used to encrypt a piece of data. | ||
435 | They are called by | ||
436 | .Xr EVP_PKEY_encrypt_init 3 | ||
437 | and | ||
438 | .Xr EVP_PKEY_encrypt 3 . | ||
439 | .Bd -unfilled | ||
440 | .Ft int Fn (*decrypt_init) "EVP_PKEY_CTX *ctx" | ||
441 | .Ft int Fo (*decrypt) | ||
442 | .Fa "EVP_PKEY_CTX *ctx" | ||
443 | .Fa "unsigned char *out" | ||
444 | .Fa "size_t *outlen" | ||
445 | .Fa "const unsigned char *in" | ||
446 | .Fa "size_t inlen" | ||
447 | .Fc | ||
448 | .Ed | ||
449 | .Pp | ||
450 | The | ||
451 | .Fn decrypt_init | ||
452 | and | ||
453 | .Fn decrypt | ||
454 | methods are used to decrypt a piece of data. | ||
455 | They are called by | ||
456 | .Xr EVP_PKEY_decrypt_init 3 | ||
457 | and | ||
458 | .Xr EVP_PKEY_decrypt 3 . | ||
459 | .Bd -unfilled | ||
460 | .Ft int Fn (*derive_init) "EVP_PKEY_CTX *ctx" | ||
461 | .Ft int Fo (*derive) | ||
462 | .Fa "EVP_PKEY_CTX *ctx" | ||
463 | .Fa "unsigned char *key" | ||
464 | .Fa "size_t *keylen" | ||
465 | .Fc | ||
466 | .Ed | ||
467 | .Pp | ||
468 | The | ||
469 | .Fn derive_init | ||
470 | and | ||
471 | .Fn derive | ||
472 | methods are used to derive the shared secret from a public key algorithm | ||
473 | (for instance, the DH algorithm). | ||
474 | They are called by | ||
475 | .Xr EVP_PKEY_derive_init 3 | ||
476 | and | ||
477 | .Xr EVP_PKEY_derive 3 . | ||
478 | .Bd -unfilled | ||
479 | .Ft int Fo (*ctrl) | ||
480 | .Fa "EVP_PKEY_CTX *ctx" | ||
481 | .Fa "int type" | ||
482 | .Fa "int p1" | ||
483 | .Fa "void *p2" | ||
484 | .Fc | ||
485 | .Ft int Fo (*ctrl_str) | ||
486 | .Fa "EVP_PKEY_CTX *ctx" | ||
487 | .Fa "const char *type" | ||
488 | .Fa "const char *value" | ||
489 | .Fc | ||
490 | .Ed | ||
491 | .Pp | ||
492 | The | ||
493 | .Fn ctrl | ||
494 | and | ||
495 | .Fn ctrl_str | ||
496 | methods are used to adjust algorithm-specific settings. | ||
497 | See | ||
498 | .Xr EVP_PKEY_CTX_ctrl 3 | ||
499 | for details. | ||
500 | .Bd -unfilled | ||
501 | .Ft int Fn (*check) "EVP_PKEY *pkey" | ||
502 | .Ft int Fn (*public_check) "EVP_PKEY *pkey" | ||
503 | .Ft int Fn (*param_check) "EVP_PKEY *pkey" | ||
504 | .Ed | ||
505 | These methods are used to validate a key pair, the public component, | ||
506 | and the parameters for the given | ||
507 | .Fa pkey , | ||
508 | respectively. | ||
509 | They are called by | ||
510 | .Xr EVP_PKEY_check 3 , | ||
511 | .Xr EVP_PKEY_public_check 3 , | ||
512 | and | ||
513 | .Xr EVP_PKEY_param_check 3 , | ||
514 | respectively. | ||
515 | .Ss Functions | ||
516 | .Fn EVP_PKEY_meth_new | ||
517 | creates a new | ||
518 | .Vt EVP_PKEY_METHOD | ||
519 | object with the given | ||
520 | .Fa id | ||
521 | and | ||
522 | .Fa flags . | ||
523 | The following flags are supported: | ||
524 | .Bl -tag -width Ds | ||
525 | .It Dv EVP_PKEY_FLAG_AUTOARGLEN | ||
526 | Automatically calculate the maximum size of the output buffer | ||
527 | in corresponding EVP methods by the EVP framework. | ||
528 | Thus the implementations of these methods don't need to care about | ||
529 | handling the case of returning output buffer size by themselves. | ||
530 | For details on the output buffer size, refer to | ||
531 | .Xr EVP_PKEY_sign 3 . | ||
532 | .It Dv EVP_PKEY_FLAG_SIGCTX_CUSTOM | ||
533 | Indicate that the | ||
534 | .Fn signctx | ||
535 | method of an | ||
536 | .Vt EVP_PKEY_METHOD | ||
537 | is always called by the EVP framework while doing a digest signing | ||
538 | operation by calling | ||
539 | .Xr EVP_DigestSignFinal 3 . | ||
540 | .El | ||
541 | .Pp | ||
542 | .Fn EVP_PKEY_meth_free | ||
543 | frees | ||
544 | .Fa pmeth . | ||
545 | .Pp | ||
546 | .Fn EVP_PKEY_meth_copy | ||
547 | copies | ||
548 | .Fa src | ||
549 | to | ||
550 | .Fa dst . | ||
551 | .Pp | ||
552 | .Fn EVP_PKEY_meth_find | ||
553 | finds an | ||
554 | .Vt EVP_PKEY_METHOD | ||
555 | object with the given | ||
556 | .Fa id . | ||
557 | This function first searches through the user-defined method objects and | ||
558 | then through the built-in objects. | ||
559 | .Pp | ||
560 | .Fn EVP_PKEY_meth_add0 | ||
561 | adds | ||
562 | .Fa pmeth | ||
563 | to the stack of user defined methods. | ||
564 | .Pp | ||
565 | The | ||
566 | .Fn EVP_PKEY_meth_set_* | ||
567 | functions set the corresponding fields of | ||
568 | .Fa pmeth | ||
569 | to the arguments passed. | ||
570 | .Pp | ||
571 | .Fn EVP_PKEY_CTX_get_data | ||
572 | retrieves algorithm- and implementation-specific private key data from | ||
573 | .Fa ctx . | ||
574 | Public key algorithm implementations typically allocate and initialize | ||
575 | this data automatically in their | ||
576 | .Fn init | ||
577 | function. | ||
578 | .Pp | ||
579 | .Fn EVP_PKEY_CTX_set_data | ||
580 | transfers ownership of the given | ||
581 | .Fa data | ||
582 | to | ||
583 | .Fa ctx , | ||
584 | replacing the existing algorithm- and implementation-specific | ||
585 | private key data. | ||
586 | It is the responsibility of the caller to free the existing data | ||
587 | before calling this function. | ||
588 | .Sh RETURN VALUES | ||
589 | .Fn EVP_PKEY_meth_new | ||
590 | returns a pointer to a new | ||
591 | .Vt EVP_PKEY_METHOD | ||
592 | object or | ||
593 | .Dv NULL | ||
594 | on error. | ||
595 | .Pp | ||
596 | .Fn EVP_PKEY_meth_find | ||
597 | returns a pointer to the found | ||
598 | .Vt EVP_PKEY_METHOD | ||
599 | object or | ||
600 | .Dv NULL | ||
601 | if no matching object is found. | ||
602 | .Pp | ||
603 | .Fn EVP_PKEY_meth_add0 | ||
604 | returns 1 if the method is added successfully or 0 if an error occurred. | ||
605 | .Pp | ||
606 | .Fn EVP_PKEY_CTX_get_data | ||
607 | returns an internal pointer owned by | ||
608 | .Fa ctx . | ||
609 | .Sh SEE ALSO | ||
610 | .Xr EVP_DigestInit 3 , | ||
611 | .Xr EVP_PKEY_meth_get0_info 3 , | ||
612 | .Xr EVP_PKEY_new 3 | ||
613 | .Sh HISTORY | ||
614 | .Fn EVP_PKEY_meth_new , | ||
615 | .Fn EVP_PKEY_meth_free , | ||
616 | .Fn EVP_PKEY_meth_find , | ||
617 | .Fn EVP_PKEY_meth_add0 , | ||
618 | .Fn EVP_PKEY_meth_set_init , | ||
619 | .Fn EVP_PKEY_meth_set_copy , | ||
620 | .Fn EVP_PKEY_meth_set_cleanup , | ||
621 | .Fn EVP_PKEY_meth_set_paramgen , | ||
622 | .Fn EVP_PKEY_meth_set_keygen , | ||
623 | .Fn EVP_PKEY_meth_set_sign , | ||
624 | .Fn EVP_PKEY_meth_set_verify , | ||
625 | .Fn EVP_PKEY_meth_set_verify_recover , | ||
626 | .Fn EVP_PKEY_meth_set_signctx , | ||
627 | .Fn EVP_PKEY_meth_set_verifyctx , | ||
628 | .Fn EVP_PKEY_meth_set_encrypt , | ||
629 | .Fn EVP_PKEY_meth_set_decrypt , | ||
630 | .Fn EVP_PKEY_meth_set_derive , | ||
631 | .Fn EVP_PKEY_meth_set_ctrl , | ||
632 | .Fn EVP_PKEY_CTX_get_data , | ||
633 | and | ||
634 | .Fn EVP_PKEY_CTX_set_data | ||
635 | first appeared in OpenSSL 1.0.0 and have been available since | ||
636 | .Ox 4.9 . | ||
637 | .Pp | ||
638 | .Fn EVP_PKEY_meth_copy | ||
639 | first appeared in OpenSSL 1.0.1 and has been available since | ||
640 | .Ox 5.3 . | ||
641 | .Pp | ||
642 | .Fn EVP_PKEY_meth_set_check , | ||
643 | .Fn EVP_PKEY_meth_set_public_check , | ||
644 | and | ||
645 | .Fn EVP_PKEY_meth_set_param_check | ||
646 | first appeared in OpenSSL 1.1.1 and have been available since | ||
647 | .Ox 7.1 . | ||