summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
committercvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
commitb1ddde874c215cc8891531ed92876f091b7eb83e (patch)
treeedb6da6af7e865d488dc1a29309f1e1ec226e603 /src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
parentf0a36529837a161734c802ae4c42e84e42347be2 (diff)
downloadopenbsd-tb_20250414.tar.gz
openbsd-tb_20250414.tar.bz2
openbsd-tb_20250414.zip
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3')
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3261
1 files changed, 0 insertions, 261 deletions
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
deleted file mode 100644
index d7ab36e711..0000000000
--- a/src/lib/libcrypto/man/EVP_CIPHER_CTX_ctrl.3
+++ /dev/null
@@ -1,261 +0,0 @@
1.\" $OpenBSD: EVP_CIPHER_CTX_ctrl.3,v 1.4 2025/03/25 11:54:34 tb 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: March 25 2025 $
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
133allows various cipher specific parameters to be determined and set.
134Currently only the RC2 effective key length can be set; see
135.Xr EVP_rc2_cbc 3
136for details.
137.Pp
138.Fn EVP_CIPHER_CTX_set_padding
139enables or disables padding.
140This function should be called after the context is set up for
141encryption or decryption with
142.Xr EVP_EncryptInit_ex 3 ,
143.Xr EVP_DecryptInit_ex 3 ,
144or
145.Xr EVP_CipherInit_ex 3 .
146By default encryption operations are padded using standard block padding
147and the padding is checked and removed when decrypting.
148If the
149.Fa padding
150parameter is zero, then no padding is performed, the total amount of data
151encrypted or decrypted must then be a multiple of the block size or an
152error will occur.
153.Pp
154.Fn EVP_CIPHER_CTX_set_key_length
155sets the key length of the cipher ctx.
156If the cipher is a fixed length cipher, then attempting to set the key
157length to any value other than the fixed value is an error.
158.Pp
159.Fn EVP_CIPHER_CTX_key_length
160and
161.Fn EVP_CIPHER_key_length
162return the key length of a cipher when passed an
163.Vt EVP_CIPHER_CTX
164or
165.Vt EVP_CIPHER
166structure.
167The constant
168.Dv EVP_MAX_KEY_LENGTH
169is the maximum key length for all ciphers.
170Note: although
171.Fn EVP_CIPHER_key_length
172is fixed for a given cipher, the value of
173.Fn EVP_CIPHER_CTX_key_length
174may be different for variable key length ciphers.
175.Pp
176.Fn EVP_CIPHER_CTX_iv_length
177and
178.Fn EVP_CIPHER_iv_length
179return the IV length of a cipher when passed an
180.Vt EVP_CIPHER_CTX
181or
182.Vt EVP_CIPHER .
183They will return zero if the cipher does not use an IV.
184.Fn EVP_CIPHER_CTX_iv_length
185can fail and return \-1.
186The constant
187.Dv EVP_MAX_IV_LENGTH
188is the maximum IV length for all ciphers.
189.Pp
190.Fn EVP_CIPHER_CTX_set_iv
191and
192.Fn EVP_CIPHER_CTX_get_iv
193set and retrieve the IV for an
194.Vt EVP_CIPHER_CTX ,
195respectively.
196In both cases, the specified IV length must exactly equal the expected
197IV length for the context as returned by
198.Fn EVP_CIPHER_CTX_iv_length .
199.Sh RETURN VALUES
200.Fn EVP_CIPHER_CTX_ctrl
201returns 1 for success or 0 for failure.
202Some implementations may return negative values for some errors.
203.Pp
204.Fn EVP_CIPHER_CTX_set_padding
205always returns 1.
206.Pp
207.Fn EVP_CIPHER_CTX_set_key_length ,
208.Fn EVP_CIPHER_CTX_set_iv ,
209and
210.Fn EVP_CIPHER_CTX_get_iv
211return 1 for success or 0 for failure.
212.Pp
213.Fn EVP_CIPHER_CTX_key_length
214and
215.Fn EVP_CIPHER_key_length
216return the key length.
217.Pp
218.Fn EVP_CIPHER_CTX_iv_length
219and
220.Fn EVP_CIPHER_iv_length
221return the IV length or zero if the cipher does not use an IV.
222.Fn EVP_CIPHER_CTX_iv_length
223can fail and return \-1.
224.Sh SEE ALSO
225.Xr evp 3 ,
226.Xr EVP_CIPHER_nid 3 ,
227.Xr EVP_EncryptInit 3
228.Sh HISTORY
229.Fn EVP_CIPHER_CTX_key_length ,
230.Fn EVP_CIPHER_key_length ,
231.Fn EVP_CIPHER_CTX_iv_length ,
232and
233.Fn EVP_CIPHER_iv_length
234first appeared in SSLeay 0.6.5 and have been available since
235.Ox 2.4 .
236.Pp
237.Fn EVP_CIPHER_CTX_ctrl
238and
239.Fn EVP_CIPHER_CTX_set_key_length
240first appeared in OpenSSL 0.9.6 and have been available since
241.Ox 2.9 .
242.Pp
243.Fn EVP_CIPHER_CTX_set_padding
244first appeared in OpenSSL 0.9.7 and has been available since
245.Ox 3.2 .
246.Pp
247.Fn EVP_CIPHER_CTX_set_iv
248and
249.Fn EVP_CIPHER_CTX_get_iv
250first appeared in LibreSSL 2.8.1 and have been available since
251.Ox 6.4 .
252.Sh BUGS
253.Dv EVP_MAX_KEY_LENGTH
254and
255.Dv EVP_MAX_IV_LENGTH
256only refer to the internal ciphers with default key lengths.
257If custom ciphers exceed these values, the results are unpredictable.
258This is because it has become standard practice to define a generic key
259as a fixed unsigned char array containing
260.Dv EVP_MAX_KEY_LENGTH
261bytes.