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

Anthony Scarpino ascarpino at openjdk.java.net
Sat Nov 14 00:25:06 UTC 2020


On Fri, 13 Nov 2020 20:47:53 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Anthony Scarpino has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Code review comment update
>>   Major change to test to detect corruption with incremental buffers test
>
> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 540:
> 
>> 538:             // remainder offset is based on original buffer length
>> 539:             ibuffer.write(in, inOfs + inLen, remainder);
>> 540:         }
> 
> I wonder if this can be moved down for better readability, i.e. process data in multiple of blocks, and store the remaining into 'ibuffer'?

I tried to, but I don't like how the variable line up doing the remainder afterwards.  I put some hopefully better comments above each section

> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 563:
> 
>> 561:         } else {
>> 562:             System.arraycopy(buffer, 0, block, 0, buflen);
>> 563:             System.arraycopy(in, buflen, block, buflen,
> 
> Use 'bufLen' as the offset for 'in' looks incorrect?

Yes, it should be in's offset

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

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


More information about the security-dev mailing list