RFR: 8366833: Poly1305 does not always correctly update position for array-backed ByteBuffers after processMultipleBlocks [v2]
Jamil Nimeh
jnimeh at openjdk.org
Thu Sep 4 15:23:01 UTC 2025
On Thu, 4 Sep 2025 08:42:10 GMT, Ferenc Rakoczi <duke at openjdk.org> wrote:
>> Jamil Nimeh has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove unneeded comments
>
> test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/UpdateAADTest.java line 115:
>
>> 113:
>> 114: try {
>> 115: cipher.updateAAD(buffer);
>
> Shouldn't we also check that the cipher's state is what we expected after this update?
I've added a check on the buffer position and limit to ensure that the buffer has no remaining data at the end. This can only happen if processMultipleBlocks ends with the buffer's position left at the first byte of trailing data where 0 <= remaining < 16. The engineUpdate method will take care of any remaining non-block aligned data (if it exists).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27081#discussion_r2322534685
More information about the security-dev
mailing list