diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/EVP_EncryptInit.3 | 104 |
1 files changed, 33 insertions, 71 deletions
diff --git a/src/lib/libcrypto/man/EVP_EncryptInit.3 b/src/lib/libcrypto/man/EVP_EncryptInit.3 index 8fc615b07e..7deabe92c1 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.49 2023/12/01 10:40:21 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_EncryptInit.3,v 1.50 2023/12/01 13:43:37 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 |
| @@ -308,15 +308,13 @@ to | |||
| 308 | .Fa out , | 308 | .Fa out , |
| 309 | except that the | 309 | except that the |
| 310 | .Vt EVP_CIPHER | 310 | .Vt EVP_CIPHER |
| 311 | and | 311 | object used by |
| 312 | .Vt ENGINE | ||
| 313 | objects used by | ||
| 314 | .Fa in | 312 | .Fa in |
| 315 | and any application specific data set with | 313 | and any application specific data set with |
| 316 | .Xr EVP_CIPHER_CTX_set_app_data 3 | 314 | .Xr EVP_CIPHER_CTX_set_app_data 3 |
| 317 | are not copied and | 315 | are not copied and |
| 318 | .Fa out | 316 | .Fa out |
| 319 | will point to the same three objects. | 317 | will point to the same two objects. |
| 320 | The algorithm- and implementation-specific cipher data described in | 318 | The algorithm- and implementation-specific cipher data described in |
| 321 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 | 319 | .Xr EVP_CIPHER_CTX_get_cipher_data 3 |
| 322 | is copied with | 320 | is copied with |
| @@ -346,28 +344,27 @@ are used by some of the ciphers documented in the | |||
| 346 | .Xr EVP_aes_256_gcm 3 | 344 | .Xr EVP_aes_256_gcm 3 |
| 347 | manual page. | 345 | manual page. |
| 348 | .Pp | 346 | .Pp |
| 347 | .Fn EVP_EncryptInit | ||
| 348 | and | ||
| 349 | .Fn EVP_EncryptInit_ex | 349 | .Fn EVP_EncryptInit_ex |
| 350 | sets up the cipher context | 350 | set up the cipher context |
| 351 | .Fa ctx | 351 | .Fa ctx |
| 352 | for encryption with cipher | 352 | for encryption with cipher |
| 353 | .Fa type | 353 | .Fa type . |
| 354 | from | ||
| 355 | .Vt ENGINE | ||
| 356 | .Fa impl . | ||
| 357 | .Fa type | 354 | .Fa type |
| 358 | is normally supplied by a function such as | 355 | is normally supplied by a function such as |
| 359 | .Xr EVP_aes_256_cbc 3 . | 356 | .Xr EVP_aes_256_cbc 3 . |
| 360 | If | ||
| 361 | .Fa impl | ||
| 362 | is | ||
| 363 | .Dv NULL , | ||
| 364 | then the default implementation is used. | ||
| 365 | .Fa key | 357 | .Fa key |
| 366 | is the symmetric key to use and | 358 | is the symmetric key to use and |
| 367 | .Fa iv | 359 | .Fa iv |
| 368 | is the IV to use (if necessary). | 360 | is the IV to use (if necessary). |
| 369 | The actual number of bytes used for the | 361 | The actual number of bytes used for the |
| 370 | key and IV depends on the cipher. | 362 | key and IV depends on the cipher. |
| 363 | The | ||
| 364 | .Fa ENGINE *impl | ||
| 365 | argument is always ignored and passing | ||
| 366 | .Dv NULL | ||
| 367 | is recommended. | ||
| 371 | It is possible to set all parameters to | 368 | It is possible to set all parameters to |
| 372 | .Dv NULL | 369 | .Dv NULL |
| 373 | except | 370 | except |
| @@ -397,8 +394,11 @@ The actual number of bytes written is placed in | |||
| 397 | .Fa outl . | 394 | .Fa outl . |
| 398 | .Pp | 395 | .Pp |
| 399 | If padding is enabled (the default) then | 396 | If padding is enabled (the default) then |
| 400 | .Fn EVP_EncryptFinal_ex | 397 | .Fn EVP_EncryptFinal |
| 401 | encrypts the "final" data, that is any data that remains in a partial | 398 | and |
| 399 | .Fn EVP_EncryptFinal_ex , | ||
| 400 | which behave identically, | ||
| 401 | encrypt the "final" data, that is any data that remains in a partial | ||
| 402 | block. | 402 | block. |
| 403 | It uses NOTES (aka PKCS padding). | 403 | It uses NOTES (aka PKCS padding). |
| 404 | The encrypted final data is written to | 404 | The encrypted final data is written to |
| @@ -412,18 +412,24 @@ no further calls to | |||
| 412 | should be made. | 412 | should be made. |
| 413 | .Pp | 413 | .Pp |
| 414 | If padding is disabled then | 414 | If padding is disabled then |
| 415 | .Fn EVP_EncryptFinal | ||
| 416 | and | ||
| 415 | .Fn EVP_EncryptFinal_ex | 417 | .Fn EVP_EncryptFinal_ex |
| 416 | will not encrypt any more data and it will return an error if any data | 418 | do not encrypt any more data and return an error if any data |
| 417 | remains in a partial block: that is if the total data length is not a | 419 | remains in a partial block: that is if the total data length is not a |
| 418 | multiple of the block size. | 420 | multiple of the block size. |
| 419 | .Pp | 421 | .Pp |
| 422 | .Fn EVP_DecryptInit , | ||
| 420 | .Fn EVP_DecryptInit_ex , | 423 | .Fn EVP_DecryptInit_ex , |
| 421 | .Fn EVP_DecryptUpdate , | 424 | .Fn EVP_DecryptUpdate , |
| 425 | .Fn EVP_DecryptFinal , | ||
| 422 | and | 426 | and |
| 423 | .Fn EVP_DecryptFinal_ex | 427 | .Fn EVP_DecryptFinal_ex |
| 424 | are the corresponding decryption operations. | 428 | are the corresponding decryption operations. |
| 425 | .Fn EVP_DecryptFinal | 429 | .Fn EVP_DecryptFinal |
| 426 | will return an error code if padding is enabled and the final block is | 430 | and |
| 431 | .Fn EVP_DecryptFinal_ex | ||
| 432 | return an error code if padding is enabled and the final block is | ||
| 427 | not correctly formatted. | 433 | not correctly formatted. |
| 428 | The parameters and restrictions are identical to the encryption | 434 | The parameters and restrictions are identical to the encryption |
| 429 | operations except that if padding is enabled the decrypted data buffer | 435 | operations except that if padding is enabled the decrypted data buffer |
| @@ -435,8 +441,10 @@ unless the cipher block size is 1 in which case | |||
| 435 | .Fa inl | 441 | .Fa inl |
| 436 | bytes is sufficient. | 442 | bytes is sufficient. |
| 437 | .Pp | 443 | .Pp |
| 444 | .Fn EVP_CipherInit , | ||
| 438 | .Fn EVP_CipherInit_ex , | 445 | .Fn EVP_CipherInit_ex , |
| 439 | .Fn EVP_CipherUpdate , | 446 | .Fn EVP_CipherUpdate , |
| 447 | .Fn EVP_CipherFinal , | ||
| 440 | and | 448 | and |
| 441 | .Fn EVP_CipherFinal_ex | 449 | .Fn EVP_CipherFinal_ex |
| 442 | are functions that can be used for decryption or encryption. | 450 | are functions that can be used for decryption or encryption. |
| @@ -448,37 +456,6 @@ the value unchanged (the actual value of | |||
| 448 | .Fa enc | 456 | .Fa enc |
| 449 | being supplied in a previous call). | 457 | being supplied in a previous call). |
| 450 | .Pp | 458 | .Pp |
| 451 | .Fn EVP_EncryptInit , | ||
| 452 | .Fn EVP_DecryptInit , | ||
| 453 | and | ||
| 454 | .Fn EVP_CipherInit | ||
| 455 | are deprecated functions behaving like | ||
| 456 | .Fn EVP_EncryptInit_ex , | ||
| 457 | .Fn EVP_DecryptInit_ex , | ||
| 458 | and | ||
| 459 | .Fn EVP_CipherInit_ex | ||
| 460 | except that they always use the default cipher implementation | ||
| 461 | and that they require | ||
| 462 | .Fn EVP_CIPHER_CTX_reset | ||
| 463 | before they can be used on a context that was already used. | ||
| 464 | .Pp | ||
| 465 | .Fn EVP_EncryptFinal , | ||
| 466 | .Fn EVP_DecryptFinal , | ||
| 467 | and | ||
| 468 | .Fn EVP_CipherFinal | ||
| 469 | are identical to | ||
| 470 | .Fn EVP_EncryptFinal_ex , | ||
| 471 | .Fn EVP_DecryptFinal_ex , | ||
| 472 | and | ||
| 473 | .Fn EVP_CipherFinal_ex . | ||
| 474 | In previous releases of OpenSSL, they also used to clean up the | ||
| 475 | .Fa ctx , | ||
| 476 | but this is no longer done and | ||
| 477 | .Fn EVP_CIPHER_CTX_reset | ||
| 478 | or | ||
| 479 | .Fn EVP_CIPHER_CTX_free | ||
| 480 | must be called to free any context resources. | ||
| 481 | .Pp | ||
| 482 | .Fn EVP_get_cipherbyname , | 459 | .Fn EVP_get_cipherbyname , |
| 483 | .Fn EVP_get_cipherbynid , | 460 | .Fn EVP_get_cipherbynid , |
| 484 | and | 461 | and |
| @@ -520,25 +497,6 @@ final decrypt error. | |||
| 520 | If padding is disabled then the decryption operation will always succeed | 497 | If padding is disabled then the decryption operation will always succeed |
| 521 | if the total amount of data decrypted is a multiple of the block size. | 498 | if the total amount of data decrypted is a multiple of the block size. |
| 522 | .Pp | 499 | .Pp |
| 523 | The functions | ||
| 524 | .Fn EVP_EncryptInit , | ||
| 525 | .Fn EVP_EncryptFinal , | ||
| 526 | .Fn EVP_DecryptInit , | ||
| 527 | .Fn EVP_CipherInit , | ||
| 528 | and | ||
| 529 | .Fn EVP_CipherFinal | ||
| 530 | are obsolete but are retained for compatibility with existing code. | ||
| 531 | New code should use | ||
| 532 | .Fn EVP_EncryptInit_ex , | ||
| 533 | .Fn EVP_EncryptFinal_ex , | ||
| 534 | .Fn EVP_DecryptInit_ex , | ||
| 535 | .Fn EVP_DecryptFinal_ex , | ||
| 536 | .Fn EVP_CipherInit_ex , | ||
| 537 | and | ||
| 538 | .Fn EVP_CipherFinal_ex | ||
| 539 | because they can reuse an existing context without allocating and | ||
| 540 | freeing it up on each call. | ||
| 541 | .Pp | ||
| 542 | .Fn EVP_get_cipherbynid | 500 | .Fn EVP_get_cipherbynid |
| 543 | and | 501 | and |
| 544 | .Fn EVP_get_cipherbyobj | 502 | .Fn EVP_get_cipherbyobj |
| @@ -683,9 +641,11 @@ set to | |||
| 683 | .Dv NULL . | 641 | .Dv NULL . |
| 684 | .Pp | 642 | .Pp |
| 685 | When decrypting, the return value of | 643 | When decrypting, the return value of |
| 686 | .Fn EVP_DecryptFinal | 644 | .Fn EVP_DecryptFinal , |
| 645 | .Fn EVP_DecryptFinal_ex , | ||
| 646 | .Fn EVP_CipherFinal , | ||
| 687 | or | 647 | or |
| 688 | .Fn EVP_CipherFinal | 648 | .Fn EVP_CipherFinal_ex |
| 689 | indicates if the operation was successful. | 649 | indicates if the operation was successful. |
| 690 | If it does not indicate success, the authentication operation has | 650 | If it does not indicate success, the authentication operation has |
| 691 | failed and any output data MUST NOT be used as it is corrupted. | 651 | failed and any output data MUST NOT be used as it is corrupted. |
| @@ -704,6 +664,8 @@ bytes of the tag value to the buffer indicated by | |||
| 704 | This call can only be made when encrypting data and after all data has | 664 | This call can only be made when encrypting data and after all data has |
| 705 | been processed, e.g. after an | 665 | been processed, e.g. after an |
| 706 | .Fn EVP_EncryptFinal | 666 | .Fn EVP_EncryptFinal |
| 667 | or | ||
| 668 | .Fn EVP_EncryptFinal_ex | ||
| 707 | call. | 669 | call. |
| 708 | .It Fn EVP_CIPHER_CTX_ctrl ctx EVP_CTRL_GCM_SET_TAG taglen tag | 670 | .It Fn EVP_CIPHER_CTX_ctrl ctx EVP_CTRL_GCM_SET_TAG taglen tag |
| 709 | Sets the expected tag to | 671 | Sets the expected tag to |
