RFR: 8366833: Poly1305 does not always correctly update position for array-backed ByteBuffers after processMultipleBlocks
Jamil Nimeh
jnimeh at openjdk.org
Thu Sep 4 02:38:23 UTC 2025
This fix resolves an issue where the `Cipher.updateAAD(ByteBuffer)` method, when used on a ChaCha20-Poly1305 Cipher, may throw an exception due to an offset calculation error. This occurs when the ByteBuffer is array-backed, and when the buffer passed into the method is a slice of another array-backed buffer and that slice begins at a non-zero offset in the parent ByteBuffer.
Credit and thanks to @jaikiran for finding the issue and providing reproducer code.
-------------
Commit messages:
- Fix whitespace errors, add trailing newline
- merge with main
- 8366833: Poly1305 does not always correctly update position for array-backed ByteBuffers after processMultipleBlocks
Changes: https://git.openjdk.org/jdk/pull/27081/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27081&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8366833
Stats: 135 lines in 2 files changed: 133 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/27081.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27081/head:pull/27081
PR: https://git.openjdk.org/jdk/pull/27081
More information about the security-dev
mailing list