Skip to content

KCCM partial AEAD block - #2350

Closed
tonywasher wants to merge 2 commits into
bcgit:mainfrom
tonywasher:KCCMpartialAEADBlock
Closed

KCCM partial AEAD block#2350
tonywasher wants to merge 2 commits into
bcgit:mainfrom
tonywasher:KCCMpartialAEADBlock

Conversation

@tonywasher

Copy link
Copy Markdown
Contributor

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.

@dghgit dghgit self-assigned this Jul 12, 2026
@dghgit

dghgit commented Jul 12, 2026

Copy link
Copy Markdown
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.

@tonywasher

Copy link
Copy Markdown
Contributor Author

Thanks, no idea how that crept in. All works.

@dghgit

dghgit commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

I know that feeling. Cheers, marking this as closed then. It's the last fix for this release.

@dghgit dghgit closed this Jul 12, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants