summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_EncryptInit.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/man/EVP_EncryptInit.3463
1 files changed, 15 insertions, 448 deletions
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
438The EVP cipher routines are a high level interface to certain symmetric 287The EVP cipher routines are a high level interface to certain symmetric
439ciphers. 288ciphers.
@@ -492,7 +341,7 @@ and
492objects used by 341objects used by
493.Fa in 342.Fa in
494and any application specific data set with 343and any application specific data set with
495.Fn EVP_CIPHER_CTX_set_app_data 344.Xr EVP_CIPHER_CTX_set_app_data 3
496are not copied and 345are not copied and
497.Fa out 346.Fa out
498will point to the same three objects. 347will 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
508has been set with 357has 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
511is called at the end with arguments 360is 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
691structure. 540structure.
692.Pp 541.Pp
693.Fn EVP_CIPHER_nid
694and
695.Fn EVP_CIPHER_CTX_nid
696return the NID of a cipher when passed an
697.Vt EVP_CIPHER
698or
699.Vt EVP_CIPHER_CTX
700structure.
701The actual NID value is an internal value which may not have a
702corresponding OBJECT IDENTIFIER.
703.Pp
704.Fn EVP_CIPHER_CTX_set_flags
705enables the given
706.Fa flags
707in
708.Fa ctx .
709.Fn EVP_CIPHER_CTX_clear_flags
710disables the given
711.Fa flags
712in
713.Fa ctx .
714.Fn EVP_CIPHER_CTX_test_flags
715checks whether any of the given
716.Fa flags
717are currently set in
718.Fa ctx ,
719returning the subset of the
720.Fa flags
721that are set, or 0 if none of them are set.
722Currently, the only supported cipher context flag is
723.Dv EVP_CIPHER_CTX_FLAG_WRAP_ALLOW ;
724see
725.Xr EVP_aes_128_wrap 3
726for details.
727.Pp
728.Fn EVP_CIPHER_CTX_set_padding
729enables or disables padding.
730This function should be called after the context is set up for
731encryption or decryption with
732.Fn EVP_EncryptInit_ex ,
733.Fn EVP_DecryptInit_ex ,
734or
735.Fn EVP_CipherInit_ex .
736By default encryption operations are padded using standard block padding
737and the padding is checked and removed when decrypting.
738If the
739.Fa padding
740parameter is zero, then no padding is performed, the total amount of data
741encrypted or decrypted must then be a multiple of the block size or an
742error will occur.
743.Pp
744.Fn EVP_CIPHER_key_length
745and
746.Fn EVP_CIPHER_CTX_key_length
747return the key length of a cipher when passed an
748.Vt EVP_CIPHER
749or
750.Vt EVP_CIPHER_CTX
751structure.
752The constant
753.Dv EVP_MAX_KEY_LENGTH
754is the maximum key length for all ciphers.
755Note: although
756.Fn EVP_CIPHER_key_length
757is fixed for a given cipher, the value of
758.Fn EVP_CIPHER_CTX_key_length
759may be different for variable key length ciphers.
760.Pp
761.Fn EVP_CIPHER_CTX_set_key_length
762sets the key length of the cipher ctx.
763If the cipher is a fixed length cipher, then attempting to set the key
764length to any value other than the fixed value is an error.
765.Pp
766.Fn EVP_CIPHER_iv_length
767and
768.Fn EVP_CIPHER_CTX_iv_length
769return the IV length of a cipher when passed an
770.Vt EVP_CIPHER
771or
772.Vt EVP_CIPHER_CTX .
773It will return zero if the cipher does not use an IV.
774The constant
775.Dv EVP_MAX_IV_LENGTH
776is the maximum IV length for all ciphers.
777.Pp
778.Fn EVP_CIPHER_CTX_get_iv
779and
780.Fn EVP_CIPHER_CTX_set_iv
781will respectively retrieve and set the IV for an
782.Vt EVP_CIPHER_CTX .
783In both cases, the specified IV length must exactly equal the expected
784IV length for the context as returned by
785.Fn EVP_CIPHER_CTX_iv_length .
786.Pp
787.Fn EVP_CIPHER_block_size
788and
789.Fn EVP_CIPHER_CTX_block_size
790return the block size of a cipher when passed an
791.Vt EVP_CIPHER
792or
793.Vt EVP_CIPHER_CTX
794structure.
795The constant
796.Dv EVP_MAX_BLOCK_LENGTH
797is also the maximum block length for all ciphers.
798.Pp
799.Fn EVP_CIPHER_type
800and
801.Fn EVP_CIPHER_CTX_type
802return the type of the passed cipher or context.
803This "type" is the actual NID of the cipher OBJECT IDENTIFIER as such it
804ignores the cipher parameters and 40-bit RC2 and 128-bit RC2 have the
805same NID.
806If the cipher does not have an object identifier or does not
807have 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
811returns the 543returns 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
815structure. 547structure.
816.Pp 548.Pp
817.Fn EVP_CIPHER_mode
818and
819.Fn EVP_CIPHER_CTX_mode
820return 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 ,
826or
827.Dv EVP_CIPH_XTS_MODE .
828If the cipher is a stream cipher then
829.Dv EVP_CIPH_STREAM_CIPHER
830is returned.
831.Pp
832.Fn EVP_CIPHER_param_to_asn1
833sets the ASN.1
834.Vt AlgorithmIdentifier
835parameter based on the passed cipher.
836This will typically include any parameters and an IV.
837The cipher IV (if any) must be set when this call is made.
838This call should be made before the cipher is actually "used" (before any
839.Fn EVP_EncryptUpdate
840or
841.Fn EVP_DecryptUpdate
842calls, for example).
843This function may fail if the cipher does not have any ASN.1 support.
844.Pp
845.Fn EVP_CIPHER_asn1_to_param
846sets the cipher parameters based on an ASN.1
847.Vt AlgorithmIdentifier
848parameter.
849The precise effect depends on the cipher.
850In the case of RC2, for example, it will set the IV and effective
851key length.
852This function should be called after the base cipher type is set but
853before the key is set.
854For example
855.Fn EVP_CipherInit
856will be called with the IV and key set to
857.Dv NULL ,
858.Fn EVP_CIPHER_asn1_to_param
859will be called and finally
860.Fn EVP_CipherInit
861again with all parameters except the key set to
862.Dv NULL .
863It is possible for this function to fail if the cipher does not
864have any ASN.1 support or the parameters cannot be set (for example
865the RC2 effective key length is not supported).
866.Pp
867.Fn EVP_CIPHER_CTX_ctrl
868allows various cipher specific parameters to be determined and set.
869Currently only the RC2 effective key length can be set.
870.Pp
871.Fn EVP_CIPHER_CTX_rand_key
872generates a random key of the appropriate length based on the cipher
873context.
874The
875.Vt EVP_CIPHER
876can provide its own random key generation routine to support keys
877of a specific form.
878The
879.Fa key
880argument must point to a buffer at least as big as the value returned by
881.Fn EVP_CIPHER_CTX_key_length .
882.Pp
883Where possible the EVP interface to symmetric ciphers should be 549Where possible the EVP interface to symmetric ciphers should be
884used in preference to the low level interfaces. 550used in preference to the low level interfaces.
885This is because the code then becomes transparent to the cipher used and 551This 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 ,
960and 622and
961.Fn EVP_CIPHER_CTX_rand_key 623.Fn EVP_Cipher
962return 1 for success or 0 for failure. 624return 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
967is initialized for encryption or 0 otherwise, in which case 629is initialized for encryption or 0 otherwise, in which case
968it may be uninitialized or initialized for decryption. 630it may be uninitialized or initialized for decryption.
969.Pp 631.Pp
970.Fn EVP_CIPHER_CTX_set_padding
971always returns 1.
972.Pp
973.Fn EVP_CIPHER_CTX_ctrl
974usually returns 1 for success, 0 for failure, or \-1 if the
975.Fa type
976is not supported by the
977.Fa ctx ,
978but there may be exceptions for some
979.Fa type
980arguments.
981.Pp
982.Fn EVP_get_cipherbyname , 632.Fn EVP_get_cipherbyname ,
983.Fn EVP_get_cipherbynid , 633.Fn EVP_get_cipherbynid ,
984and 634and
@@ -989,43 +639,10 @@ structure or
989.Dv NULL 639.Dv NULL
990on error. 640on error.
991.Pp 641.Pp
992.Fn EVP_CIPHER_nid
993and
994.Fn EVP_CIPHER_CTX_nid
995return a NID.
996.Pp
997.Fn EVP_CIPHER_block_size
998and
999.Fn EVP_CIPHER_CTX_block_size
1000return the block size.
1001.Pp
1002.Fn EVP_CIPHER_key_length
1003and
1004.Fn EVP_CIPHER_CTX_key_length
1005return the key length.
1006.Pp
1007.Fn EVP_CIPHER_iv_length
1008and
1009.Fn EVP_CIPHER_CTX_iv_length
1010return the IV length or zero if the cipher does not use an IV.
1011.Pp
1012.Fn EVP_CIPHER_type
1013and
1014.Fn EVP_CIPHER_CTX_type
1015return the NID of the cipher's OBJECT IDENTIFIER or
1016.Dv NID_undef
1017if it has no defined OBJECT IDENTIFIER.
1018.Pp
1019.Fn EVP_CIPHER_CTX_cipher 642.Fn EVP_CIPHER_CTX_cipher
1020returns an 643returns an
1021.Vt EVP_CIPHER 644.Vt EVP_CIPHER
1022structure. 645structure.
1023.Pp
1024.Fn EVP_CIPHER_param_to_asn1
1025and
1026.Fn EVP_CIPHER_asn1_to_param
1027return greater than zero for success and zero or a negative number
1028for failure.
1029.Sh CIPHER LISTING 646.Sh CIPHER LISTING
1030All algorithms have a fixed key length unless otherwise stated. 647All 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
1064length of 40 and 64 bits. 681length of 40 and 64 bits.
1065These are obsolete and new code should use 682These 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 ,
1068and 685and
1069.Fn EVP_CIPHER_CTX_ctrl 686.Xr EVP_CIPHER_CTX_ctrl 3
1070to set the key length and effective key length. 687to 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.
1339and 959and
1340.Fn EVP_rc2_ofb 960.Fn EVP_rc2_ofb
1341first appeared in SSLeay 0.5.2. 961first 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 ,
1350and
1351.Fn EVP_CIPHER_CTX_type
1352first appeared in SSLeay 0.6.5. 963first 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
1358first appeared in SSLeay 0.6.6. 969first 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 ,
1366and 973and
1367.Fn EVP_enc_null 974.Fn EVP_enc_null
1368first appeared in SSLeay 0.8.0. 975first appeared in SSLeay 0.8.0.
1369.Fn EVP_get_cipherbynid 976.Fn EVP_get_cipherbynid
1370first appeared in SSLeay 0.8.1. 977first 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 ,
1373and
1374.Fn EVP_CIPHER_asn1_to_param
1375first appeared in SSLeay 0.9.0. 979first appeared in SSLeay 0.9.0.
1376All these functions have been available since 980All 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
1380and 984and
1381.Fn EVP_rc2_64_cbc 985.Fn EVP_rc2_64_cbc
1382first appeared in SSL_eay 0.9.1. 986first appeared in SSLeay 0.9.1 and have been available since
1383.Fn EVP_CIPHER_CTX_type
1384first appeared in OpenSSL 0.9.3.
1385These 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 ,
1393and
1394.Fn EVP_CIPHER_CTX_mode
1395first 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 ,
1404and 994and
1405.Fn EVP_CIPHER_CTX_set_padding 995.Fn EVP_CipherFinal_ex
1406first appeared in OpenSSL 0.9.7 and have been available since 996first 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
1414first appeared in OpenSSL 0.9.7e and have been available since 1004first 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
1418first appeared in OpenSSL 0.9.8.
1419.Fn EVP_CIPHER_CTX_new 1007.Fn EVP_CIPHER_CTX_new
1420and 1008and
1421.Fn EVP_CIPHER_CTX_free 1009.Fn EVP_CIPHER_CTX_free
1422first appeared in OpenSSL 0.9.8b. 1010first appeared in OpenSSL 0.9.8b and have been available since
1423These 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
1436first appeared in OpenSSL 1.1.0 and has been available since 1023first 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
1440and
1441.Fn EVP_CIPHER_CTX_set_iv
1442first 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
1446and
1447.Dv EVP_MAX_IV_LENGTH
1448only refer to the internal ciphers with default key lengths.
1449If custom ciphers exceed these values, the results are unpredictable.
1450This is because it has become standard practice to define a generic key
1451as a fixed unsigned char array containing
1452.Dv EVP_MAX_KEY_LENGTH
1453bytes.
1454.Pp
1455The ASN.1 code is incomplete (and sometimes inaccurate).
1456It 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
1460may already have cleared the data in 1027may already have cleared the data in
1461.Fa out 1028.Fa out