RFR: 8253821: Improve ByteBuffer performance with GCM [v2]

Anthony Scarpino ascarpino at openjdk.java.net
Thu Oct 8 17:17:30 UTC 2020


On Thu, 8 Oct 2020 03:21:46 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Anthony Scarpino has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Xuelei comments
>
> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 528:
> 
>> 526:         }
>> 527:
>> 528:         ArrayUtil.blockSizeCheck(src.remaining(), blockSize);
> 
> Hmm, I am not sure if this check still applies in ByteBuffer case. You are passing the ByteBuffer objs directly from
> AESCipher->CipherCore->GaloisCounterMode. This is different from the byte[] case where CipherCore would chop up the
> data into blocks and pass the blocks to the underlying FeedbackCipher impl. Perhaps no existing regression tests covers
> ByteBuffer inputs w/ non-blocksize data? Otherwise, this should be caught? BTW, why not just use 'len' again? Seems
> unnecessary to keep calling src.remaining() in various places in this method.

Yes the check is unnecessary

I suspect not using len was simply a mistake

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

PR: https://git.openjdk.java.net/jdk/pull/411



More information about the security-dev mailing list