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

Valerie Peng valeriep at openjdk.java.net
Mon Nov 2 20:29:04 UTC 2020


On Thu, 8 Oct 2020 15:32:46 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java line 1253:
>> 
>>> 1251:         if (decrypting) {
>>> 1252:             if (buffered > 0) {
>>> 1253:                 cipher.decrypt(buffer, 0, buffered, new byte[0], 0);
>> 
>> This looks a bit strange? The output buffer is 0-length which would lead to ShortBufferException when the buffered bytes is enough to produce some output.
>
> This is right.  decrypt() puts the data into GaloisCounterMode.ibuffer and never uses the output

Hmm, right, I forgot that GCM cipher has that internal buffering.

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

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



More information about the security-dev mailing list