summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2023-09-05 14:19:02 +0000
committerschwarze <>2023-09-05 14:19:02 +0000
commit07c9f1bc14ce93fb6a9b3e94115b1f649714c156 (patch)
tree5d2bb6e0a7ca7e0510c0bcd5614ead49f986e1f9 /src/lib
parentf3e03e30764769d345b4643fb2d65b6b5b758f5a (diff)
downloadopenbsd-07c9f1bc14ce93fb6a9b3e94115b1f649714c156.tar.gz
openbsd-07c9f1bc14ce93fb6a9b3e94115b1f649714c156.tar.bz2
openbsd-07c9f1bc14ce93fb6a9b3e94115b1f649714c156.zip
improve the descriptions of almost all flags,
in particular saying which API functions each flag affects
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/EVP_CIPHER_meth_new.3141
1 files changed, 101 insertions, 40 deletions
diff --git a/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3 b/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3
index 0ecb87340e..c9e1d3ed66 100644
--- a/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3
+++ b/src/lib/libcrypto/man/EVP_CIPHER_meth_new.3
@@ -1,6 +1,23 @@
1.\" $OpenBSD: EVP_CIPHER_meth_new.3,v 1.2 2023/08/26 15:14:28 schwarze Exp $ 1.\" $OpenBSD: EVP_CIPHER_meth_new.3,v 1.3 2023/09/05 14:19:02 schwarze Exp $
2.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000 2.\" selective merge up to: OpenSSL b0edda11 Mar 20 13:00:17 2018 +0000
3.\" 3.\"
4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
4.\" The original file was written by Richard Levitte <levitte@openssl.org> 21.\" The original file was written by Richard Levitte <levitte@openssl.org>
5.\" Copyright (c) 2015 The OpenSSL Project. 22.\" Copyright (c) 2015 The OpenSSL Project.
6.\" All rights reserved. 23.\" All rights reserved.
@@ -49,7 +66,7 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 68.\"
52.Dd $Mdocdate: August 26 2023 $ 69.Dd $Mdocdate: September 5 2023 $
53.Dt EVP_CIPHER_METH_NEW 3 70.Dt EVP_CIPHER_METH_NEW 3
54.Os 71.Os
55.Sh NAME 72.Sh NAME
@@ -185,73 +202,114 @@ Zero or more of the following flags can be OR'ed into the
185argument: 202argument:
186.Bl -tag -width Ds 203.Bl -tag -width Ds
187.It EVP_CIPH_VARIABLE_LENGTH 204.It EVP_CIPH_VARIABLE_LENGTH
188This cipher is of variable length. 205This cipher has a variable key length, and the function
206.Xr EVP_CIPHER_CTX_set_key_length 3
207can be used with it.
189.It EVP_CIPH_CUSTOM_IV 208.It EVP_CIPH_CUSTOM_IV
190Storing and initialising the IV is left entirely to the implementation. 209Instruct
210.Xr EVP_CipherInit_ex 3
211and similar initialization functions to leave storing and initialising
212the IV entirely to the implementation.
213If this flag is set,
214the implementation is typically expected to do that in its
215.Fa init
216function.
191.It EVP_CIPH_ALWAYS_CALL_INIT 217.It EVP_CIPH_ALWAYS_CALL_INIT
192Set this if the implementation's 218Instruct
193.Fn init 219.Xr EVP_CipherInit_ex 3
194function should be called even if 220and similar initialization functions to call the implementation's
221.Fa init
222function even if the
195.Fa key 223.Fa key
196is 224argument is
197.Dv NULL . 225.Dv NULL .
198.It EVP_CIPH_CTRL_INIT 226.It EVP_CIPH_CTRL_INIT
199Set this to have the implementation's 227Instruct
200.Fn ctrl 228.Xr EVP_CipherInit_ex 3
201function called with command code 229and similar initialization functions to call the implementation's
230.Fa ctrl
231function with a command
232.Fa type
233of
202.Dv EVP_CTRL_INIT 234.Dv EVP_CTRL_INIT
203early in its setup. 235early during the setup.
204.It EVP_CIPH_CUSTOM_KEY_LENGTH 236.It EVP_CIPH_CUSTOM_KEY_LENGTH
205Checking and setting the key length after creating the 237Instruct
206.Vt EVP_CIPHER
207is left to the implementation.
208Whenever someone uses
209.Xr EVP_CIPHER_CTX_set_key_length 3 238.Xr EVP_CIPHER_CTX_set_key_length 3
210on a 239to not check and set the key length itself,
211.Vt EVP_CIPHER 240but to leave that to the implementation by instead calling its
212with this flag set, the implementation's 241.Fa ctrl
213.Fn ctrl 242function with a command
214function will be called with the control code 243.Fa type
244of
215.Dv EVP_CTRL_SET_KEY_LENGTH 245.Dv EVP_CTRL_SET_KEY_LENGTH
216and the key length in 246and the key length in
217.Fa arg . 247.Fa arg .
218.It EVP_CIPH_NO_PADDING 248.It EVP_CIPH_NO_PADDING
219Don't use standard block padding. 249Instruct
250.Xr EVP_CipherFinal_ex 3
251and similar finalization functions to not use standard block padding
252but instead report an error if the total amount of data
253to be encrypted or decrypted is not a multiple of the block size.
220.It EVP_CIPH_RAND_KEY 254.It EVP_CIPH_RAND_KEY
221Making a key with random content is left to the implementation. 255Instruct
222This is done by calling the implementation's 256.Xr EVP_CIPHER_CTX_rand_key 3
223.Fn ctrl 257to not generate a random key using
224function with the control code 258.Xr arc4random_buf 3
259but instead leave that to the implementation by calling the
260.Fa ctrl
261function with a command
262.Fa type
263of
225.Dv EVP_CTRL_RAND_KEY 264.Dv EVP_CTRL_RAND_KEY
226and the pointer to the key memory storage in 265and the pointer to the key memory storage in
227.Fa ptr . 266.Fa ptr .
228.It EVP_CIPH_CUSTOM_COPY 267.It EVP_CIPH_CUSTOM_COPY
229Set this to have the implementation's 268Instruct
230.Fn ctrl 269.Xr EVP_CIPHER_CTX_copy 3
231function called with command code 270to call the implementation's
271.Fa ctrl
272function with a command
273.Fa type
274of
232.Dv EVP_CTRL_COPY 275.Dv EVP_CTRL_COPY
233at the end of 276and the destination
234.Xr EVP_CIPHER_CTX_copy 3 . 277.Fa "EVP_CIPHER_CTX *out"
278in the
279.Fa ptr
280argument immediately before returning successfully.
235The intended use is for further things to deal with after the 281The intended use is for further things to deal with after the
236implementation specific data block has been copied. 282implementation specific data block has been copied.
237The destination
238.Vt EVP_CIPHER_CTX
239object is passed to the control with the
240.Fa ptr
241parameter.
242The implementation-specific data block is reached with 283The implementation-specific data block is reached with
243.Xr EVP_CIPHER_CTX_get_cipher_data 3 . 284.Xr EVP_CIPHER_CTX_get_cipher_data 3 .
244.It EVP_CIPH_FLAG_DEFAULT_ASN1 285.It EVP_CIPH_FLAG_DEFAULT_ASN1
245Use the default EVP routines to pass IV to and from ASN.1. 286Instruct
287.Xr EVP_CIPHER_param_to_asn1 3
288to use
289.Xr ASN1_TYPE_set_octetstring 3
290if no
291.Fa set_asn1_parameters
292function is installed, and instruct
293.Xr EVP_CIPHER_asn1_to_param 3
294to use
295.Xr ASN1_TYPE_get_octetstring 3
296if no
297.Fa get_asn1_parameters
298function is installed.
246.It EVP_CIPH_FLAG_LENGTH_BITS 299.It EVP_CIPH_FLAG_LENGTH_BITS
247Signals that the length of the input buffer for encryption / decryption 300Signals that the length of the input buffer for encryption / decryption
248is to be understood as the number of bits instead of bytes for this 301is to be understood as the number of bits instead of bytes for this
249implementation. 302implementation.
250This is only useful for CFB1 ciphers. 303This is only useful for CFB1 ciphers.
251.It EVP_CIPH_FLAG_CUSTOM_CIPHER 304.It EVP_CIPH_FLAG_CUSTOM_CIPHER
252This indicates that the implementation takes care of everything, 305Instruct
306.Xr EVP_CipherUpdate 3 ,
307.Xr EVP_CipherFinal_ex 3 ,
308and similar encryption, decryption, and finalization functions
309that the implementation's
310.Fa do_cipher
311function takes care of everything,
253including padding, buffering and finalization. 312including padding, buffering and finalization.
254The EVP routines will simply give them control and do nothing more.
255.It EVP_CIPH_FLAG_AEAD_CIPHER 313.It EVP_CIPH_FLAG_AEAD_CIPHER
256This indicates that this is an AEAD cipher implementation. 314This indicates that this is an AEAD cipher implementation.
257.El 315.El
@@ -261,7 +319,9 @@ sets the size of the EVP_CIPHER's implementation context so that it can
261be automatically allocated. 319be automatically allocated.
262.Pp 320.Pp
263.Fn EVP_CIPHER_meth_set_init 321.Fn EVP_CIPHER_meth_set_init
264sets the cipher init function for 322sets the
323.Fa init
324function for
265.Fa cipher . 325.Fa cipher .
266The cipher init function is called by 326The cipher init function is called by
267.Xr EVP_CipherInit 3 , 327.Xr EVP_CipherInit 3 ,
@@ -269,6 +329,7 @@ The cipher init function is called by
269.Xr EVP_EncryptInit 3 , 329.Xr EVP_EncryptInit 3 ,
270.Xr EVP_EncryptInit_ex 3 , 330.Xr EVP_EncryptInit_ex 3 ,
271.Xr EVP_DecryptInit 3 , 331.Xr EVP_DecryptInit 3 ,
332and
272.Xr EVP_DecryptInit_ex 3 . 333.Xr EVP_DecryptInit_ex 3 .
273.Pp 334.Pp
274.Fn EVP_CIPHER_meth_set_do_cipher 335.Fn EVP_CIPHER_meth_set_do_cipher