RFR: 8366833: Poly1305 does not always correctly update position for array-backed ByteBuffers after processMultipleBlocks [v4]

Jamil Nimeh jnimeh at openjdk.org
Fri Sep 5 16:34:14 UTC 2025


On Fri, 5 Sep 2025 15:35:02 GMT, Matthew Donovan <mdonovan at openjdk.org> wrote:

>> Jamil Nimeh has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix typo in exception message
>
> test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/UpdateAADTest.java line 56:
> 
>> 54: 
>> 55:     public static void main(final String[] args) throws Exception {
>> 56:         ByteBuffer twoKBuf = ByteBuffer.allocate(2048);
> 
> Is it relevant to include a test case for MemorySegment-backed ByteBuffers?

It depends on how the MemorySegment is made, I think.  If something like `MemorySegment.ofArray(new byte[2048])` were to be used and a ByteBuffer created from that, I believe the `hasArray()` method would return true and therefore would fall into this code path.
I'll make a test case using an array-backed MemorySegment and see what happens with both non-sliced and sliced ByteBuffers are used.  I was planning on doing some rewrites on this test anyway to handle a test case @ferakocz wanted so I'll include this as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27081#discussion_r2325537785


More information about the security-dev mailing list