KCCM partial AEAD block - #2350
Closed
tonywasher wants to merge 2 commits into
Closed
Conversation
Contributor
|
Merged with one small revision - the authLen value has the blockSize subtracted from it at the end of the loop so the (authLen - assocOff) in the PR was doubling up. It's now up on https://www.bouncycastle.org/betas if you want to try the revision. |
Contributor
Author
|
Thanks, no idea how that crept in. All works. |
Contributor
|
I know that feeling. Cheers, marking this as closed then. It's the last fix for this release. |
hubot
pushed a commit
that referenced
this pull request
Jul 14, 2026
…Cipher (DSTU 7624 CCM), incorporating github PR #2350: init zero-extends a short nonce to the block size and processAssociatedText zero-pads a trailing partial AAD block instead of throwing "padding not supported". Corrects the PR's AAD MAC loop, whose bound byteIndex < authLen - assocOff double-subtracted the offset (authLen already equals aadLen - assocOff) and skipped every AAD block after the first, silently changing the MAC for multi-block associated data; the bound is byteIndex < authLen. Adds DSTU7624Test cases locking the multi-block AAD MAC to its pre-PR value and round-tripping partial AAD and short nonces; relates to github #2350.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following the fixes for github #287, the KCCM mode still rejects AEAD data that is not a multiple of the engine blockSize.
In addition, the nonce is required to be at least as long as the engine blockSize. It should probably be required to be exactly the blockSize, since it is simply processed as a block by the underlying engine, and subsequent bytes are ignored.