RFR: 8255557: Decouple GCM from CipherCore [v4]

Valerie Peng valeriep at openjdk.java.net
Thu Jun 3 21:56:13 UTC 2021


On Wed, 2 Jun 2021 20:23:38 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 1610:
>> 
>>> 1608:                     // update the input parameters for what was taken out of 'in'
>>> 1609:                     inOfs += inUsed;
>>> 1610:                     inLen -= inUsed;
>> 
>> This merge block code won't be needed if inLen == 0, i.e. can just assign in to be buffer, inOfs to 0, and inLen to bufRemaining.
>
> You are correct, but it's not that simple to handle this case without adding more if()'s which I've found can slow down overall performance.  I'm hesitant change this code for this case

Ok, perhaps most often than not inLen != 0, so not worthwhile to check this.

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

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



More information about the security-dev mailing list