diff options
| author | schwarze <> | 2023-08-26 15:01:56 +0000 |
|---|---|---|
| committer | schwarze <> | 2023-08-26 15:01:56 +0000 |
| commit | 862e1f16dafa5c72eec7c36dbe186b259012ffe7 (patch) | |
| tree | b5ea0aa10b741f23cfa362b3cd8b485134d6dc85 /src | |
| parent | 778afbd9aa050027894e8ccfeeb3889ed52c7c13 (diff) | |
| download | openbsd-862e1f16dafa5c72eec7c36dbe186b259012ffe7.tar.gz openbsd-862e1f16dafa5c72eec7c36dbe186b259012ffe7.tar.bz2 openbsd-862e1f16dafa5c72eec7c36dbe186b259012ffe7.zip | |
write documentation for EVP_CIPHER_CTX_copy(3)
and EVP_CIPHER_CTX_encrypting(3) from scratch
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/EVP_EncryptInit.3 | 90 |
1 files changed, 86 insertions, 4 deletions
diff --git a/src/lib/libcrypto/man/EVP_EncryptInit.3 b/src/lib/libcrypto/man/EVP_EncryptInit.3 index 556b50c925..b6d9080bea 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.46 2023/08/16 13:50:05 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_EncryptInit.3,v 1.47 2023/08/26 15:01:56 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 |
| @@ -6,7 +6,7 @@ | |||
| 6 | .\" This file is a derived work. | 6 | .\" This file is a derived work. |
| 7 | .\" The changes are covered by the following Copyright and license: | 7 | .\" The changes are covered by the following Copyright and license: |
| 8 | .\" | 8 | .\" |
| 9 | .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> | 9 | .\" Copyright (c) 2019, 2023 Ingo Schwarze <schwarze@openbsd.org> |
| 10 | .\" | 10 | .\" |
| 11 | .\" Permission to use, copy, modify, and distribute this software for any | 11 | .\" Permission to use, copy, modify, and distribute this software for any |
| 12 | .\" purpose with or without fee is hereby granted, provided that the above | 12 | .\" purpose with or without fee is hereby granted, provided that the above |
| @@ -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 16 2023 $ | 72 | .Dd $Mdocdate: August 26 2023 $ |
| 73 | .Dt EVP_ENCRYPTINIT 3 | 73 | .Dt EVP_ENCRYPTINIT 3 |
| 74 | .Os | 74 | .Os |
| 75 | .Sh NAME | 75 | .Sh NAME |
| @@ -78,6 +78,7 @@ | |||
| 78 | .Nm EVP_CIPHER_CTX_cleanup , | 78 | .Nm EVP_CIPHER_CTX_cleanup , |
| 79 | .Nm EVP_CIPHER_CTX_init , | 79 | .Nm EVP_CIPHER_CTX_init , |
| 80 | .Nm EVP_CIPHER_CTX_free , | 80 | .Nm EVP_CIPHER_CTX_free , |
| 81 | .Nm EVP_CIPHER_CTX_copy , | ||
| 81 | .Nm EVP_EncryptInit_ex , | 82 | .Nm EVP_EncryptInit_ex , |
| 82 | .Nm EVP_EncryptUpdate , | 83 | .Nm EVP_EncryptUpdate , |
| 83 | .Nm EVP_EncryptFinal_ex , | 84 | .Nm EVP_EncryptFinal_ex , |
| @@ -94,6 +95,7 @@ | |||
| 94 | .Nm EVP_CipherInit , | 95 | .Nm EVP_CipherInit , |
| 95 | .Nm EVP_CipherFinal , | 96 | .Nm EVP_CipherFinal , |
| 96 | .Nm EVP_Cipher , | 97 | .Nm EVP_Cipher , |
| 98 | .Nm EVP_CIPHER_CTX_encrypting , | ||
| 97 | .Nm EVP_CIPHER_CTX_set_flags , | 99 | .Nm EVP_CIPHER_CTX_set_flags , |
| 98 | .Nm EVP_CIPHER_CTX_clear_flags , | 100 | .Nm EVP_CIPHER_CTX_clear_flags , |
| 99 | .Nm EVP_CIPHER_CTX_test_flags , | 101 | .Nm EVP_CIPHER_CTX_test_flags , |
| @@ -170,6 +172,11 @@ | |||
| 170 | .Fa "EVP_CIPHER_CTX *ctx" | 172 | .Fa "EVP_CIPHER_CTX *ctx" |
| 171 | .Fc | 173 | .Fc |
| 172 | .Ft int | 174 | .Ft int |
| 175 | .Fo EVP_CIPHER_CTX_copy | ||
| 176 | .Fa "EVP_CIPHER_CTX *out" | ||
| 177 | .Fa "const EVP_CIPHER_CTX *in" | ||
| 178 | .Fc | ||
| 179 | .Ft int | ||
| 173 | .Fo EVP_EncryptInit_ex | 180 | .Fo EVP_EncryptInit_ex |
| 174 | .Fa "EVP_CIPHER_CTX *ctx" | 181 | .Fa "EVP_CIPHER_CTX *ctx" |
| 175 | .Fa "const EVP_CIPHER *type" | 182 | .Fa "const EVP_CIPHER *type" |
| @@ -283,6 +290,10 @@ | |||
| 283 | .Fa "const unsigned char *in" | 290 | .Fa "const unsigned char *in" |
| 284 | .Fa "unsigned int inl" | 291 | .Fa "unsigned int inl" |
| 285 | .Fc | 292 | .Fc |
| 293 | .Ft int | ||
| 294 | .Fo EVP_CIPHER_CTX_encrypting | ||
| 295 | .Fa "const EVP_CIPHER_CTX *ctx" | ||
| 296 | .Fc | ||
| 286 | .Ft void | 297 | .Ft void |
| 287 | .Fo EVP_CIPHER_CTX_set_flags | 298 | .Fo EVP_CIPHER_CTX_set_flags |
| 288 | .Fa "EVP_CIPHER_CTX *ctx" | 299 | .Fa "EVP_CIPHER_CTX *ctx" |
| @@ -465,6 +476,55 @@ is a | |||
| 465 | .Dv NULL | 476 | .Dv NULL |
| 466 | pointer, no action occurs. | 477 | pointer, no action occurs. |
| 467 | .Pp | 478 | .Pp |
| 479 | .Fn EVP_CIPHER_CTX_copy | ||
| 480 | calls | ||
| 481 | .Fn EVP_CIPHER_CTX_reset | ||
| 482 | on | ||
| 483 | .Fa out | ||
| 484 | and copies all the data from | ||
| 485 | .Fa in | ||
| 486 | to | ||
| 487 | .Fa out , | ||
| 488 | except that the | ||
| 489 | .Vt EVP_CIPHER | ||
| 490 | and | ||
| 491 | .Vt ENGINE | ||
| 492 | objects used by | ||
| 493 | .Fa in | ||
| 494 | and any application specific data set with | ||
| 495 | .Fn EVP_CIPHER_CTX_set_app_data | ||
| 496 | are not copied and | ||
| 497 | .Fa out | ||
| 498 | will point to the same three objects. | ||
| 499 | The algorithm- and implementation-specific cipher data described in | ||
| 500 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 | ||
| 501 | is copied with | ||
| 502 | .Xr malloc 3 | ||
| 503 | and | ||
| 504 | .Xr memcpy 3 , | ||
| 505 | i.e. assuming that it does not contain pointers to any sub-objects. | ||
| 506 | If the bit | ||
| 507 | .Dv EVP_CIPH_CUSTOM_COPY | ||
| 508 | has been set with | ||
| 509 | .Xr EVP_CIPHER_meth_set_flags 3 , | ||
| 510 | .Fn EVP_CIPHER_CTX_ctrl | ||
| 511 | is called at the end with arguments | ||
| 512 | .Fa in , | ||
| 513 | .Dv EVP_CTRL_COPY , | ||
| 514 | .No 0 , | ||
| 515 | and | ||
| 516 | .Fa out | ||
| 517 | such that the cipher implementation can perform further algorithm- | ||
| 518 | and implementation-specific initializations after the algorithm- | ||
| 519 | and implementation-specific cipher data has been copied. | ||
| 520 | Among the cipher algorithms built into the library, | ||
| 521 | .Dv EVP_CIPH_CUSTOM_COPY | ||
| 522 | and | ||
| 523 | .Dv EVP_CTRL_COPY | ||
| 524 | are used by some of the ciphers documented in the | ||
| 525 | .Xr EVP_aes_256_gcm 3 | ||
| 526 | manual page. | ||
| 527 | .Pp | ||
| 468 | .Fn EVP_EncryptInit_ex | 528 | .Fn EVP_EncryptInit_ex |
| 469 | sets up the cipher context | 529 | sets up the cipher context |
| 470 | .Fa ctx | 530 | .Fa ctx |
| @@ -877,6 +937,7 @@ for failure. | |||
| 877 | .Pp | 937 | .Pp |
| 878 | .Fn EVP_CIPHER_CTX_reset , | 938 | .Fn EVP_CIPHER_CTX_reset , |
| 879 | .Fn EVP_CIPHER_CTX_cleanup , | 939 | .Fn EVP_CIPHER_CTX_cleanup , |
| 940 | .Fn EVP_CIPHER_CTX_copy , | ||
| 880 | .Fn EVP_CIPHER_CTX_get_iv , | 941 | .Fn EVP_CIPHER_CTX_get_iv , |
| 881 | .Fn EVP_CIPHER_CTX_set_iv , | 942 | .Fn EVP_CIPHER_CTX_set_iv , |
| 882 | .Fn EVP_EncryptInit_ex , | 943 | .Fn EVP_EncryptInit_ex , |
| @@ -900,6 +961,12 @@ and | |||
| 900 | .Fn EVP_CIPHER_CTX_rand_key | 961 | .Fn EVP_CIPHER_CTX_rand_key |
| 901 | return 1 for success or 0 for failure. | 962 | return 1 for success or 0 for failure. |
| 902 | .Pp | 963 | .Pp |
| 964 | .Fn EVP_CIPHER_CTX_encrypting | ||
| 965 | returns 1 if | ||
| 966 | .Fa ctx | ||
| 967 | is initialized for encryption or 0 otherwise, in which case | ||
| 968 | it may be uninitialized or initialized for decryption. | ||
| 969 | .Pp | ||
| 903 | .Fn EVP_CIPHER_CTX_set_padding | 970 | .Fn EVP_CIPHER_CTX_set_padding |
| 904 | always returns 1. | 971 | always returns 1. |
| 905 | .Pp | 972 | .Pp |
| @@ -1243,6 +1310,7 @@ do_crypt(FILE *in, FILE *out, int do_encrypt) | |||
| 1243 | .Xr EVP_aes_128_cbc 3 , | 1310 | .Xr EVP_aes_128_cbc 3 , |
| 1244 | .Xr EVP_camellia_128_cbc 3 , | 1311 | .Xr EVP_camellia_128_cbc 3 , |
| 1245 | .Xr EVP_chacha20 3 , | 1312 | .Xr EVP_chacha20 3 , |
| 1313 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 , | ||
| 1246 | .Xr EVP_des_cbc 3 , | 1314 | .Xr EVP_des_cbc 3 , |
| 1247 | .Xr EVP_OpenInit 3 , | 1315 | .Xr EVP_OpenInit 3 , |
| 1248 | .Xr EVP_rc4 3 , | 1316 | .Xr EVP_rc4 3 , |
| @@ -1355,14 +1423,23 @@ first appeared in OpenSSL 0.9.8b. | |||
| 1355 | These functions have been available since | 1423 | These functions have been available since |
| 1356 | .Ox 4.5 . | 1424 | .Ox 4.5 . |
| 1357 | .Pp | 1425 | .Pp |
| 1426 | .Fn EVP_CIPHER_CTX_copy | ||
| 1427 | first appeared in OpenSSL 1.0.0 | ||
| 1428 | and has been available since | ||
| 1429 | .Ox 4.9 . | ||
| 1430 | .Pp | ||
| 1358 | .Fn EVP_CIPHER_CTX_reset | 1431 | .Fn EVP_CIPHER_CTX_reset |
| 1359 | first appeared in OpenSSL 1.1.0 and has been available since | 1432 | first appeared in OpenSSL 1.1.0 and has been available since |
| 1360 | .Ox 6.3 . | 1433 | .Ox 6.3 . |
| 1361 | .Pp | 1434 | .Pp |
| 1435 | .Fn EVP_CIPHER_CTX_encrypting | ||
| 1436 | first appeared in OpenSSL 1.1.0 and has been available since | ||
| 1437 | .Ox 6.4 . | ||
| 1438 | .Pp | ||
| 1362 | .Fn EVP_CIPHER_CTX_get_iv | 1439 | .Fn EVP_CIPHER_CTX_get_iv |
| 1363 | and | 1440 | and |
| 1364 | .Fn EVP_CIPHER_CTX_set_iv | 1441 | .Fn EVP_CIPHER_CTX_set_iv |
| 1365 | first appeared in LibreSSL 2.8.1 and has been available since | 1442 | first appeared in LibreSSL 2.8.1 and have been available since |
| 1366 | .Ox 6.4 . | 1443 | .Ox 6.4 . |
| 1367 | .Sh BUGS | 1444 | .Sh BUGS |
| 1368 | .Dv EVP_MAX_KEY_LENGTH | 1445 | .Dv EVP_MAX_KEY_LENGTH |
| @@ -1378,3 +1455,8 @@ bytes. | |||
| 1378 | The ASN.1 code is incomplete (and sometimes inaccurate). | 1455 | The ASN.1 code is incomplete (and sometimes inaccurate). |
| 1379 | It has only been tested for certain common S/MIME ciphers | 1456 | It has only been tested for certain common S/MIME ciphers |
| 1380 | (RC2, DES, triple DES) in CBC mode. | 1457 | (RC2, DES, triple DES) in CBC mode. |
| 1458 | .Pp | ||
| 1459 | .Fn EVP_CIPHER_CTX_copy | ||
| 1460 | may already have cleared the data in | ||
| 1461 | .Fa out | ||
| 1462 | and copied some new data into it even if it fails and returns 0. | ||
