Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: botan_cipher_update() byte generation behavior #4088

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

reneme
Copy link
Collaborator

@reneme reneme commented May 31, 2024

This is in response to a downstream user question. Before finalization, when passing x input bytes to botan_cipher_update it will at most generate x output bytes. However, it might generate less bytes. For instance, SIV-mode won't generate any output until the message is finalized. Typically, the number of output bytes produced will be equal to the number of input bytes consumed. Note however, that botan_cipher_update might not consume all input bytes provided.

Note that, during finalization botan_cipher_update() may generate more output bytes than input bytes. Namely, when encrypting using an AEAD, the authentication tag is added. If there's not enough space in the user-provided output buffer, BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE will be returned and output_written will be set to the number of bytes required for a successful finalization.

@coveralls
Copy link

Coverage Status

coverage: 91.823% (+0.002%) from 91.821%
when pulling 882bf7f on Rohde-Schwarz:doc/botan_cipher_update
into 36e0acd on randombit:master.

@reneme reneme merged commit 908dfde into randombit:master Jun 1, 2024
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants