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

Anthony Scarpino ascarpino at openjdk.java.net
Fri Oct 9 04:41:20 UTC 2020


On Fri, 9 Oct 2020 01:01:47 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 595:
> 
>> 593:         }
>> 594:         GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock);
>> 595:         gctrForSToTag.doFinal(s, 0, s.length, block, 0);
> 
> since GCTR output the same length of output as input, (e.g. 'sOut' is same length as 's'), can't we just re-use 's' as
> the output buffer instead of 'block'?

Actually I can take it one step further.. I think I can remove 's' and use 'block' for everything.  I'll have to make
sure no unexpected overwriting happens.

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

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



More information about the security-dev mailing list