Skip to content

Commit d15077d

Browse files
erbsland-devt8m
authored andcommitted
Clarify EVP_CipherUpdate() authenticated bytes behavior
Fixes openssl#8310: Document that the number of authenticated bytes returned by EVP_CipherUpdate() varies with the cipher used. Mention that stream ciphers like ChaCha20 can handle 1 byte at a time, while OCB mode requires processing data one block at a time. Ensure it's clear that passing unpadded data in one call is safe. Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl#24961)
1 parent 71ae466 commit d15077d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

doc/man3/EVP_EncryptInit.pod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,15 @@ indicates whether the operation was successful. If it does not indicate success,
13901390
the authentication operation has failed and any output data B<MUST NOT> be used
13911391
as it is corrupted.
13921392

1393+
Please note that the number of authenticated bytes returned by
1394+
EVP_CipherUpdate() depends on the cipher used. Stream ciphers, such as ChaCha20
1395+
or ciphers in GCM mode, can handle 1 byte at a time, resulting in an effective
1396+
"block" size of 1. Conversely, ciphers in OCB mode must process data one block
1397+
at a time, and the block size is returned.
1398+
1399+
Regardless of the returned size, it is safe to pass unpadded data to an
1400+
EVP_CipherUpdate() call in a single operation.
1401+
13931402
=head2 GCM and OCB Modes
13941403

13951404
The following I<ctrl>s are supported in GCM and OCB modes.

0 commit comments

Comments
 (0)