diff options
author | schwarze <> | 2023-08-31 17:27:41 +0000 |
---|---|---|
committer | schwarze <> | 2023-08-31 17:27:41 +0000 |
commit | 6adafa1ed9ad28e76b0a4bf339267f23a85c6bcf (patch) | |
tree | ab74fd16ac9e22d139215fe0e871eac001715264 /src/lib | |
parent | 9939c389dea4955b2a84815d7c821f036c266e0f (diff) | |
download | openbsd-6adafa1ed9ad28e76b0a4bf339267f23a85c6bcf.tar.gz openbsd-6adafa1ed9ad28e76b0a4bf339267f23a85c6bcf.tar.bz2 openbsd-6adafa1ed9ad28e76b0a4bf339267f23a85c6bcf.zip |
Split three new manual pages EVP_CIPHER_nid(3), EVP_CIPHER_CTX_ctrl(3),
and EVP_CIPHER_CTX_set_flags(3) out of the excessively large and
unwieldy EVP_EncryptInit(3). This causes a number of inaccuracies
and gaps to stand out, but i'm not mixing text changes or content
additions into this split.
Using very useful feedback from tb@ regarding what belongs together
and how important the various functions are. I refrained from bothering
him with the complete patch, but he likes the general direction.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 | 260 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 | 228 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_CIPHER_nid.3 | 215 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_EncryptInit.3 | 463 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/evp.3 | 7 |
6 files changed, 727 insertions, 451 deletions
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 new file mode 100644 index 0000000000..40ed524ffa --- /dev/null +++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 | |||
@@ -0,0 +1,260 @@ | |||
1 | .\" $OpenBSD: EVP_CIPHER_CTX_ctrl.3,v 1.1 2023/08/31 17:27:41 schwarze Exp $ | ||
2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | ||
3 | .\" | ||
4 | .\" This file is a derived work. | ||
5 | .\" The changes are covered by the following Copyright and license: | ||
6 | .\" | ||
7 | .\" Copyright (c) 2018, 2023 Ingo Schwarze <schwarze@openbsd.org> | ||
8 | .\" Copyright (c) 2018 Damien Miller <djm@openbsd.org> | ||
9 | .\" | ||
10 | .\" Permission to use, copy, modify, and distribute this software for any | ||
11 | .\" purpose with or without fee is hereby granted, provided that the above | ||
12 | .\" copyright notice and this permission notice appear in all copies. | ||
13 | .\" | ||
14 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
15 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
16 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
17 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
18 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
19 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
20 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
21 | .\" | ||
22 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
23 | .\" Copyright (c) 2000, 2001, 2016 The OpenSSL Project. | ||
24 | .\" All rights reserved. | ||
25 | .\" | ||
26 | .\" Redistribution and use in source and binary forms, with or without | ||
27 | .\" modification, are permitted provided that the following conditions | ||
28 | .\" are met: | ||
29 | .\" | ||
30 | .\" 1. Redistributions of source code must retain the above copyright | ||
31 | .\" notice, this list of conditions and the following disclaimer. | ||
32 | .\" | ||
33 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
34 | .\" notice, this list of conditions and the following disclaimer in | ||
35 | .\" the documentation and/or other materials provided with the | ||
36 | .\" distribution. | ||
37 | .\" | ||
38 | .\" 3. All advertising materials mentioning features or use of this | ||
39 | .\" software must display the following acknowledgment: | ||
40 | .\" "This product includes software developed by the OpenSSL Project | ||
41 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
42 | .\" | ||
43 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
44 | .\" endorse or promote products derived from this software without | ||
45 | .\" prior written permission. For written permission, please contact | ||
46 | .\" openssl-core@openssl.org. | ||
47 | .\" | ||
48 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
49 | .\" nor may "OpenSSL" appear in their names without prior written | ||
50 | .\" permission of the OpenSSL Project. | ||
51 | .\" | ||
52 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
53 | .\" acknowledgment: | ||
54 | .\" "This product includes software developed by the OpenSSL Project | ||
55 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
56 | .\" | ||
57 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
58 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
59 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
60 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
61 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
62 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
63 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
64 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
65 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
66 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
69 | .\" | ||
70 | .Dd $Mdocdate: August 31 2023 $ | ||
71 | .Dt EVP_CIPHER_CTX_CTRL 3 | ||
72 | .Os | ||
73 | .Sh NAME | ||
74 | .Nm EVP_CIPHER_CTX_ctrl , | ||
75 | .Nm EVP_CIPHER_CTX_set_padding , | ||
76 | .Nm EVP_CIPHER_CTX_set_key_length , | ||
77 | .Nm EVP_CIPHER_CTX_key_length , | ||
78 | .Nm EVP_CIPHER_key_length , | ||
79 | .Nm EVP_CIPHER_CTX_iv_length , | ||
80 | .Nm EVP_CIPHER_iv_length , | ||
81 | .Nm EVP_CIPHER_CTX_set_iv , | ||
82 | .Nm EVP_CIPHER_CTX_get_iv | ||
83 | .Nd configure EVP cipher contexts | ||
84 | .Sh SYNOPSIS | ||
85 | .In openssl/evp.h | ||
86 | .Ft int | ||
87 | .Fo EVP_CIPHER_CTX_ctrl | ||
88 | .Fa "EVP_CIPHER_CTX *ctx" | ||
89 | .Fa "int type" | ||
90 | .Fa "int arg" | ||
91 | .Fa "void *ptr" | ||
92 | .Fc | ||
93 | .Ft int | ||
94 | .Fo EVP_CIPHER_CTX_set_padding | ||
95 | .Fa "EVP_CIPHER_CTX *x" | ||
96 | .Fa "int padding" | ||
97 | .Fc | ||
98 | .Ft int | ||
99 | .Fo EVP_CIPHER_CTX_set_key_length | ||
100 | .Fa "EVP_CIPHER_CTX *x" | ||
101 | .Fa "int keylen" | ||
102 | .Fc | ||
103 | .Ft int | ||
104 | .Fo EVP_CIPHER_CTX_key_length | ||
105 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
106 | .Fc | ||
107 | .Ft int | ||
108 | .Fo EVP_CIPHER_key_length | ||
109 | .Fa "const EVP_CIPHER *e" | ||
110 | .Fc | ||
111 | .Ft int | ||
112 | .Fo EVP_CIPHER_CTX_iv_length | ||
113 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
114 | .Fc | ||
115 | .Ft int | ||
116 | .Fo EVP_CIPHER_iv_length | ||
117 | .Fa "const EVP_CIPHER *e" | ||
118 | .Fc | ||
119 | .Ft int | ||
120 | .Fo EVP_CIPHER_CTX_set_iv | ||
121 | .Fa "EVP_CIPHER_CTX *ctx" | ||
122 | .Fa "const unsigned char *iv" | ||
123 | .Fa "size_t len" | ||
124 | .Fc | ||
125 | .Ft int | ||
126 | .Fo EVP_CIPHER_CTX_get_iv | ||
127 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
128 | .Fa "unsigned char *iv" | ||
129 | .Fa "size_t len" | ||
130 | .Fc | ||
131 | .Sh DESCRIPTION | ||
132 | .Fn EVP_CIPHER_CTX_ctrl | ||
133 | allows various cipher specific parameters to be determined and set. | ||
134 | Currently only the RC2 effective key length can be set. | ||
135 | .Pp | ||
136 | .Fn EVP_CIPHER_CTX_set_padding | ||
137 | enables or disables padding. | ||
138 | This function should be called after the context is set up for | ||
139 | encryption or decryption with | ||
140 | .Xr EVP_EncryptInit_ex 3 , | ||
141 | .Xr EVP_DecryptInit_ex 3 , | ||
142 | or | ||
143 | .Xr EVP_CipherInit_ex 3 . | ||
144 | By default encryption operations are padded using standard block padding | ||
145 | and the padding is checked and removed when decrypting. | ||
146 | If the | ||
147 | .Fa padding | ||
148 | parameter is zero, then no padding is performed, the total amount of data | ||
149 | encrypted or decrypted must then be a multiple of the block size or an | ||
150 | error will occur. | ||
151 | .Pp | ||
152 | .Fn EVP_CIPHER_CTX_set_key_length | ||
153 | sets the key length of the cipher ctx. | ||
154 | If the cipher is a fixed length cipher, then attempting to set the key | ||
155 | length to any value other than the fixed value is an error. | ||
156 | .Pp | ||
157 | .Fn EVP_CIPHER_CTX_key_length | ||
158 | and | ||
159 | .Fn EVP_CIPHER_key_length | ||
160 | return the key length of a cipher when passed an | ||
161 | .Vt EVP_CIPHER_CTX | ||
162 | or | ||
163 | .Vt EVP_CIPHER | ||
164 | structure. | ||
165 | The constant | ||
166 | .Dv EVP_MAX_KEY_LENGTH | ||
167 | is the maximum key length for all ciphers. | ||
168 | Note: although | ||
169 | .Fn EVP_CIPHER_key_length | ||
170 | is fixed for a given cipher, the value of | ||
171 | .Fn EVP_CIPHER_CTX_key_length | ||
172 | may be different for variable key length ciphers. | ||
173 | .Pp | ||
174 | .Fn EVP_CIPHER_CTX_iv_length | ||
175 | and | ||
176 | .Fn EVP_CIPHER_iv_length | ||
177 | return the IV length of a cipher when passed an | ||
178 | .Vt EVP_CIPHER_CTX | ||
179 | or | ||
180 | .Vt EVP_CIPHER . | ||
181 | It will return zero if the cipher does not use an IV. | ||
182 | The constant | ||
183 | .Dv EVP_MAX_IV_LENGTH | ||
184 | is the maximum IV length for all ciphers. | ||
185 | .Pp | ||
186 | .Fn EVP_CIPHER_CTX_set_iv | ||
187 | and | ||
188 | .Fn EVP_CIPHER_CTX_get_iv | ||
189 | set and retrieve the IV for an | ||
190 | .Vt EVP_CIPHER_CTX , | ||
191 | respectively. | ||
192 | In both cases, the specified IV length must exactly equal the expected | ||
193 | IV length for the context as returned by | ||
194 | .Fn EVP_CIPHER_CTX_iv_length . | ||
195 | .Sh RETURN VALUES | ||
196 | .Fn EVP_CIPHER_CTX_ctrl | ||
197 | usually returns 1 for success, 0 for failure, or \-1 if the | ||
198 | .Fa type | ||
199 | is not supported by the | ||
200 | .Fa ctx , | ||
201 | but there may be exceptions for some | ||
202 | .Fa type | ||
203 | arguments. | ||
204 | .Pp | ||
205 | .Fn EVP_CIPHER_CTX_set_padding | ||
206 | always returns 1. | ||
207 | .Pp | ||
208 | .Fn EVP_CIPHER_CTX_set_key_length , | ||
209 | .Fn EVP_CIPHER_CTX_set_iv , | ||
210 | and | ||
211 | .Fn EVP_CIPHER_CTX_get_iv | ||
212 | return 1 for success or 0 for failure. | ||
213 | .Pp | ||
214 | .Fn EVP_CIPHER_CTX_key_length | ||
215 | and | ||
216 | .Fn EVP_CIPHER_key_length | ||
217 | return the key length. | ||
218 | .Pp | ||
219 | .Fn EVP_CIPHER_CTX_iv_length | ||
220 | and | ||
221 | .Fn EVP_CIPHER_iv_length | ||
222 | return the IV length or zero if the cipher does not use an IV. | ||
223 | .Sh SEE ALSO | ||
224 | .Xr evp 3 , | ||
225 | .Xr EVP_CIPHER_nid 3 , | ||
226 | .Xr EVP_EncryptInit 3 | ||
227 | .Sh HISTORY | ||
228 | .Fn EVP_CIPHER_CTX_key_length , | ||
229 | .Fn EVP_CIPHER_key_length , | ||
230 | .Fn EVP_CIPHER_CTX_iv_length , | ||
231 | and | ||
232 | .Fn EVP_CIPHER_iv_length | ||
233 | first appeared in SSLeay 0.6.5 and have been available since | ||
234 | .Ox 2.4 . | ||
235 | .Pp | ||
236 | .Fn EVP_CIPHER_CTX_ctrl | ||
237 | and | ||
238 | .Fn EVP_CIPHER_CTX_set_key_length | ||
239 | first appeared in OpenSSL 0.9.6 and have been available since | ||
240 | .Ox 2.9 . | ||
241 | .Pp | ||
242 | .Fn EVP_CIPHER_CTX_set_padding | ||
243 | first appeared in OpenSSL 0.9.7 and has been available since | ||
244 | .Ox 3.2 . | ||
245 | .Pp | ||
246 | .Fn EVP_CIPHER_CTX_set_iv | ||
247 | and | ||
248 | .Fn EVP_CIPHER_CTX_get_iv | ||
249 | first appeared in LibreSSL 2.8.1 and have been available since | ||
250 | .Ox 6.4 . | ||
251 | .Sh BUGS | ||
252 | .Dv EVP_MAX_KEY_LENGTH | ||
253 | and | ||
254 | .Dv EVP_MAX_IV_LENGTH | ||
255 | only refer to the internal ciphers with default key lengths. | ||
256 | If custom ciphers exceed these values, the results are unpredictable. | ||
257 | This is because it has become standard practice to define a generic key | ||
258 | as a fixed unsigned char array containing | ||
259 | .Dv EVP_MAX_KEY_LENGTH | ||
260 | bytes. | ||
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 new file mode 100644 index 0000000000..a8e32cdc55 --- /dev/null +++ b/src/lib/libcrypto/man/EVP_CIPHER_CTX_set_flags.3 | |||
@@ -0,0 +1,228 @@ | |||
1 | .\" $OpenBSD: EVP_CIPHER_CTX_set_flags.3,v 1.1 2023/08/31 17:27:41 schwarze Exp $ | ||
2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | ||
3 | .\" | ||
4 | .\" This file is a derived work. | ||
5 | .\" The changes are covered by the following Copyright and license: | ||
6 | .\" | ||
7 | .\" Copyright (c) 2019 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 Dr. Stephen Henson <steve@openssl.org> | ||
22 | .\" and Patrick Steuer <patrick.steuer@de.ibm.com>. | ||
23 | .\" Copyright (c) 2000, 2017 The OpenSSL Project. | ||
24 | .\" All rights reserved. | ||
25 | .\" | ||
26 | .\" Redistribution and use in source and binary forms, with or without | ||
27 | .\" modification, are permitted provided that the following conditions | ||
28 | .\" are met: | ||
29 | .\" | ||
30 | .\" 1. Redistributions of source code must retain the above copyright | ||
31 | .\" notice, this list of conditions and the following disclaimer. | ||
32 | .\" | ||
33 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
34 | .\" notice, this list of conditions and the following disclaimer in | ||
35 | .\" the documentation and/or other materials provided with the | ||
36 | .\" distribution. | ||
37 | .\" | ||
38 | .\" 3. All advertising materials mentioning features or use of this | ||
39 | .\" software must display the following acknowledgment: | ||
40 | .\" "This product includes software developed by the OpenSSL Project | ||
41 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
42 | .\" | ||
43 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
44 | .\" endorse or promote products derived from this software without | ||
45 | .\" prior written permission. For written permission, please contact | ||
46 | .\" openssl-core@openssl.org. | ||
47 | .\" | ||
48 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
49 | .\" nor may "OpenSSL" appear in their names without prior written | ||
50 | .\" permission of the OpenSSL Project. | ||
51 | .\" | ||
52 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
53 | .\" acknowledgment: | ||
54 | .\" "This product includes software developed by the OpenSSL Project | ||
55 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
56 | .\" | ||
57 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
58 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
59 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
60 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
61 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
62 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
63 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
64 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
65 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
66 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
69 | .\" | ||
70 | .Dd $Mdocdate: August 31 2023 $ | ||
71 | .Dt EVP_CIPHER_CTX_SET_FLAGS 3 | ||
72 | .Os | ||
73 | .Sh NAME | ||
74 | .Nm EVP_CIPHER_CTX_set_flags , | ||
75 | .Nm EVP_CIPHER_CTX_clear_flags , | ||
76 | .Nm EVP_CIPHER_CTX_test_flags , | ||
77 | .Nm EVP_CIPHER_CTX_rand_key , | ||
78 | .Nm EVP_CIPHER_param_to_asn1 , | ||
79 | .Nm EVP_CIPHER_asn1_to_param , | ||
80 | .Nm EVP_CIPHER_CTX_get_app_data , | ||
81 | .Nm EVP_CIPHER_CTX_set_app_data | ||
82 | .Nd unusual EVP cipher context configuration | ||
83 | .Sh SYNOPSIS | ||
84 | .In openssl/evp.h | ||
85 | .Ft void | ||
86 | .Fo EVP_CIPHER_CTX_set_flags | ||
87 | .Fa "EVP_CIPHER_CTX *ctx" | ||
88 | .Fa "int flags" | ||
89 | .Fc | ||
90 | .Ft void | ||
91 | .Fo EVP_CIPHER_CTX_clear_flags | ||
92 | .Fa "EVP_CIPHER_CTX *ctx" | ||
93 | .Fa "int flags" | ||
94 | .Fc | ||
95 | .Ft int | ||
96 | .Fo EVP_CIPHER_CTX_test_flags | ||
97 | .Fa "EVP_CIPHER_CTX *ctx" | ||
98 | .Fa "int flags" | ||
99 | .Fc | ||
100 | .Ft int | ||
101 | .Fo EVP_CIPHER_CTX_rand_key | ||
102 | .Fa "EVP_CIPHER_CTX *ctx" | ||
103 | .Fa "unsigned char *key" | ||
104 | .Fc | ||
105 | .Ft int | ||
106 | .Fo EVP_CIPHER_param_to_asn1 | ||
107 | .Fa "EVP_CIPHER_CTX *c" | ||
108 | .Fa "ASN1_TYPE *type" | ||
109 | .Fc | ||
110 | .Ft int | ||
111 | .Fo EVP_CIPHER_asn1_to_param | ||
112 | .Fa "EVP_CIPHER_CTX *c" | ||
113 | .Fa "ASN1_TYPE *type" | ||
114 | .Fc | ||
115 | .Ft void * | ||
116 | .Fo EVP_CIPHER_CTX_get_app_data | ||
117 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
118 | .Fc | ||
119 | .Ft void | ||
120 | .Fo EVP_CIPHER_CTX_set_app_data | ||
121 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
122 | .Fa "void *data" | ||
123 | .Fc | ||
124 | .Sh DESCRIPTION | ||
125 | .Fn EVP_CIPHER_CTX_set_flags | ||
126 | enables the given | ||
127 | .Fa flags | ||
128 | in | ||
129 | .Fa ctx . | ||
130 | .Fn EVP_CIPHER_CTX_clear_flags | ||
131 | disables the given | ||
132 | .Fa flags | ||
133 | in | ||
134 | .Fa ctx . | ||
135 | .Fn EVP_CIPHER_CTX_test_flags | ||
136 | checks whether any of the given | ||
137 | .Fa flags | ||
138 | are currently set in | ||
139 | .Fa ctx , | ||
140 | returning the subset of the | ||
141 | .Fa flags | ||
142 | that are set, or 0 if none of them are set. | ||
143 | Currently, the only supported cipher context flag is | ||
144 | .Dv EVP_CIPHER_CTX_FLAG_WRAP_ALLOW ; | ||
145 | see | ||
146 | .Xr EVP_aes_128_wrap 3 | ||
147 | for details. | ||
148 | .Pp | ||
149 | .Fn EVP_CIPHER_CTX_rand_key | ||
150 | generates a random key of the appropriate length based on the cipher | ||
151 | context. | ||
152 | The | ||
153 | .Vt EVP_CIPHER | ||
154 | can provide its own random key generation routine to support keys | ||
155 | of a specific form. | ||
156 | The | ||
157 | .Fa key | ||
158 | argument must point to a buffer at least as big as the value returned by | ||
159 | .Xr EVP_CIPHER_CTX_key_length 3 . | ||
160 | .Pp | ||
161 | .Fn EVP_CIPHER_param_to_asn1 | ||
162 | sets the ASN.1 | ||
163 | .Vt AlgorithmIdentifier | ||
164 | parameter based on the passed cipher. | ||
165 | This will typically include any parameters and an IV. | ||
166 | The cipher IV (if any) must be set when this call is made. | ||
167 | This call should be made before the cipher is actually "used" (before any | ||
168 | .Xr EVP_EncryptUpdate 3 | ||
169 | or | ||
170 | .Xr EVP_DecryptUpdate 3 | ||
171 | calls, for example). | ||
172 | This function may fail if the cipher does not have any ASN.1 support. | ||
173 | .Pp | ||
174 | .Fn EVP_CIPHER_asn1_to_param | ||
175 | sets the cipher parameters based on an ASN.1 | ||
176 | .Vt AlgorithmIdentifier | ||
177 | parameter. | ||
178 | The precise effect depends on the cipher. | ||
179 | In the case of RC2, for example, it will set the IV and effective | ||
180 | key length. | ||
181 | This function should be called after the base cipher type is set but | ||
182 | before the key is set. | ||
183 | For example | ||
184 | .Xr EVP_CipherInit 3 | ||
185 | will be called with the IV and key set to | ||
186 | .Dv NULL , | ||
187 | .Fn EVP_CIPHER_asn1_to_param | ||
188 | will be called and finally | ||
189 | .Xr EVP_CipherInit 3 | ||
190 | again with all parameters except the key set to | ||
191 | .Dv NULL . | ||
192 | It is possible for this function to fail if the cipher does not | ||
193 | have any ASN.1 support or the parameters cannot be set (for example | ||
194 | the RC2 effective key length is not supported). | ||
195 | .Sh RETURN VALUES | ||
196 | .Fn EVP_CIPHER_CTX_rand_key | ||
197 | return 1 for success or 0 for failure. | ||
198 | .Pp | ||
199 | .Fn EVP_CIPHER_param_to_asn1 | ||
200 | and | ||
201 | .Fn EVP_CIPHER_asn1_to_param | ||
202 | return greater than zero for success and zero or a negative number | ||
203 | for failure. | ||
204 | .Sh SEE ALSO | ||
205 | .Xr evp 3 , | ||
206 | .Xr EVP_CIPHER_CTX_ctrl 3 , | ||
207 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 , | ||
208 | .Xr EVP_CIPHER_nid 3 , | ||
209 | .Xr EVP_EncryptInit 3 | ||
210 | .Sh HISTORY | ||
211 | .Fn EVP_CIPHER_CTX_set_app_data | ||
212 | and | ||
213 | .Fn EVP_CIPHER_CTX_get_app_data | ||
214 | first appeared in SSLeay 0.8.0. | ||
215 | .Fn EVP_CIPHER_param_to_asn1 | ||
216 | and | ||
217 | .Fn EVP_CIPHER_asn1_to_param | ||
218 | first appeared in SSLeay 0.9.0. | ||
219 | These functions have been available since | ||
220 | .Ox 2.4 . | ||
221 | .Pp | ||
222 | .Fn EVP_CIPHER_CTX_rand_key | ||
223 | first appeared in OpenSSL 0.9.8 and has been available since | ||
224 | .Ox 4.5 . | ||
225 | .Sh BUGS | ||
226 | The ASN.1 code is incomplete (and sometimes inaccurate). | ||
227 | It has only been tested for certain common S/MIME ciphers | ||
228 | (RC2, DES, triple DES) in CBC mode. | ||
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_nid.3 b/src/lib/libcrypto/man/EVP_CIPHER_nid.3 new file mode 100644 index 0000000000..3a3c42d0b4 --- /dev/null +++ b/src/lib/libcrypto/man/EVP_CIPHER_nid.3 | |||
@@ -0,0 +1,215 @@ | |||
1 | .\" $OpenBSD: EVP_CIPHER_nid.3,v 1.1 2023/08/31 17:27:41 schwarze Exp $ | ||
2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | ||
3 | .\" | ||
4 | .\" This file is a derived work. | ||
5 | .\" The changes are covered by the following Copyright and license: | ||
6 | .\" | ||
7 | .\" Copyright (c) 2018 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 Dr. Stephen Henson <steve@openssl.org>. | ||
22 | .\" Copyright (c) 2000 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: August 31 2023 $ | ||
69 | .Dt EVP_CIPHER_NID 3 | ||
70 | .Os | ||
71 | .Sh NAME | ||
72 | .Nm EVP_CIPHER_nid , | ||
73 | .Nm EVP_CIPHER_CTX_nid , | ||
74 | .Nm EVP_CIPHER_type , | ||
75 | .Nm EVP_CIPHER_CTX_type , | ||
76 | .Nm EVP_CIPHER_block_size , | ||
77 | .Nm EVP_CIPHER_CTX_block_size , | ||
78 | .Nm EVP_CIPHER_flags , | ||
79 | .Nm EVP_CIPHER_CTX_flags , | ||
80 | .Nm EVP_CIPHER_mode , | ||
81 | .Nm EVP_CIPHER_CTX_mode | ||
82 | .Nd inspect EVP_CIPHER objects | ||
83 | .Sh SYNOPSIS | ||
84 | .In openssl/evp.h | ||
85 | .Ft int | ||
86 | .Fo EVP_CIPHER_nid | ||
87 | .Fa "const EVP_CIPHER *e" | ||
88 | .Fc | ||
89 | .Ft int | ||
90 | .Fo EVP_CIPHER_CTX_nid | ||
91 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
92 | .Fc | ||
93 | .Ft int | ||
94 | .Fo EVP_CIPHER_type | ||
95 | .Fa "const EVP_CIPHER *ctx" | ||
96 | .Fc | ||
97 | .Ft int | ||
98 | .Fo EVP_CIPHER_CTX_type | ||
99 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
100 | .Fc | ||
101 | .Ft int | ||
102 | .Fo EVP_CIPHER_block_size | ||
103 | .Fa "const EVP_CIPHER *e" | ||
104 | .Fc | ||
105 | .Ft int | ||
106 | .Fo EVP_CIPHER_CTX_block_size | ||
107 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
108 | .Fc | ||
109 | .Ft unsigned long | ||
110 | .Fo EVP_CIPHER_flags | ||
111 | .Fa "const EVP_CIPHER *e" | ||
112 | .Fc | ||
113 | .Ft unsigned long | ||
114 | .Fo EVP_CIPHER_CTX_flags | ||
115 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
116 | .Fc | ||
117 | .Ft unsigned long | ||
118 | .Fo EVP_CIPHER_mode | ||
119 | .Fa "const EVP_CIPHER *e" | ||
120 | .Fc | ||
121 | .Ft unsigned long | ||
122 | .Fo EVP_CIPHER_CTX_mode | ||
123 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
124 | .Fc | ||
125 | .Sh DESCRIPTION | ||
126 | .Fn EVP_CIPHER_nid | ||
127 | and | ||
128 | .Fn EVP_CIPHER_CTX_nid | ||
129 | return the NID of a cipher when passed an | ||
130 | .Vt EVP_CIPHER | ||
131 | or | ||
132 | .Vt EVP_CIPHER_CTX | ||
133 | structure. | ||
134 | The actual NID value is an internal value which may not have a | ||
135 | corresponding OBJECT IDENTIFIER. | ||
136 | .Pp | ||
137 | .Fn EVP_CIPHER_type | ||
138 | and | ||
139 | .Fn EVP_CIPHER_CTX_type | ||
140 | return the type of the passed cipher or context. | ||
141 | This "type" is the actual NID of the cipher OBJECT IDENTIFIER as such it | ||
142 | ignores the cipher parameters and 40-bit RC2 and 128-bit RC2 have the | ||
143 | same NID. | ||
144 | If the cipher does not have an object identifier or does not | ||
145 | have ASN.1 support, this function will return | ||
146 | .Dv NID_undef . | ||
147 | .Pp | ||
148 | .Fn EVP_CIPHER_block_size | ||
149 | and | ||
150 | .Fn EVP_CIPHER_CTX_block_size | ||
151 | return the block size of a cipher when passed an | ||
152 | .Vt EVP_CIPHER | ||
153 | or | ||
154 | .Vt EVP_CIPHER_CTX | ||
155 | structure. | ||
156 | The constant | ||
157 | .Dv EVP_MAX_BLOCK_LENGTH | ||
158 | is also the maximum block length for all ciphers. | ||
159 | .Pp | ||
160 | .Fn EVP_CIPHER_mode | ||
161 | and | ||
162 | .Fn EVP_CIPHER_CTX_mode | ||
163 | return the block cipher mode: | ||
164 | .Dv EVP_CIPH_ECB_MODE , | ||
165 | .Dv EVP_CIPH_CBC_MODE , | ||
166 | .Dv EVP_CIPH_CFB_MODE , | ||
167 | .Dv EVP_CIPH_OFB_MODE , | ||
168 | .Dv EVP_CIPH_CTR_MODE , | ||
169 | or | ||
170 | .Dv EVP_CIPH_XTS_MODE . | ||
171 | If the cipher is a stream cipher then | ||
172 | .Dv EVP_CIPH_STREAM_CIPHER | ||
173 | is returned. | ||
174 | .Sh RETURN VALUES | ||
175 | .Fn EVP_CIPHER_nid | ||
176 | and | ||
177 | .Fn EVP_CIPHER_CTX_nid | ||
178 | return a NID. | ||
179 | .Pp | ||
180 | .Fn EVP_CIPHER_type | ||
181 | and | ||
182 | .Fn EVP_CIPHER_CTX_type | ||
183 | return the NID of the cipher's OBJECT IDENTIFIER or | ||
184 | .Dv NID_undef | ||
185 | if it has no defined OBJECT IDENTIFIER. | ||
186 | .Pp | ||
187 | .Fn EVP_CIPHER_block_size | ||
188 | and | ||
189 | .Fn EVP_CIPHER_CTX_block_size | ||
190 | return the block size. | ||
191 | .Sh SEE ALSO | ||
192 | .Xr evp 3 , | ||
193 | .Xr EVP_CIPHER_CTX_ctrl 3 , | ||
194 | .Xr EVP_EncryptInit 3 | ||
195 | .Sh HISTORY | ||
196 | .Fn EVP_CIPHER_type , | ||
197 | .Fn EVP_CIPHER_CTX_type , | ||
198 | .Fn EVP_CIPHER_block_size , | ||
199 | and | ||
200 | .Fn EVP_CIPHER_CTX_block_size | ||
201 | first appeared in SSLeay 0.6.5. | ||
202 | .Fn EVP_CIPHER_nid | ||
203 | and | ||
204 | .Fn EVP_CIPHER_CTX_nid | ||
205 | first appeared in SSLeay 0.8.0. | ||
206 | All these functions have been available since | ||
207 | .Ox 2.4 . | ||
208 | .Pp | ||
209 | .Fn EVP_CIPHER_flags , | ||
210 | .Fn EVP_CIPHER_CTX_flags , | ||
211 | .Fn EVP_CIPHER_mode , | ||
212 | and | ||
213 | .Fn EVP_CIPHER_CTX_mode | ||
214 | first appeared in OpenSSL 0.9.6 and have been available since | ||
215 | .Ox 2.9 . | ||
diff --git a/src/lib/libcrypto/man/EVP_EncryptInit.3 b/src/lib/libcrypto/man/EVP_EncryptInit.3 index b6d9080bea..ddec4e7e79 100644 --- a/src/lib/libcrypto/man/EVP_EncryptInit.3 +++ b/src/lib/libcrypto/man/EVP_EncryptInit.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: EVP_EncryptInit.3,v 1.47 2023/08/26 15:01:56 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_EncryptInit.3,v 1.48 2023/08/31 17:27:41 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 | 2 | .\" full merge up to: OpenSSL 5211e094 Nov 11 14:39:11 2014 -0800 |
3 | .\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod | 3 | .\" EVP_bf_cbc.pod EVP_cast5_cbc.pod EVP_idea_cbc.pod EVP_rc2_cbc.pod |
4 | .\" 7c6d372a Nov 20 13:20:01 2018 +0000 | 4 | .\" 7c6d372a Nov 20 13:20:01 2018 +0000 |
@@ -69,7 +69,7 @@ | |||
69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 69 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 70 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
71 | .\" | 71 | .\" |
72 | .Dd $Mdocdate: August 26 2023 $ | 72 | .Dd $Mdocdate: August 31 2023 $ |
73 | .Dt EVP_ENCRYPTINIT 3 | 73 | .Dt EVP_ENCRYPTINIT 3 |
74 | .Os | 74 | .Os |
75 | .Sh NAME | 75 | .Sh NAME |
@@ -96,37 +96,10 @@ | |||
96 | .Nm EVP_CipherFinal , | 96 | .Nm EVP_CipherFinal , |
97 | .Nm EVP_Cipher , | 97 | .Nm EVP_Cipher , |
98 | .Nm EVP_CIPHER_CTX_encrypting , | 98 | .Nm EVP_CIPHER_CTX_encrypting , |
99 | .Nm EVP_CIPHER_CTX_set_flags , | ||
100 | .Nm EVP_CIPHER_CTX_clear_flags , | ||
101 | .Nm EVP_CIPHER_CTX_test_flags , | ||
102 | .Nm EVP_CIPHER_CTX_set_padding , | ||
103 | .Nm EVP_CIPHER_CTX_set_key_length , | ||
104 | .Nm EVP_CIPHER_CTX_ctrl , | ||
105 | .Nm EVP_CIPHER_CTX_rand_key , | ||
106 | .Nm EVP_get_cipherbyname , | 99 | .Nm EVP_get_cipherbyname , |
107 | .Nm EVP_get_cipherbynid , | 100 | .Nm EVP_get_cipherbynid , |
108 | .Nm EVP_get_cipherbyobj , | 101 | .Nm EVP_get_cipherbyobj , |
109 | .Nm EVP_CIPHER_nid , | ||
110 | .Nm EVP_CIPHER_block_size , | ||
111 | .Nm EVP_CIPHER_key_length , | ||
112 | .Nm EVP_CIPHER_iv_length , | ||
113 | .Nm EVP_CIPHER_flags , | ||
114 | .Nm EVP_CIPHER_mode , | ||
115 | .Nm EVP_CIPHER_type , | ||
116 | .Nm EVP_CIPHER_CTX_cipher , | 102 | .Nm EVP_CIPHER_CTX_cipher , |
117 | .Nm EVP_CIPHER_CTX_nid , | ||
118 | .Nm EVP_CIPHER_CTX_block_size , | ||
119 | .Nm EVP_CIPHER_CTX_key_length , | ||
120 | .Nm EVP_CIPHER_CTX_iv_length , | ||
121 | .Nm EVP_CIPHER_CTX_get_iv , | ||
122 | .Nm EVP_CIPHER_CTX_set_iv , | ||
123 | .Nm EVP_CIPHER_CTX_get_app_data , | ||
124 | .Nm EVP_CIPHER_CTX_set_app_data , | ||
125 | .Nm EVP_CIPHER_CTX_type , | ||
126 | .Nm EVP_CIPHER_CTX_flags , | ||
127 | .Nm EVP_CIPHER_CTX_mode , | ||
128 | .Nm EVP_CIPHER_param_to_asn1 , | ||
129 | .Nm EVP_CIPHER_asn1_to_param , | ||
130 | .Nm EVP_enc_null , | 103 | .Nm EVP_enc_null , |
131 | .Nm EVP_idea_cbc , | 104 | .Nm EVP_idea_cbc , |
132 | .Nm EVP_idea_ecb , | 105 | .Nm EVP_idea_ecb , |
@@ -294,43 +267,6 @@ | |||
294 | .Fo EVP_CIPHER_CTX_encrypting | 267 | .Fo EVP_CIPHER_CTX_encrypting |
295 | .Fa "const EVP_CIPHER_CTX *ctx" | 268 | .Fa "const EVP_CIPHER_CTX *ctx" |
296 | .Fc | 269 | .Fc |
297 | .Ft void | ||
298 | .Fo EVP_CIPHER_CTX_set_flags | ||
299 | .Fa "EVP_CIPHER_CTX *ctx" | ||
300 | .Fa "int flags" | ||
301 | .Fc | ||
302 | .Ft void | ||
303 | .Fo EVP_CIPHER_CTX_clear_flags | ||
304 | .Fa "EVP_CIPHER_CTX *ctx" | ||
305 | .Fa "int flags" | ||
306 | .Fc | ||
307 | .Ft int | ||
308 | .Fo EVP_CIPHER_CTX_test_flags | ||
309 | .Fa "EVP_CIPHER_CTX *ctx" | ||
310 | .Fa "int flags" | ||
311 | .Fc | ||
312 | .Ft int | ||
313 | .Fo EVP_CIPHER_CTX_set_padding | ||
314 | .Fa "EVP_CIPHER_CTX *x" | ||
315 | .Fa "int padding" | ||
316 | .Fc | ||
317 | .Ft int | ||
318 | .Fo EVP_CIPHER_CTX_set_key_length | ||
319 | .Fa "EVP_CIPHER_CTX *x" | ||
320 | .Fa "int keylen" | ||
321 | .Fc | ||
322 | .Ft int | ||
323 | .Fo EVP_CIPHER_CTX_ctrl | ||
324 | .Fa "EVP_CIPHER_CTX *ctx" | ||
325 | .Fa "int type" | ||
326 | .Fa "int arg" | ||
327 | .Fa "void *ptr" | ||
328 | .Fc | ||
329 | .Ft int | ||
330 | .Fo EVP_CIPHER_CTX_rand_key | ||
331 | .Fa "EVP_CIPHER_CTX *ctx" | ||
332 | .Fa "unsigned char *key" | ||
333 | .Fc | ||
334 | .Ft const EVP_CIPHER * | 270 | .Ft const EVP_CIPHER * |
335 | .Fo EVP_get_cipherbyname | 271 | .Fo EVP_get_cipherbyname |
336 | .Fa "const char *name" | 272 | .Fa "const char *name" |
@@ -343,97 +279,10 @@ | |||
343 | .Fo EVP_get_cipherbyobj | 279 | .Fo EVP_get_cipherbyobj |
344 | .Fa "const ASN1_OBJECT *a" | 280 | .Fa "const ASN1_OBJECT *a" |
345 | .Fc | 281 | .Fc |
346 | .Ft int | ||
347 | .Fo EVP_CIPHER_nid | ||
348 | .Fa "const EVP_CIPHER *e" | ||
349 | .Fc | ||
350 | .Ft int | ||
351 | .Fo EVP_CIPHER_block_size | ||
352 | .Fa "const EVP_CIPHER *e" | ||
353 | .Fc | ||
354 | .Ft int | ||
355 | .Fo EVP_CIPHER_key_length | ||
356 | .Fa "const EVP_CIPHER *e" | ||
357 | .Fc | ||
358 | .Ft int | ||
359 | .Fo EVP_CIPHER_iv_length | ||
360 | .Fa "const EVP_CIPHER *e" | ||
361 | .Fc | ||
362 | .Ft unsigned long | ||
363 | .Fo EVP_CIPHER_flags | ||
364 | .Fa "const EVP_CIPHER *e" | ||
365 | .Fc | ||
366 | .Ft unsigned long | ||
367 | .Fo EVP_CIPHER_mode | ||
368 | .Fa "const EVP_CIPHER *e" | ||
369 | .Fc | ||
370 | .Ft int | ||
371 | .Fo EVP_CIPHER_type | ||
372 | .Fa "const EVP_CIPHER *ctx" | ||
373 | .Fc | ||
374 | .Ft const EVP_CIPHER * | 282 | .Ft const EVP_CIPHER * |
375 | .Fo EVP_CIPHER_CTX_cipher | 283 | .Fo EVP_CIPHER_CTX_cipher |
376 | .Fa "const EVP_CIPHER_CTX *ctx" | 284 | .Fa "const EVP_CIPHER_CTX *ctx" |
377 | .Fc | 285 | .Fc |
378 | .Ft int | ||
379 | .Fo EVP_CIPHER_CTX_nid | ||
380 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
381 | .Fc | ||
382 | .Ft int | ||
383 | .Fo EVP_CIPHER_CTX_block_size | ||
384 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
385 | .Fc | ||
386 | .Ft int | ||
387 | .Fo EVP_CIPHER_CTX_key_length | ||
388 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
389 | .Fc | ||
390 | .Ft int | ||
391 | .Fo EVP_CIPHER_CTX_iv_length | ||
392 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
393 | .Fc | ||
394 | .Ft int | ||
395 | .Fo EVP_CIPHER_CTX_get_iv | ||
396 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
397 | .Fa "unsigned char *iv" | ||
398 | .Fa "size_t len" | ||
399 | .Fc | ||
400 | .Ft int | ||
401 | .Fo EVP_CIPHER_CTX_set_iv | ||
402 | .Fa "EVP_CIPHER_CTX *ctx" | ||
403 | .Fa "const unsigned char *iv" | ||
404 | .Fa "size_t len" | ||
405 | .Fc | ||
406 | .Ft void * | ||
407 | .Fo EVP_CIPHER_CTX_get_app_data | ||
408 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
409 | .Fc | ||
410 | .Ft void | ||
411 | .Fo EVP_CIPHER_CTX_set_app_data | ||
412 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
413 | .Fa "void *data" | ||
414 | .Fc | ||
415 | .Ft int | ||
416 | .Fo EVP_CIPHER_CTX_type | ||
417 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
418 | .Fc | ||
419 | .Ft unsigned long | ||
420 | .Fo EVP_CIPHER_CTX_flags | ||
421 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
422 | .Fc | ||
423 | .Ft unsigned long | ||
424 | .Fo EVP_CIPHER_CTX_mode | ||
425 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
426 | .Fc | ||
427 | .Ft int | ||
428 | .Fo EVP_CIPHER_param_to_asn1 | ||
429 | .Fa "EVP_CIPHER_CTX *c" | ||
430 | .Fa "ASN1_TYPE *type" | ||
431 | .Fc | ||
432 | .Ft int | ||
433 | .Fo EVP_CIPHER_asn1_to_param | ||
434 | .Fa "EVP_CIPHER_CTX *c" | ||
435 | .Fa "ASN1_TYPE *type" | ||
436 | .Fc | ||
437 | .Sh DESCRIPTION | 286 | .Sh DESCRIPTION |
438 | The EVP cipher routines are a high level interface to certain symmetric | 287 | The EVP cipher routines are a high level interface to certain symmetric |
439 | ciphers. | 288 | ciphers. |
@@ -492,7 +341,7 @@ and | |||
492 | objects used by | 341 | objects used by |
493 | .Fa in | 342 | .Fa in |
494 | and any application specific data set with | 343 | and any application specific data set with |
495 | .Fn EVP_CIPHER_CTX_set_app_data | 344 | .Xr EVP_CIPHER_CTX_set_app_data 3 |
496 | are not copied and | 345 | are not copied and |
497 | .Fa out | 346 | .Fa out |
498 | will point to the same three objects. | 347 | will point to the same three objects. |
@@ -507,7 +356,7 @@ If the bit | |||
507 | .Dv EVP_CIPH_CUSTOM_COPY | 356 | .Dv EVP_CIPH_CUSTOM_COPY |
508 | has been set with | 357 | has been set with |
509 | .Xr EVP_CIPHER_meth_set_flags 3 , | 358 | .Xr EVP_CIPHER_meth_set_flags 3 , |
510 | .Fn EVP_CIPHER_CTX_ctrl | 359 | .Xr EVP_CIPHER_CTX_ctrl 3 |
511 | is called at the end with arguments | 360 | is called at the end with arguments |
512 | .Fa in , | 361 | .Fa in , |
513 | .Dv EVP_CTRL_COPY , | 362 | .Dv EVP_CTRL_COPY , |
@@ -690,123 +539,6 @@ structure when passed a cipher name, a NID or an | |||
690 | .Vt ASN1_OBJECT | 539 | .Vt ASN1_OBJECT |
691 | structure. | 540 | structure. |
692 | .Pp | 541 | .Pp |
693 | .Fn EVP_CIPHER_nid | ||
694 | and | ||
695 | .Fn EVP_CIPHER_CTX_nid | ||
696 | return the NID of a cipher when passed an | ||
697 | .Vt EVP_CIPHER | ||
698 | or | ||
699 | .Vt EVP_CIPHER_CTX | ||
700 | structure. | ||
701 | The actual NID value is an internal value which may not have a | ||
702 | corresponding OBJECT IDENTIFIER. | ||
703 | .Pp | ||
704 | .Fn EVP_CIPHER_CTX_set_flags | ||
705 | enables the given | ||
706 | .Fa flags | ||
707 | in | ||
708 | .Fa ctx . | ||
709 | .Fn EVP_CIPHER_CTX_clear_flags | ||
710 | disables the given | ||
711 | .Fa flags | ||
712 | in | ||
713 | .Fa ctx . | ||
714 | .Fn EVP_CIPHER_CTX_test_flags | ||
715 | checks whether any of the given | ||
716 | .Fa flags | ||
717 | are currently set in | ||
718 | .Fa ctx , | ||
719 | returning the subset of the | ||
720 | .Fa flags | ||
721 | that are set, or 0 if none of them are set. | ||
722 | Currently, the only supported cipher context flag is | ||
723 | .Dv EVP_CIPHER_CTX_FLAG_WRAP_ALLOW ; | ||
724 | see | ||
725 | .Xr EVP_aes_128_wrap 3 | ||
726 | for details. | ||
727 | .Pp | ||
728 | .Fn EVP_CIPHER_CTX_set_padding | ||
729 | enables or disables padding. | ||
730 | This function should be called after the context is set up for | ||
731 | encryption or decryption with | ||
732 | .Fn EVP_EncryptInit_ex , | ||
733 | .Fn EVP_DecryptInit_ex , | ||
734 | or | ||
735 | .Fn EVP_CipherInit_ex . | ||
736 | By default encryption operations are padded using standard block padding | ||
737 | and the padding is checked and removed when decrypting. | ||
738 | If the | ||
739 | .Fa padding | ||
740 | parameter is zero, then no padding is performed, the total amount of data | ||
741 | encrypted or decrypted must then be a multiple of the block size or an | ||
742 | error will occur. | ||
743 | .Pp | ||
744 | .Fn EVP_CIPHER_key_length | ||
745 | and | ||
746 | .Fn EVP_CIPHER_CTX_key_length | ||
747 | return the key length of a cipher when passed an | ||
748 | .Vt EVP_CIPHER | ||
749 | or | ||
750 | .Vt EVP_CIPHER_CTX | ||
751 | structure. | ||
752 | The constant | ||
753 | .Dv EVP_MAX_KEY_LENGTH | ||
754 | is the maximum key length for all ciphers. | ||
755 | Note: although | ||
756 | .Fn EVP_CIPHER_key_length | ||
757 | is fixed for a given cipher, the value of | ||
758 | .Fn EVP_CIPHER_CTX_key_length | ||
759 | may be different for variable key length ciphers. | ||
760 | .Pp | ||
761 | .Fn EVP_CIPHER_CTX_set_key_length | ||
762 | sets the key length of the cipher ctx. | ||
763 | If the cipher is a fixed length cipher, then attempting to set the key | ||
764 | length to any value other than the fixed value is an error. | ||
765 | .Pp | ||
766 | .Fn EVP_CIPHER_iv_length | ||
767 | and | ||
768 | .Fn EVP_CIPHER_CTX_iv_length | ||
769 | return the IV length of a cipher when passed an | ||
770 | .Vt EVP_CIPHER | ||
771 | or | ||
772 | .Vt EVP_CIPHER_CTX . | ||
773 | It will return zero if the cipher does not use an IV. | ||
774 | The constant | ||
775 | .Dv EVP_MAX_IV_LENGTH | ||
776 | is the maximum IV length for all ciphers. | ||
777 | .Pp | ||
778 | .Fn EVP_CIPHER_CTX_get_iv | ||
779 | and | ||
780 | .Fn EVP_CIPHER_CTX_set_iv | ||
781 | will respectively retrieve and set the IV for an | ||
782 | .Vt EVP_CIPHER_CTX . | ||
783 | In both cases, the specified IV length must exactly equal the expected | ||
784 | IV length for the context as returned by | ||
785 | .Fn EVP_CIPHER_CTX_iv_length . | ||
786 | .Pp | ||
787 | .Fn EVP_CIPHER_block_size | ||
788 | and | ||
789 | .Fn EVP_CIPHER_CTX_block_size | ||
790 | return the block size of a cipher when passed an | ||
791 | .Vt EVP_CIPHER | ||
792 | or | ||
793 | .Vt EVP_CIPHER_CTX | ||
794 | structure. | ||
795 | The constant | ||
796 | .Dv EVP_MAX_BLOCK_LENGTH | ||
797 | is also the maximum block length for all ciphers. | ||
798 | .Pp | ||
799 | .Fn EVP_CIPHER_type | ||
800 | and | ||
801 | .Fn EVP_CIPHER_CTX_type | ||
802 | return the type of the passed cipher or context. | ||
803 | This "type" is the actual NID of the cipher OBJECT IDENTIFIER as such it | ||
804 | ignores the cipher parameters and 40-bit RC2 and 128-bit RC2 have the | ||
805 | same NID. | ||
806 | If the cipher does not have an object identifier or does not | ||
807 | have ASN.1 support, this function will return | ||
808 | .Dv NID_undef . | ||
809 | .Pp | ||
810 | .Fn EVP_CIPHER_CTX_cipher | 542 | .Fn EVP_CIPHER_CTX_cipher |
811 | returns the | 543 | returns the |
812 | .Vt EVP_CIPHER | 544 | .Vt EVP_CIPHER |
@@ -814,72 +546,6 @@ structure when passed an | |||
814 | .Vt EVP_CIPHER_CTX | 546 | .Vt EVP_CIPHER_CTX |
815 | structure. | 547 | structure. |
816 | .Pp | 548 | .Pp |
817 | .Fn EVP_CIPHER_mode | ||
818 | and | ||
819 | .Fn EVP_CIPHER_CTX_mode | ||
820 | return the block cipher mode: | ||
821 | .Dv EVP_CIPH_ECB_MODE , | ||
822 | .Dv EVP_CIPH_CBC_MODE , | ||
823 | .Dv EVP_CIPH_CFB_MODE , | ||
824 | .Dv EVP_CIPH_OFB_MODE , | ||
825 | .Dv EVP_CIPH_CTR_MODE , | ||
826 | or | ||
827 | .Dv EVP_CIPH_XTS_MODE . | ||
828 | If the cipher is a stream cipher then | ||
829 | .Dv EVP_CIPH_STREAM_CIPHER | ||
830 | is returned. | ||
831 | .Pp | ||
832 | .Fn EVP_CIPHER_param_to_asn1 | ||
833 | sets the ASN.1 | ||
834 | .Vt AlgorithmIdentifier | ||
835 | parameter based on the passed cipher. | ||
836 | This will typically include any parameters and an IV. | ||
837 | The cipher IV (if any) must be set when this call is made. | ||
838 | This call should be made before the cipher is actually "used" (before any | ||
839 | .Fn EVP_EncryptUpdate | ||
840 | or | ||
841 | .Fn EVP_DecryptUpdate | ||
842 | calls, for example). | ||
843 | This function may fail if the cipher does not have any ASN.1 support. | ||
844 | .Pp | ||
845 | .Fn EVP_CIPHER_asn1_to_param | ||
846 | sets the cipher parameters based on an ASN.1 | ||
847 | .Vt AlgorithmIdentifier | ||
848 | parameter. | ||
849 | The precise effect depends on the cipher. | ||
850 | In the case of RC2, for example, it will set the IV and effective | ||
851 | key length. | ||
852 | This function should be called after the base cipher type is set but | ||
853 | before the key is set. | ||
854 | For example | ||
855 | .Fn EVP_CipherInit | ||
856 | will be called with the IV and key set to | ||
857 | .Dv NULL , | ||
858 | .Fn EVP_CIPHER_asn1_to_param | ||
859 | will be called and finally | ||
860 | .Fn EVP_CipherInit | ||
861 | again with all parameters except the key set to | ||
862 | .Dv NULL . | ||
863 | It is possible for this function to fail if the cipher does not | ||
864 | have any ASN.1 support or the parameters cannot be set (for example | ||
865 | the RC2 effective key length is not supported). | ||
866 | .Pp | ||
867 | .Fn EVP_CIPHER_CTX_ctrl | ||
868 | allows various cipher specific parameters to be determined and set. | ||
869 | Currently only the RC2 effective key length can be set. | ||
870 | .Pp | ||
871 | .Fn EVP_CIPHER_CTX_rand_key | ||
872 | generates a random key of the appropriate length based on the cipher | ||
873 | context. | ||
874 | The | ||
875 | .Vt EVP_CIPHER | ||
876 | can provide its own random key generation routine to support keys | ||
877 | of a specific form. | ||
878 | The | ||
879 | .Fa key | ||
880 | argument must point to a buffer at least as big as the value returned by | ||
881 | .Fn EVP_CIPHER_CTX_key_length . | ||
882 | .Pp | ||
883 | Where possible the EVP interface to symmetric ciphers should be | 549 | Where possible the EVP interface to symmetric ciphers should be |
884 | used in preference to the low level interfaces. | 550 | used in preference to the low level interfaces. |
885 | This is because the code then becomes transparent to the cipher used and | 551 | This is because the code then becomes transparent to the cipher used and |
@@ -938,8 +604,6 @@ for failure. | |||
938 | .Fn EVP_CIPHER_CTX_reset , | 604 | .Fn EVP_CIPHER_CTX_reset , |
939 | .Fn EVP_CIPHER_CTX_cleanup , | 605 | .Fn EVP_CIPHER_CTX_cleanup , |
940 | .Fn EVP_CIPHER_CTX_copy , | 606 | .Fn EVP_CIPHER_CTX_copy , |
941 | .Fn EVP_CIPHER_CTX_get_iv , | ||
942 | .Fn EVP_CIPHER_CTX_set_iv , | ||
943 | .Fn EVP_EncryptInit_ex , | 607 | .Fn EVP_EncryptInit_ex , |
944 | .Fn EVP_EncryptUpdate , | 608 | .Fn EVP_EncryptUpdate , |
945 | .Fn EVP_EncryptFinal_ex , | 609 | .Fn EVP_EncryptFinal_ex , |
@@ -955,10 +619,8 @@ for failure. | |||
955 | .Fn EVP_DecryptFinal , | 619 | .Fn EVP_DecryptFinal , |
956 | .Fn EVP_CipherInit , | 620 | .Fn EVP_CipherInit , |
957 | .Fn EVP_CipherFinal , | 621 | .Fn EVP_CipherFinal , |
958 | .Fn EVP_Cipher , | ||
959 | .Fn EVP_CIPHER_CTX_set_key_length , | ||
960 | and | 622 | and |
961 | .Fn EVP_CIPHER_CTX_rand_key | 623 | .Fn EVP_Cipher |
962 | return 1 for success or 0 for failure. | 624 | return 1 for success or 0 for failure. |
963 | .Pp | 625 | .Pp |
964 | .Fn EVP_CIPHER_CTX_encrypting | 626 | .Fn EVP_CIPHER_CTX_encrypting |
@@ -967,18 +629,6 @@ returns 1 if | |||
967 | is initialized for encryption or 0 otherwise, in which case | 629 | is initialized for encryption or 0 otherwise, in which case |
968 | it may be uninitialized or initialized for decryption. | 630 | it may be uninitialized or initialized for decryption. |
969 | .Pp | 631 | .Pp |
970 | .Fn EVP_CIPHER_CTX_set_padding | ||
971 | always returns 1. | ||
972 | .Pp | ||
973 | .Fn EVP_CIPHER_CTX_ctrl | ||
974 | usually returns 1 for success, 0 for failure, or \-1 if the | ||
975 | .Fa type | ||
976 | is not supported by the | ||
977 | .Fa ctx , | ||
978 | but there may be exceptions for some | ||
979 | .Fa type | ||
980 | arguments. | ||
981 | .Pp | ||
982 | .Fn EVP_get_cipherbyname , | 632 | .Fn EVP_get_cipherbyname , |
983 | .Fn EVP_get_cipherbynid , | 633 | .Fn EVP_get_cipherbynid , |
984 | and | 634 | and |
@@ -989,43 +639,10 @@ structure or | |||
989 | .Dv NULL | 639 | .Dv NULL |
990 | on error. | 640 | on error. |
991 | .Pp | 641 | .Pp |
992 | .Fn EVP_CIPHER_nid | ||
993 | and | ||
994 | .Fn EVP_CIPHER_CTX_nid | ||
995 | return a NID. | ||
996 | .Pp | ||
997 | .Fn EVP_CIPHER_block_size | ||
998 | and | ||
999 | .Fn EVP_CIPHER_CTX_block_size | ||
1000 | return the block size. | ||
1001 | .Pp | ||
1002 | .Fn EVP_CIPHER_key_length | ||
1003 | and | ||
1004 | .Fn EVP_CIPHER_CTX_key_length | ||
1005 | return the key length. | ||
1006 | .Pp | ||
1007 | .Fn EVP_CIPHER_iv_length | ||
1008 | and | ||
1009 | .Fn EVP_CIPHER_CTX_iv_length | ||
1010 | return the IV length or zero if the cipher does not use an IV. | ||
1011 | .Pp | ||
1012 | .Fn EVP_CIPHER_type | ||
1013 | and | ||
1014 | .Fn EVP_CIPHER_CTX_type | ||
1015 | return the NID of the cipher's OBJECT IDENTIFIER or | ||
1016 | .Dv NID_undef | ||
1017 | if it has no defined OBJECT IDENTIFIER. | ||
1018 | .Pp | ||
1019 | .Fn EVP_CIPHER_CTX_cipher | 642 | .Fn EVP_CIPHER_CTX_cipher |
1020 | returns an | 643 | returns an |
1021 | .Vt EVP_CIPHER | 644 | .Vt EVP_CIPHER |
1022 | structure. | 645 | structure. |
1023 | .Pp | ||
1024 | .Fn EVP_CIPHER_param_to_asn1 | ||
1025 | and | ||
1026 | .Fn EVP_CIPHER_asn1_to_param | ||
1027 | return greater than zero for success and zero or a negative number | ||
1028 | for failure. | ||
1029 | .Sh CIPHER LISTING | 646 | .Sh CIPHER LISTING |
1030 | All algorithms have a fixed key length unless otherwise stated. | 647 | All algorithms have a fixed key length unless otherwise stated. |
1031 | .Bl -tag -width Ds | 648 | .Bl -tag -width Ds |
@@ -1064,9 +681,9 @@ RC2 algorithm in CBC mode with a default key length and effective key | |||
1064 | length of 40 and 64 bits. | 681 | length of 40 and 64 bits. |
1065 | These are obsolete and new code should use | 682 | These are obsolete and new code should use |
1066 | .Fn EVP_rc2_cbc , | 683 | .Fn EVP_rc2_cbc , |
1067 | .Fn EVP_CIPHER_CTX_set_key_length , | 684 | .Xr EVP_CIPHER_CTX_set_key_length 3 , |
1068 | and | 685 | and |
1069 | .Fn EVP_CIPHER_CTX_ctrl | 686 | .Xr EVP_CIPHER_CTX_ctrl 3 |
1070 | to set the key length and effective key length. | 687 | to set the key length and effective key length. |
1071 | .It Xo | 688 | .It Xo |
1072 | .Fn EVP_bf_cbc , | 689 | .Fn EVP_bf_cbc , |
@@ -1310,7 +927,10 @@ do_crypt(FILE *in, FILE *out, int do_encrypt) | |||
1310 | .Xr EVP_aes_128_cbc 3 , | 927 | .Xr EVP_aes_128_cbc 3 , |
1311 | .Xr EVP_camellia_128_cbc 3 , | 928 | .Xr EVP_camellia_128_cbc 3 , |
1312 | .Xr EVP_chacha20 3 , | 929 | .Xr EVP_chacha20 3 , |
930 | .Xr EVP_CIPHER_CTX_ctrl 3 , | ||
1313 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 , | 931 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 , |
932 | .Xr EVP_CIPHER_CTX_set_flags 3 , | ||
933 | .Xr EVP_CIPHER_nid 3 , | ||
1314 | .Xr EVP_des_cbc 3 , | 934 | .Xr EVP_des_cbc 3 , |
1315 | .Xr EVP_OpenInit 3 , | 935 | .Xr EVP_OpenInit 3 , |
1316 | .Xr EVP_rc4 3 , | 936 | .Xr EVP_rc4 3 , |
@@ -1339,16 +959,7 @@ first appeared in SSLeay 0.5.1. | |||
1339 | and | 959 | and |
1340 | .Fn EVP_rc2_ofb | 960 | .Fn EVP_rc2_ofb |
1341 | first appeared in SSLeay 0.5.2. | 961 | first appeared in SSLeay 0.5.2. |
1342 | .Fn EVP_Cipher , | 962 | .Fn EVP_Cipher |
1343 | .Fn EVP_CIPHER_block_size , | ||
1344 | .Fn EVP_CIPHER_key_length , | ||
1345 | .Fn EVP_CIPHER_iv_length , | ||
1346 | .Fn EVP_CIPHER_type , | ||
1347 | .Fn EVP_CIPHER_CTX_block_size , | ||
1348 | .Fn EVP_CIPHER_CTX_key_length , | ||
1349 | .Fn EVP_CIPHER_CTX_iv_length , | ||
1350 | and | ||
1351 | .Fn EVP_CIPHER_CTX_type | ||
1352 | first appeared in SSLeay 0.6.5. | 963 | first appeared in SSLeay 0.6.5. |
1353 | .Fn EVP_bf_cbc , | 964 | .Fn EVP_bf_cbc , |
1354 | .Fn EVP_bf_ecb , | 965 | .Fn EVP_bf_ecb , |
@@ -1358,20 +969,13 @@ and | |||
1358 | first appeared in SSLeay 0.6.6. | 969 | first appeared in SSLeay 0.6.6. |
1359 | .Fn EVP_CIPHER_CTX_cleanup , | 970 | .Fn EVP_CIPHER_CTX_cleanup , |
1360 | .Fn EVP_get_cipherbyobj , | 971 | .Fn EVP_get_cipherbyobj , |
1361 | .Fn EVP_CIPHER_nid , | ||
1362 | .Fn EVP_CIPHER_CTX_cipher , | 972 | .Fn EVP_CIPHER_CTX_cipher , |
1363 | .Fn EVP_CIPHER_CTX_nid , | ||
1364 | .Fn EVP_CIPHER_CTX_get_app_data , | ||
1365 | .Fn EVP_CIPHER_CTX_set_app_data , | ||
1366 | and | 973 | and |
1367 | .Fn EVP_enc_null | 974 | .Fn EVP_enc_null |
1368 | first appeared in SSLeay 0.8.0. | 975 | first appeared in SSLeay 0.8.0. |
1369 | .Fn EVP_get_cipherbynid | 976 | .Fn EVP_get_cipherbynid |
1370 | first appeared in SSLeay 0.8.1. | 977 | first appeared in SSLeay 0.8.1. |
1371 | .Fn EVP_CIPHER_CTX_init , | 978 | .Fn EVP_CIPHER_CTX_init |
1372 | .Fn EVP_CIPHER_param_to_asn1 , | ||
1373 | and | ||
1374 | .Fn EVP_CIPHER_asn1_to_param | ||
1375 | first appeared in SSLeay 0.9.0. | 979 | first appeared in SSLeay 0.9.0. |
1376 | All these functions have been available since | 980 | All these functions have been available since |
1377 | .Ox 2.4 . | 981 | .Ox 2.4 . |
@@ -1379,30 +983,16 @@ All these functions have been available since | |||
1379 | .Fn EVP_rc2_40_cbc | 983 | .Fn EVP_rc2_40_cbc |
1380 | and | 984 | and |
1381 | .Fn EVP_rc2_64_cbc | 985 | .Fn EVP_rc2_64_cbc |
1382 | first appeared in SSL_eay 0.9.1. | 986 | first appeared in SSLeay 0.9.1 and have been available since |
1383 | .Fn EVP_CIPHER_CTX_type | ||
1384 | first appeared in OpenSSL 0.9.3. | ||
1385 | These functions have been available since | ||
1386 | .Ox 2.6 . | 987 | .Ox 2.6 . |
1387 | .Pp | 988 | .Pp |
1388 | .Fn EVP_CIPHER_CTX_set_key_length , | ||
1389 | .Fn EVP_CIPHER_CTX_ctrl , | ||
1390 | .Fn EVP_CIPHER_flags , | ||
1391 | .Fn EVP_CIPHER_mode , | ||
1392 | .Fn EVP_CIPHER_CTX_flags , | ||
1393 | and | ||
1394 | .Fn EVP_CIPHER_CTX_mode | ||
1395 | first appeared in OpenSSL 0.9.6 and have been available since | ||
1396 | .Ox 2.9 . | ||
1397 | .Pp | ||
1398 | .Fn EVP_EncryptInit_ex , | 989 | .Fn EVP_EncryptInit_ex , |
1399 | .Fn EVP_EncryptFinal_ex , | 990 | .Fn EVP_EncryptFinal_ex , |
1400 | .Fn EVP_DecryptInit_ex , | 991 | .Fn EVP_DecryptInit_ex , |
1401 | .Fn EVP_DecryptFinal_ex , | 992 | .Fn EVP_DecryptFinal_ex , |
1402 | .Fn EVP_CipherInit_ex , | 993 | .Fn EVP_CipherInit_ex , |
1403 | .Fn EVP_CipherFinal_ex , | ||
1404 | and | 994 | and |
1405 | .Fn EVP_CIPHER_CTX_set_padding | 995 | .Fn EVP_CipherFinal_ex |
1406 | first appeared in OpenSSL 0.9.7 and have been available since | 996 | first appeared in OpenSSL 0.9.7 and have been available since |
1407 | .Ox 3.2 . | 997 | .Ox 3.2 . |
1408 | .Pp | 998 | .Pp |
@@ -1414,13 +1004,10 @@ and | |||
1414 | first appeared in OpenSSL 0.9.7e and have been available since | 1004 | first appeared in OpenSSL 0.9.7e and have been available since |
1415 | .Ox 3.8 . | 1005 | .Ox 3.8 . |
1416 | .Pp | 1006 | .Pp |
1417 | .Fn EVP_CIPHER_CTX_rand_key | ||
1418 | first appeared in OpenSSL 0.9.8. | ||
1419 | .Fn EVP_CIPHER_CTX_new | 1007 | .Fn EVP_CIPHER_CTX_new |
1420 | and | 1008 | and |
1421 | .Fn EVP_CIPHER_CTX_free | 1009 | .Fn EVP_CIPHER_CTX_free |
1422 | first appeared in OpenSSL 0.9.8b. | 1010 | first appeared in OpenSSL 0.9.8b and have been available since |
1423 | These functions have been available since | ||
1424 | .Ox 4.5 . | 1011 | .Ox 4.5 . |
1425 | .Pp | 1012 | .Pp |
1426 | .Fn EVP_CIPHER_CTX_copy | 1013 | .Fn EVP_CIPHER_CTX_copy |
@@ -1435,27 +1022,7 @@ first appeared in OpenSSL 1.1.0 and has been available since | |||
1435 | .Fn EVP_CIPHER_CTX_encrypting | 1022 | .Fn EVP_CIPHER_CTX_encrypting |
1436 | first appeared in OpenSSL 1.1.0 and has been available since | 1023 | first appeared in OpenSSL 1.1.0 and has been available since |
1437 | .Ox 6.4 . | 1024 | .Ox 6.4 . |
1438 | .Pp | ||
1439 | .Fn EVP_CIPHER_CTX_get_iv | ||
1440 | and | ||
1441 | .Fn EVP_CIPHER_CTX_set_iv | ||
1442 | first appeared in LibreSSL 2.8.1 and have been available since | ||
1443 | .Ox 6.4 . | ||
1444 | .Sh BUGS | 1025 | .Sh BUGS |
1445 | .Dv EVP_MAX_KEY_LENGTH | ||
1446 | and | ||
1447 | .Dv EVP_MAX_IV_LENGTH | ||
1448 | only refer to the internal ciphers with default key lengths. | ||
1449 | If custom ciphers exceed these values, the results are unpredictable. | ||
1450 | This is because it has become standard practice to define a generic key | ||
1451 | as a fixed unsigned char array containing | ||
1452 | .Dv EVP_MAX_KEY_LENGTH | ||
1453 | bytes. | ||
1454 | .Pp | ||
1455 | The ASN.1 code is incomplete (and sometimes inaccurate). | ||
1456 | It has only been tested for certain common S/MIME ciphers | ||
1457 | (RC2, DES, triple DES) in CBC mode. | ||
1458 | .Pp | ||
1459 | .Fn EVP_CIPHER_CTX_copy | 1026 | .Fn EVP_CIPHER_CTX_copy |
1460 | may already have cleared the data in | 1027 | may already have cleared the data in |
1461 | .Fa out | 1028 | .Fa out |
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 4052638e0e..654a4f02a2 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.265 2023/08/30 00:58:57 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.266 2023/08/31 17:27:41 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -164,9 +164,12 @@ MAN= \ | |||
164 | ESS_SIGNING_CERT_new.3 \ | 164 | ESS_SIGNING_CERT_new.3 \ |
165 | EVP_AEAD_CTX_init.3 \ | 165 | EVP_AEAD_CTX_init.3 \ |
166 | EVP_BytesToKey.3 \ | 166 | EVP_BytesToKey.3 \ |
167 | EVP_CIPHER_CTX_ctrl.3 \ | ||
167 | EVP_CIPHER_CTX_get_cipher_data.3 \ | 168 | EVP_CIPHER_CTX_get_cipher_data.3 \ |
169 | EVP_CIPHER_CTX_set_flags.3 \ | ||
168 | EVP_CIPHER_do_all.3 \ | 170 | EVP_CIPHER_do_all.3 \ |
169 | EVP_CIPHER_meth_new.3 \ | 171 | EVP_CIPHER_meth_new.3 \ |
172 | EVP_CIPHER_nid.3 \ | ||
170 | EVP_DigestInit.3 \ | 173 | EVP_DigestInit.3 \ |
171 | EVP_DigestSignInit.3 \ | 174 | EVP_DigestSignInit.3 \ |
172 | EVP_DigestVerifyInit.3 \ | 175 | EVP_DigestVerifyInit.3 \ |
diff --git a/src/lib/libcrypto/man/evp.3 b/src/lib/libcrypto/man/evp.3 index 3b93d8ba64..d2b92ae6a5 100644 --- a/src/lib/libcrypto/man/evp.3 +++ b/src/lib/libcrypto/man/evp.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: evp.3,v 1.21 2023/08/30 00:58:57 tb Exp $ | 1 | .\" $OpenBSD: evp.3,v 1.22 2023/08/31 17:27:41 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100 | 2 | .\" full merge up to: OpenSSL man7/evp 24a535ea Sep 22 13:14:20 2020 +0100 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, |
@@ -51,7 +51,7 @@ | |||
51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
53 | .\" | 53 | .\" |
54 | .Dd $Mdocdate: August 30 2023 $ | 54 | .Dd $Mdocdate: August 31 2023 $ |
55 | .Dt EVP 3 | 55 | .Dt EVP 3 |
56 | .Os | 56 | .Os |
57 | .Sh NAME | 57 | .Sh NAME |
@@ -199,9 +199,12 @@ operations are more efficient using the high-level interfaces. | |||
199 | .Xr EVP_BytesToKey 3 , | 199 | .Xr EVP_BytesToKey 3 , |
200 | .Xr EVP_camellia_128_cbc 3 , | 200 | .Xr EVP_camellia_128_cbc 3 , |
201 | .Xr EVP_chacha20 3 , | 201 | .Xr EVP_chacha20 3 , |
202 | .Xr EVP_CIPHER_CTX_ctrl 3 , | ||
202 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 , | 203 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 , |
204 | .Xr EVP_CIPHER_CTX_set_flags 3 , | ||
203 | .Xr EVP_CIPHER_do_all 3 , | 205 | .Xr EVP_CIPHER_do_all 3 , |
204 | .Xr EVP_CIPHER_meth_new 3 , | 206 | .Xr EVP_CIPHER_meth_new 3 , |
207 | .Xr EVP_CIPHER_nid 3 , | ||
205 | .Xr EVP_des_cbc 3 , | 208 | .Xr EVP_des_cbc 3 , |
206 | .Xr EVP_DigestInit 3 , | 209 | .Xr EVP_DigestInit 3 , |
207 | .Xr EVP_DigestSignInit 3 , | 210 | .Xr EVP_DigestSignInit 3 , |