diff options
author | schwarze <> | 2022-07-13 19:10:40 +0000 |
---|---|---|
committer | schwarze <> | 2022-07-13 19:10:40 +0000 |
commit | e95ee47017ce917a814d017943491a0500dafae6 (patch) | |
tree | 6828f8b4248b3717f04a897bfff52cc10c23f2cc /src | |
parent | 91e9170fc3d4aa0ea177c939bf219641328a9a6a (diff) | |
download | openbsd-e95ee47017ce917a814d017943491a0500dafae6.tar.gz openbsd-e95ee47017ce917a814d017943491a0500dafae6.tar.bz2 openbsd-e95ee47017ce917a814d017943491a0500dafae6.zip |
Write documentation for EVP_PKEY_check(3), EVP_PKEY_public_check(3),
EVP_PKEY_param_check(3), and EVP_PKEY_security_bits(3) from scratch.
Move the documentation of EVP_PKEY_size(3) and EVP_PKEY_bits(3)
to the new manual page EVP_PKEY_size(3).
Merge the documentation of the related function pointers
from the OpenSSL 1.1.1 branch, which is still under a free license.
OK tb@ on the new page EVP_PKEY_size(3).
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_asn1_new.3 | 86 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_check.3 | 149 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_meth_new.3 | 48 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_size.3 | 224 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_SignInit.3 | 41 |
5 files changed, 504 insertions, 44 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_asn1_new.3 b/src/lib/libcrypto/man/EVP_PKEY_asn1_new.3 index 75d25d7f11..d9947ad743 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_asn1_new.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_asn1_new.3 | |||
@@ -1,8 +1,9 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_asn1_new.3,v 1.7 2021/11/06 15:00:25 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_asn1_new.3,v 1.8 2022/07/13 19:10:40 schwarze Exp $ |
2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
3 | .\" OpenSSL man3/EVP_PKEY_ASN1_METHOD b0004708 Nov 1 00:45:24 2017 +0800 | 3 | .\" OpenSSL man3/EVP_PKEY_ASN1_METHOD b0004708 Nov 1 00:45:24 2017 +0800 |
4 | .\" | 4 | .\" |
5 | .\" This file was written by Richard Levitte <levitte@openssl.org> | 5 | .\" This file was written by Richard Levitte <levitte@openssl.org> |
6 | .\" and Paul Yang <yang.yang@baishancloud.com>. | ||
6 | .\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. | 7 | .\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. |
7 | .\" | 8 | .\" |
8 | .\" Redistribution and use in source and binary forms, with or without | 9 | .\" Redistribution and use in source and binary forms, with or without |
@@ -49,7 +50,7 @@ | |||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | .\" | 52 | .\" |
52 | .Dd $Mdocdate: November 6 2021 $ | 53 | .Dd $Mdocdate: July 13 2022 $ |
53 | .Dt EVP_PKEY_ASN1_NEW 3 | 54 | .Dt EVP_PKEY_ASN1_NEW 3 |
54 | .Os | 55 | .Os |
55 | .Sh NAME | 56 | .Sh NAME |
@@ -62,7 +63,11 @@ | |||
62 | .Nm EVP_PKEY_asn1_set_private , | 63 | .Nm EVP_PKEY_asn1_set_private , |
63 | .Nm EVP_PKEY_asn1_set_param , | 64 | .Nm EVP_PKEY_asn1_set_param , |
64 | .Nm EVP_PKEY_asn1_set_free , | 65 | .Nm EVP_PKEY_asn1_set_free , |
65 | .Nm EVP_PKEY_asn1_set_ctrl | 66 | .Nm EVP_PKEY_asn1_set_ctrl , |
67 | .Nm EVP_PKEY_asn1_set_check , | ||
68 | .Nm EVP_PKEY_asn1_set_public_check , | ||
69 | .Nm EVP_PKEY_asn1_set_param_check , | ||
70 | .Nm EVP_PKEY_asn1_set_security_bits | ||
66 | .Nd manipulating and registering an EVP_PKEY_ASN1_METHOD structure | 71 | .Nd manipulating and registering an EVP_PKEY_ASN1_METHOD structure |
67 | .Sh SYNOPSIS | 72 | .Sh SYNOPSIS |
68 | .In openssl/evp.h | 73 | .In openssl/evp.h |
@@ -132,6 +137,26 @@ | |||
132 | .Fa "EVP_PKEY_ASN1_METHOD *ameth" | 137 | .Fa "EVP_PKEY_ASN1_METHOD *ameth" |
133 | .Fa "int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)" | 138 | .Fa "int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)" |
134 | .Fc | 139 | .Fc |
140 | .Ft void | ||
141 | .Fo EVP_PKEY_asn1_set_check | ||
142 | .Fa "EVP_PKEY_ASN1_METHOD *ameth" | ||
143 | .Fa "int (*pkey_check)(const EVP_PKEY *pk)" | ||
144 | .Fc | ||
145 | .Ft void | ||
146 | .Fo EVP_PKEY_asn1_set_public_check | ||
147 | .Fa "EVP_PKEY_ASN1_METHOD *ameth" | ||
148 | .Fa "int (*pkey_public_check)(const EVP_PKEY *pk)" | ||
149 | .Fc | ||
150 | .Ft void | ||
151 | .Fo EVP_PKEY_asn1_set_param_check | ||
152 | .Fa "EVP_PKEY_ASN1_METHOD *ameth" | ||
153 | .Fa "int (*pkey_param_check)(const EVP_PKEY *pk)" | ||
154 | .Fc | ||
155 | .Ft void | ||
156 | .Fo EVP_PKEY_asn1_set_security_bits | ||
157 | .Fa "EVP_PKEY_ASN1_METHOD *ameth" | ||
158 | .Fa "int (*pkey_security_bits)(const EVP_PKEY *pkey)" | ||
159 | .Fc | ||
135 | .Sh DESCRIPTION | 160 | .Sh DESCRIPTION |
136 | .Vt EVP_PKEY_ASN1_METHOD | 161 | .Vt EVP_PKEY_ASN1_METHOD |
137 | is a structure which holds a set of ASN.1 conversion, printing and | 162 | is a structure which holds a set of ASN.1 conversion, printing and |
@@ -325,6 +350,30 @@ This method is called by | |||
325 | .Fn PKCS7_SIGNER_INFO_set , | 350 | .Fn PKCS7_SIGNER_INFO_set , |
326 | .Fn PKCS7_RECIP_INFO_set , | 351 | .Fn PKCS7_RECIP_INFO_set , |
327 | and other functions. | 352 | and other functions. |
353 | .Bd -unfilled | ||
354 | .Ft int Fn (*pkey_check) "const EVP_PKEY *pk" | ||
355 | .Ft int Fn (*pkey_public_check) "const EVP_PKEY *pk" | ||
356 | .Ft int Fn (*pkey_param_check) "const EVP_PKEY *pk" | ||
357 | .Ed | ||
358 | .Pp | ||
359 | Check the validity of | ||
360 | .Fa pk | ||
361 | for key-pair, public component, and parameters, respectively. | ||
362 | These methods must return 0 for an invalid key or 1 for a valid key. | ||
363 | They are called by | ||
364 | .Xr EVP_PKEY_check 3 , | ||
365 | .Xr EVP_PKEY_public_check 3 , | ||
366 | and | ||
367 | .Xr EVP_PKEY_param_check 3 , | ||
368 | respectively. | ||
369 | .Bd -unfilled | ||
370 | .Ft int Fn (*pkey_security_bits) "const EVP_PKEY *pkey" | ||
371 | .Ed | ||
372 | .Pp | ||
373 | Return the security strength measured in bits of | ||
374 | .Fa pkey . | ||
375 | It is called by | ||
376 | .Xr EVP_PKEY_security_bits 3 . | ||
328 | .Ss Functions | 377 | .Ss Functions |
329 | .Fn EVP_PKEY_asn1_new | 378 | .Fn EVP_PKEY_asn1_new |
330 | creates and returns a new | 379 | creates and returns a new |
@@ -396,8 +445,12 @@ initializing the application. | |||
396 | .Fn EVP_PKEY_asn1_set_private , | 445 | .Fn EVP_PKEY_asn1_set_private , |
397 | .Fn EVP_PKEY_asn1_set_param , | 446 | .Fn EVP_PKEY_asn1_set_param , |
398 | .Fn EVP_PKEY_asn1_set_free , | 447 | .Fn EVP_PKEY_asn1_set_free , |
448 | .Fn EVP_PKEY_asn1_set_ctrl , | ||
449 | .Fn EVP_PKEY_asn1_set_check , | ||
450 | .Fn EVP_PKEY_asn1_set_public_check , | ||
451 | .Fn EVP_PKEY_asn1_set_param_check , | ||
399 | and | 452 | and |
400 | .Fn EVP_PKEY_asn1_set_ctrl | 453 | .Fn EVP_PKEY_asn1_set_security_bits |
401 | set the diverse methods of the given | 454 | set the diverse methods of the given |
402 | .Vt EVP_PKEY_ASN1_METHOD | 455 | .Vt EVP_PKEY_ASN1_METHOD |
403 | object. | 456 | object. |
@@ -418,6 +471,27 @@ return 0 on error or 1 on success. | |||
418 | .Xr EVP_PKEY_new 3 , | 471 | .Xr EVP_PKEY_new 3 , |
419 | .Xr X509_PUBKEY_new 3 | 472 | .Xr X509_PUBKEY_new 3 |
420 | .Sh HISTORY | 473 | .Sh HISTORY |
421 | These functions first appeared in OpenSSL 1.0.0 | 474 | .Fn EVP_PKEY_asn1_new , |
422 | and have been available since | 475 | .Fn EVP_PKEY_asn1_copy , |
476 | .Fn EVP_PKEY_asn1_free , | ||
477 | .Fn EVP_PKEY_asn1_add0 , | ||
478 | .Fn EVP_PKEY_asn1_add_alias , | ||
479 | .Fn EVP_PKEY_asn1_set_public , | ||
480 | .Fn EVP_PKEY_asn1_set_private , | ||
481 | .Fn EVP_PKEY_asn1_set_param , | ||
482 | .Fn EVP_PKEY_asn1_set_free , | ||
483 | and | ||
484 | .Fn EVP_PKEY_asn1_set_ctrl | ||
485 | first appeared in OpenSSL 1.0.0 and have been available since | ||
423 | .Ox 4.9 . | 486 | .Ox 4.9 . |
487 | .Pp | ||
488 | .Fn EVP_PKEY_asn1_set_check , | ||
489 | .Fn EVP_PKEY_asn1_set_public_check , | ||
490 | and | ||
491 | .Fn EVP_PKEY_asn1_set_param_check | ||
492 | first appeared in OpenSSL 1.1.1 and have been available since | ||
493 | .Ox 7.1 . | ||
494 | .Pp | ||
495 | .Fn EVP_PKEY_asn1_set_security_bits | ||
496 | first appeared in OpenSSL 1.1.0 and has been available since | ||
497 | .Ox 7.2 . | ||
diff --git a/src/lib/libcrypto/man/EVP_PKEY_check.3 b/src/lib/libcrypto/man/EVP_PKEY_check.3 new file mode 100644 index 0000000000..0d7688dd98 --- /dev/null +++ b/src/lib/libcrypto/man/EVP_PKEY_check.3 | |||
@@ -0,0 +1,149 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_check.3,v 1.1 2022/07/13 19:10:40 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: July 13 2022 $ | ||
18 | .Dt EVP_PKEY_CHECK 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm EVP_PKEY_check , | ||
22 | .Nm EVP_PKEY_public_check , | ||
23 | .Nm EVP_PKEY_param_check | ||
24 | .Nd key and parameter check functions | ||
25 | .Sh SYNOPSIS | ||
26 | .In openssl/evp.h | ||
27 | .Ft int | ||
28 | .Fn EVP_PKEY_check "EVP_PKEY_CTX *ctx" | ||
29 | .Ft int | ||
30 | .Fn EVP_PKEY_public_check "EVP_PKEY_CTX *ctx" | ||
31 | .Ft int | ||
32 | .Fn EVP_PKEY_param_check "EVP_PKEY_CTX *ctx" | ||
33 | .Sh DESCRIPTION | ||
34 | .Fn EVP_PKEY_check | ||
35 | performs various sanity checks on the key contained in | ||
36 | .Fa ctx | ||
37 | but only supports a small number of key types by default. | ||
38 | It preferably uses the function | ||
39 | .Fa check | ||
40 | configured for | ||
41 | .Fa ctx | ||
42 | with | ||
43 | .Xr EVP_PKEY_meth_set_check 3 . | ||
44 | It falls back to the function | ||
45 | .Fa pkey_check | ||
46 | configured for the private key contained in | ||
47 | .Fa ctx | ||
48 | with | ||
49 | .Xr EVP_PKEY_asn1_set_check 3 . | ||
50 | If that wasn't configured either, it attempts to use the following | ||
51 | check functions: | ||
52 | .Pp | ||
53 | .Bl -tag -width 3n -compact -offset -indent | ||
54 | .It DH | ||
55 | not supported, return value \-2 | ||
56 | .It EC | ||
57 | .Xr EC_KEY_check_key 3 | ||
58 | .It RSA | ||
59 | .Xr RSA_check_key 3 | ||
60 | .El | ||
61 | .Pp | ||
62 | .Fn EVP_PKEY_public_check | ||
63 | performs various sanity checks on the public key contained in | ||
64 | .Fa ctx | ||
65 | but only supports a small number of key types by default. | ||
66 | It preferably uses the function | ||
67 | .Fa public_check | ||
68 | configured for | ||
69 | .Fa ctx | ||
70 | with | ||
71 | .Xr EVP_PKEY_meth_set_public_check 3 . | ||
72 | It falls back to the function | ||
73 | .Fa pkey_public_check | ||
74 | configured for the private key contained in | ||
75 | .Fa ctx | ||
76 | with | ||
77 | .Xr EVP_PKEY_asn1_set_public_check 3 . | ||
78 | If that wasn't configured either, it attempts to use the following | ||
79 | check functions: | ||
80 | .Pp | ||
81 | .Bl -tag -width 3n -compact -offset -indent | ||
82 | .It DH | ||
83 | .Xr DH_check_pub_key 3 | ||
84 | .It EC | ||
85 | .Xr EC_KEY_check_key 3 | ||
86 | .It RSA | ||
87 | not supported, return value \-2 | ||
88 | .El | ||
89 | .Pp | ||
90 | .Fn EVP_PKEY_param_check | ||
91 | performs various sanity checks on the key parameters contained in | ||
92 | .Fa ctx | ||
93 | but only supports a small number of key types by default. | ||
94 | It preferably uses the function | ||
95 | .Fa check | ||
96 | configured for | ||
97 | .Fa ctx | ||
98 | with | ||
99 | .Xr EVP_PKEY_meth_set_param_check 3 . | ||
100 | It falls back to the function | ||
101 | .Fa pkey_check | ||
102 | configured for the private key contained in | ||
103 | .Fa ctx | ||
104 | with | ||
105 | .Xr EVP_PKEY_asn1_set_param_check 3 . | ||
106 | If that wasn't configured either, it attempts to use the following | ||
107 | check functions: | ||
108 | .Pp | ||
109 | .Bl -tag -width 3n -compact -offset -indent | ||
110 | .It DH | ||
111 | .Xr DH_check 3 | ||
112 | .It EC | ||
113 | .Xr EC_GROUP_check 3 | ||
114 | .It RSA | ||
115 | not supported, return value \-2 | ||
116 | .El | ||
117 | .Sh RETURN VALUES | ||
118 | These functions return 1 if the check was performed and no problem | ||
119 | was found, 0 if a problem was found or if the check could not be | ||
120 | performed, for example because | ||
121 | .Fa ctx | ||
122 | does not contain an | ||
123 | .Vt EVP_PKEY | ||
124 | object, or \-2 if the required check function is neither configured for | ||
125 | .Fa ctx | ||
126 | nor for the | ||
127 | .Vt PKEY | ||
128 | contained therein, and the check in question is not supported by default | ||
129 | for the algorithm in question either. | ||
130 | .Sh SEE ALSO | ||
131 | .Xr DH_check 3 , | ||
132 | .Xr EC_GROUP_check 3 , | ||
133 | .Xr EC_KEY_new 3 , | ||
134 | .Xr EVP_PKEY_asn1_new 3 , | ||
135 | .Xr EVP_PKEY_CTX_new 3 , | ||
136 | .Xr EVP_PKEY_meth_new 3 , | ||
137 | .Xr EVP_PKEY_new 3 , | ||
138 | .Xr RSA_check_key 3 | ||
139 | .Sh HISTORY | ||
140 | These functions first appeared in OpenSSL 1.1.1 | ||
141 | and have been available since | ||
142 | .Ox 7.1 . | ||
143 | .Sh BUGS | ||
144 | For EC keys, | ||
145 | .Fn EVP_PKEY_public_check | ||
146 | also checks the | ||
147 | .Em private | ||
148 | key and fails if there is a problem with any of the private | ||
149 | components, even if no problem is found with the public key. | ||
diff --git a/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 b/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 index 706824cd59..3d9d1ba5be 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 | |||
@@ -1,5 +1,5 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.5 2022/07/13 19:10:40 schwarze Exp $ |
2 | .\" selective merge up to: OpenSSL 43f985fd Aug 21 11:47:17 2017 -0400 | 2 | .\" selective merge up to: OpenSSL 335a587b May 7 11:59:11 2019 +0200 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Paul Yang <yang.yang@baishancloud.com> | 4 | .\" This file was written by Paul Yang <yang.yang@baishancloud.com> |
5 | .\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. | 5 | .\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: June 6 2019 $ | 51 | .Dd $Mdocdate: July 13 2022 $ |
52 | .Dt EVP_PKEY_METH_NEW 3 | 52 | .Dt EVP_PKEY_METH_NEW 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -70,7 +70,10 @@ | |||
70 | .Nm EVP_PKEY_meth_set_encrypt , | 70 | .Nm EVP_PKEY_meth_set_encrypt , |
71 | .Nm EVP_PKEY_meth_set_decrypt , | 71 | .Nm EVP_PKEY_meth_set_decrypt , |
72 | .Nm EVP_PKEY_meth_set_derive , | 72 | .Nm EVP_PKEY_meth_set_derive , |
73 | .Nm EVP_PKEY_meth_set_ctrl | 73 | .Nm EVP_PKEY_meth_set_ctrl , |
74 | .Nm EVP_PKEY_meth_set_check , | ||
75 | .Nm EVP_PKEY_meth_set_public_check , | ||
76 | .Nm EVP_PKEY_meth_set_param_check | ||
74 | .Nd manipulate an EVP_PKEY_METHOD structure | 77 | .Nd manipulate an EVP_PKEY_METHOD structure |
75 | .Sh SYNOPSIS | 78 | .Sh SYNOPSIS |
76 | .In openssl/evp.h | 79 | .In openssl/evp.h |
@@ -184,6 +187,21 @@ | |||
184 | .Fa "int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)" | 187 | .Fa "int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)" |
185 | .Fa "int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)" | 188 | .Fa "int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)" |
186 | .Fc | 189 | .Fc |
190 | .Ft void | ||
191 | .Fo EVP_PKEY_meth_set_check | ||
192 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
193 | .Fa "int (*check)(EVP_PKEY *pkey)" | ||
194 | .Fc | ||
195 | .Ft void | ||
196 | .Fo EVP_PKEY_meth_set_public_check | ||
197 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
198 | .Fa "int (*public_check)(EVP_PKEY *pkey)" | ||
199 | .Fc | ||
200 | .Ft void | ||
201 | .Fo EVP_PKEY_meth_set_param_check | ||
202 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
203 | .Fa "int (*param_check)(EVP_PKEY *pkey)" | ||
204 | .Fc | ||
187 | .Sh DESCRIPTION | 205 | .Sh DESCRIPTION |
188 | The | 206 | The |
189 | .Vt EVP_PKEY_METHOD | 207 | .Vt EVP_PKEY_METHOD |
@@ -451,6 +469,21 @@ methods are used to adjust algorithm-specific settings. | |||
451 | See | 469 | See |
452 | .Xr EVP_PKEY_CTX_ctrl 3 | 470 | .Xr EVP_PKEY_CTX_ctrl 3 |
453 | for details. | 471 | for details. |
472 | .Bd -unfilled | ||
473 | .Ft int Fn (*check) "EVP_PKEY *pkey" | ||
474 | .Ft int Fn (*public_check) "EVP_PKEY *pkey" | ||
475 | .Ft int Fn (*param_check) "EVP_PKEY *pkey" | ||
476 | .Ed | ||
477 | These methods are used to validate a key pair, the public component, | ||
478 | and the parameters for the given | ||
479 | .Fa pkey , | ||
480 | respectively. | ||
481 | They are called by | ||
482 | .Xr EVP_PKEY_check 3 , | ||
483 | .Xr EVP_PKEY_public_check 3 , | ||
484 | and | ||
485 | .Xr EVP_PKEY_param_check 3 , | ||
486 | respectively. | ||
454 | .Ss Functions | 487 | .Ss Functions |
455 | .Fn EVP_PKEY_meth_new | 488 | .Fn EVP_PKEY_meth_new |
456 | creates a new | 489 | creates a new |
@@ -553,3 +586,10 @@ first appeared in OpenSSL 1.0.0 and have been available since | |||
553 | .Fn EVP_PKEY_meth_copy | 586 | .Fn EVP_PKEY_meth_copy |
554 | first appeared in OpenSSL 1.0.1 and has been available since | 587 | first appeared in OpenSSL 1.0.1 and has been available since |
555 | .Ox 5.3 . | 588 | .Ox 5.3 . |
589 | .Pp | ||
590 | .Fn EVP_PKEY_meth_set_check , | ||
591 | .Fn EVP_PKEY_meth_set_public_check , | ||
592 | and | ||
593 | .Fn EVP_PKEY_meth_set_param_check | ||
594 | first appeared in OpenSSL 1.1.1 and have been available since | ||
595 | .Ox 7.1 . | ||
diff --git a/src/lib/libcrypto/man/EVP_PKEY_size.3 b/src/lib/libcrypto/man/EVP_PKEY_size.3 new file mode 100644 index 0000000000..3070aee017 --- /dev/null +++ b/src/lib/libcrypto/man/EVP_PKEY_size.3 | |||
@@ -0,0 +1,224 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_size.3,v 1.1 2022/07/13 19:10:40 schwarze Exp $ | ||
2 | .\" full merge up to: OpenSSL eed9d03b Jan 8 11:04:15 2020 +0100 | ||
3 | .\" | ||
4 | .\" This file is a derived work. | ||
5 | .\" The changes are covered by the following Copyright and license: | ||
6 | .\" | ||
7 | .\" Copyright (c) 2022 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 Richard Levitte <levitte@openssl.org>. | ||
22 | .\" Copyright (c) 2020 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: July 13 2022 $ | ||
69 | .Dt EVP_PKEY_SIZE 3 | ||
70 | .Os | ||
71 | .Sh NAME | ||
72 | .Nm EVP_PKEY_size , | ||
73 | .Nm EVP_PKEY_bits , | ||
74 | .Nm EVP_PKEY_security_bits | ||
75 | .Nd EVP_PKEY information functions | ||
76 | .Sh SYNOPSIS | ||
77 | .In openssl/evp.h | ||
78 | .Ft int | ||
79 | .Fo EVP_PKEY_size | ||
80 | .Fa "const EVP_PKEY *pkey" | ||
81 | .Fc | ||
82 | .Ft int | ||
83 | .Fo EVP_PKEY_bits | ||
84 | .Fa "const EVP_PKEY *pkey" | ||
85 | .Fc | ||
86 | .Ft int | ||
87 | .Fo EVP_PKEY_security_bits | ||
88 | .Fa "const EVP_PKEY *pkey" | ||
89 | .Fc | ||
90 | .Sh DESCRIPTION | ||
91 | .Fn EVP_PKEY_size | ||
92 | returns the maximum size in bytes needed for the output buffer | ||
93 | for almost any operation that can be done with | ||
94 | .Fa pkey . | ||
95 | The primary use is with | ||
96 | .Xr EVP_SignFinal 3 | ||
97 | and | ||
98 | .Xr EVP_SealInit 3 . | ||
99 | The returned size is also large enough for the output buffer of | ||
100 | .Xr EVP_PKEY_sign 3 , | ||
101 | .Xr EVP_PKEY_encrypt 3 , | ||
102 | .Xr EVP_PKEY_decrypt 3 , | ||
103 | and | ||
104 | .Xr EVP_PKEY_derive 3 . | ||
105 | .Pp | ||
106 | Unless the documentation for the operation says otherwise, | ||
107 | the size returned by | ||
108 | .Fn EVP_PKEY_size | ||
109 | is only an upper limit and the final content of the target | ||
110 | buffer may be smaller. | ||
111 | It is therefore crucial to take note of the size given back by the | ||
112 | function that performs the operation. | ||
113 | For example, | ||
114 | .Xr EVP_PKEY_sign 3 | ||
115 | returns that length in the | ||
116 | .Pf * Fa siglen | ||
117 | argument. | ||
118 | .Pp | ||
119 | Using | ||
120 | .Fn EVP_PKEY_size | ||
121 | is discouraged with | ||
122 | .Xr EVP_DigestSignFinal 3 . | ||
123 | .Pp | ||
124 | Most functions using an output buffer support passing | ||
125 | .Dv NULL | ||
126 | for the buffer and a pointer to an integer | ||
127 | to get the exact size that this function call delivers | ||
128 | in the context that it is called in. | ||
129 | This allows those functions to be called twice, once to find out the | ||
130 | exact buffer size, then allocate the buffer in between, and call that | ||
131 | function again to actually output the data. | ||
132 | For those functions, it isn't strictly necessary to call | ||
133 | .Fn EVP_PKEY_size | ||
134 | to find out the buffer size, but it may still be useful in cases | ||
135 | where it's desirable to know the upper limit in advance. | ||
136 | .Pp | ||
137 | By default, | ||
138 | .Fn EVP_PKEY_size | ||
139 | is supported for the following algorithms: | ||
140 | .Bl -column GOST01 "EVP_MAX_BLOCK_LENGTH = 32" | ||
141 | .It Ta same result as from: | ||
142 | .It CMAC Ta Dv EVP_MAX_BLOCK_LENGTH No = 32 | ||
143 | .It DH Ta Xr DH_size 3 | ||
144 | .It DSA Ta Xr DSA_size 3 | ||
145 | .It EC Ta Xr ECDSA_size 3 | ||
146 | .It GOST01 Ta 64 or 128 | ||
147 | .It HMAC Ta Dv EVP_MAX_MD_SIZE No = 64 | ||
148 | .It RSA Ta Xr RSA_size 3 | ||
149 | .El | ||
150 | .Pp | ||
151 | The application program can support additional algorithms by calling | ||
152 | .Xr EVP_PKEY_asn1_set_public 3 . | ||
153 | .Pp | ||
154 | .Fn EVP_PKEY_bits | ||
155 | returns the cryptographic length of the cryptosystem to which the key in | ||
156 | .Fa pkey | ||
157 | belongs, in bits. | ||
158 | The definition of cryptographic length is specific to the key cryptosystem. | ||
159 | By default, the following algorithms are supported: | ||
160 | .Bl -column GOST01 "the public domain parameter p" DSA_bits(3) | ||
161 | .It Ta cryptographic length = Ta same result as from: | ||
162 | .It Ta significant bits in ... Ta | ||
163 | .It DH Ta the public domain parameter Fa p Ta Xr DH_bits 3 | ||
164 | .It DSA Ta the public domain parameter Fa p Ta Xr DSA_bits 3 | ||
165 | .It EC Ta the order of the group Ta Xr EC_GROUP_order_bits 3 | ||
166 | .It GOST01 Ta 256 or 512 Ta \(em | ||
167 | .It RSA Ta the public modulus Ta Xr RSA_bits 3 | ||
168 | .El | ||
169 | .Pp | ||
170 | The application program can support additional algorithms by calling | ||
171 | .Xr EVP_PKEY_asn1_set_public 3 . | ||
172 | .Pp | ||
173 | .Fn EVP_PKEY_security_bits | ||
174 | returns the security strength measured in bits of the given | ||
175 | .Fa pkey | ||
176 | as defined in NIST SP800-57. | ||
177 | By default, the following algorithms are supported: | ||
178 | .Bl -column GOST01 DSA_security_bits(3) | ||
179 | .It Ta same result as from: | ||
180 | .It DH Ta Xr DH_security_bits 3 | ||
181 | .It DSA Ta Xr DSA_security_bits 3 | ||
182 | .It EC Ta Xr EC_GROUP_order_bits 3 divided by 2 | ||
183 | .It GOST01 Ta not supported, return value is \-2 | ||
184 | .It RSA Ta Xr RSA_security_bits 3 | ||
185 | .El | ||
186 | .Pp | ||
187 | For EC keys, if the result is greater than 80, it is rounded down | ||
188 | to 256, 192, 128, 112, or 80. | ||
189 | .Pp | ||
190 | The application program can support additional algorithms by calling | ||
191 | .Xr EVP_PKEY_asn1_set_security_bits 3 . | ||
192 | .Sh RETURN VALUES | ||
193 | .Fn EVP_PKEY_size | ||
194 | and | ||
195 | .Fn EVP_PKEY_bits | ||
196 | return a positive number or 0 if this size isn't available. | ||
197 | .Pp | ||
198 | .Fn EVP_PKEY_security_bits | ||
199 | returns a number in the range from 0 to 256 inclusive | ||
200 | or \-2 if this function is unsupported for the algorithm used by | ||
201 | .Fa pkey . | ||
202 | It returns 0 if | ||
203 | .Fa pkey | ||
204 | is | ||
205 | .Dv NULL . | ||
206 | .Sh SEE ALSO | ||
207 | .Xr EVP_PKEY_decrypt 3 , | ||
208 | .Xr EVP_PKEY_derive 3 , | ||
209 | .Xr EVP_PKEY_encrypt 3 , | ||
210 | .Xr EVP_PKEY_new 3 , | ||
211 | .Xr EVP_PKEY_sign 3 , | ||
212 | .Xr EVP_SealInit 3 , | ||
213 | .Xr EVP_SignFinal 3 | ||
214 | .Sh HISTORY | ||
215 | .Fn EVP_PKEY_size | ||
216 | first appeared in SSLeay 0.6.0 and | ||
217 | .Fn EVP_PKEY_bits | ||
218 | in SSLeay 0.9.0. | ||
219 | Both functions have been available since | ||
220 | .Ox 2.4 . | ||
221 | .Pp | ||
222 | .Fn EVP_PKEY_security_bits | ||
223 | first appeared in OpenSSL 1.1.0 and has been available since | ||
224 | .Ox 7.2 . | ||
diff --git a/src/lib/libcrypto/man/EVP_SignInit.3 b/src/lib/libcrypto/man/EVP_SignInit.3 index 06aeb2f141..59dbca1e5b 100644 --- a/src/lib/libcrypto/man/EVP_SignInit.3 +++ b/src/lib/libcrypto/man/EVP_SignInit.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: EVP_SignInit.3,v 1.15 2022/03/31 17:27:17 naddy Exp $ | 1 | .\" $OpenBSD: EVP_SignInit.3,v 1.16 2022/07/13 19:10:40 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
3 | .\" selective merge up to: OpenSSL 79b49fb0 Mar 20 10:03:10 2018 +1000 | 3 | .\" selective merge up to: OpenSSL 79b49fb0 Mar 20 10:03:10 2018 +1000 |
4 | .\" | 4 | .\" |
@@ -50,16 +50,14 @@ | |||
50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
52 | .\" | 52 | .\" |
53 | .Dd $Mdocdate: March 31 2022 $ | 53 | .Dd $Mdocdate: July 13 2022 $ |
54 | .Dt EVP_SIGNINIT 3 | 54 | .Dt EVP_SIGNINIT 3 |
55 | .Os | 55 | .Os |
56 | .Sh NAME | 56 | .Sh NAME |
57 | .Nm EVP_SignInit_ex , | 57 | .Nm EVP_SignInit_ex , |
58 | .Nm EVP_SignUpdate , | 58 | .Nm EVP_SignUpdate , |
59 | .Nm EVP_SignFinal , | 59 | .Nm EVP_SignFinal , |
60 | .Nm EVP_SignInit , | 60 | .Nm EVP_SignInit |
61 | .Nm EVP_PKEY_size , | ||
62 | .Nm EVP_PKEY_bits | ||
63 | .Nd EVP signing functions | 61 | .Nd EVP signing functions |
64 | .Sh SYNOPSIS | 62 | .Sh SYNOPSIS |
65 | .In openssl/evp.h | 63 | .In openssl/evp.h |
@@ -87,14 +85,6 @@ | |||
87 | .Fa "EVP_MD_CTX *ctx" | 85 | .Fa "EVP_MD_CTX *ctx" |
88 | .Fa "const EVP_MD *type" | 86 | .Fa "const EVP_MD *type" |
89 | .Fc | 87 | .Fc |
90 | .Ft int | ||
91 | .Fo EVP_PKEY_size | ||
92 | .Fa "const EVP_PKEY *pkey" | ||
93 | .Fc | ||
94 | .Ft int | ||
95 | .Fo EVP_PKEY_bits | ||
96 | .Fa "const EVP_PKEY *pkey" | ||
97 | .Fc | ||
98 | .Sh DESCRIPTION | 88 | .Sh DESCRIPTION |
99 | The EVP signature routines are a high level interface to digital | 89 | The EVP signature routines are a high level interface to digital |
100 | signatures. | 90 | signatures. |
@@ -132,7 +122,7 @@ and places the signature in | |||
132 | .Fa sig . | 122 | .Fa sig . |
133 | .Fa sig | 123 | .Fa sig |
134 | must be at least | 124 | must be at least |
135 | .Fn EVP_PKEY_size pkey | 125 | .Xr EVP_PKEY_size 3 |
136 | bytes in size. | 126 | bytes in size. |
137 | .Fa s | 127 | .Fa s |
138 | is an OUT parameter, and not used as an IN parameter. | 128 | is an OUT parameter, and not used as an IN parameter. |
@@ -140,7 +130,7 @@ The number of bytes of data written (i.e.\& | |||
140 | the length of the signature) will be written to the integer at | 130 | the length of the signature) will be written to the integer at |
141 | .Fa s . | 131 | .Fa s . |
142 | At most | 132 | At most |
143 | .Fn EVP_PKEY_size pkey | 133 | .Xr EVP_PKEY_size 3 |
144 | bytes will be written. | 134 | bytes will be written. |
145 | .Pp | 135 | .Pp |
146 | .Fn EVP_SignInit | 136 | .Fn EVP_SignInit |
@@ -149,12 +139,6 @@ initializes a signing context | |||
149 | to use the default implementation of digest | 139 | to use the default implementation of digest |
150 | .Fa type . | 140 | .Fa type . |
151 | .Pp | 141 | .Pp |
152 | .Fn EVP_PKEY_size | ||
153 | returns the maximum size of a signature in bytes. | ||
154 | The actual signature returned by | ||
155 | .Fn EVP_SignFinal | ||
156 | may be smaller. | ||
157 | .Pp | ||
158 | The EVP interface to digital signatures should almost always be | 142 | The EVP interface to digital signatures should almost always be |
159 | used in preference to the low level interfaces. | 143 | used in preference to the low level interfaces. |
160 | This is because the code then becomes transparent to the algorithm used | 144 | This is because the code then becomes transparent to the algorithm used |
@@ -180,31 +164,20 @@ and | |||
180 | .Fn EVP_SignFinal | 164 | .Fn EVP_SignFinal |
181 | return 1 for success and 0 for failure. | 165 | return 1 for success and 0 for failure. |
182 | .Pp | 166 | .Pp |
183 | .Fn EVP_PKEY_size | ||
184 | returns the maximum size of a signature in bytes. | ||
185 | .Pp | ||
186 | .Fn EVP_PKEY_bits | ||
187 | returns the number of significant bits in the key | ||
188 | or 0 if an error occurs. | ||
189 | .Pp | ||
190 | The error codes can be obtained by | 167 | The error codes can be obtained by |
191 | .Xr ERR_get_error 3 . | 168 | .Xr ERR_get_error 3 . |
192 | .Sh SEE ALSO | 169 | .Sh SEE ALSO |
193 | .Xr evp 3 , | 170 | .Xr evp 3 , |
194 | .Xr EVP_DigestInit 3 , | 171 | .Xr EVP_DigestInit 3 , |
195 | .Xr EVP_PKEY_asn1_set_public 3 , | 172 | .Xr EVP_PKEY_asn1_set_public 3 , |
173 | .Xr EVP_PKEY_size 3 , | ||
196 | .Xr EVP_VerifyInit 3 | 174 | .Xr EVP_VerifyInit 3 |
197 | .Sh HISTORY | 175 | .Sh HISTORY |
198 | .Fn EVP_SignInit , | 176 | .Fn EVP_SignInit , |
199 | .Fn EVP_SignUpdate , | 177 | .Fn EVP_SignUpdate , |
200 | and | 178 | and |
201 | .Fn EVP_SignFinal | 179 | .Fn EVP_SignFinal |
202 | first appeared in SSLeay 0.5.1. | 180 | first appeared in SSLeay 0.5.1 and have been available since |
203 | .Fn EVP_PKEY_size | ||
204 | first appeared in SSLeay 0.6.0. | ||
205 | .Fn EVP_PKEY_bits | ||
206 | first appeared in SSLeay 0.9.0. | ||
207 | These functions have been available since | ||
208 | .Ox 2.4 . | 181 | .Ox 2.4 . |
209 | .Pp | 182 | .Pp |
210 | .Fn EVP_SignInit_ex | 183 | .Fn EVP_SignInit_ex |