Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(deoxys): skip redundant block cipher call for empty tail in Deoxys-II CTR#799

Open
sashass1315 wants to merge 1 commit intoRustCrypto:masterfrom
sashass1315:fix/deoxys-ii-skip-empty-tail-encryption
Open

fix(deoxys): skip redundant block cipher call for empty tail in Deoxys-II CTR#799
sashass1315 wants to merge 1 commit intoRustCrypto:masterfrom
sashass1315:fix/deoxys-ii-skip-empty-tail-encryption

Conversation

Copy link

sashass1315 commented Feb 10, 2026

encrypt_decrypt_message in Deoxys-II unconditionally called encrypt_decrypt_block for the tail (partial block) even when the buffer length is an exact multiple of 16. This resulted in a wasted AES block cipher invocation that produced no output - xor_in2out on an empty slice is a no-op but the encryption still ran.

Every other tail-handling site in the same file (compute_ad_tag, authenticate_message, Deoxys-I encrypt_inout/decrypt_inout) guards with an is_empty() check. The Oasis Labs reference implementation also gates on remaining_bytes > 0.

Add if !data.is_empty() guard before the tail encrypt_decrypt_block call, consistent with the rest of the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant