RFR: 8255557: Decouple GCM from CipherCore [v4]

Anthony Scarpino ascarpino at openjdk.java.net
Wed Jun 2 16:22:48 UTC 2021


On Thu, 20 May 2021 18:38:35 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Anthony Scarpino has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix perf problem by reorganizing doLastBlock()
>
> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 1030:
> 
>> 1028:                     inOfs += inLenUsed;
>> 1029:                     inLen -= inLenUsed;
>> 1030:                     outOfs += blockSize;
> 
> 'blockSize' should be 'len'?

Either is fine because len and blockSize will be the same.

> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 1033:
> 
>> 1031:                     ibuffer.reset();
>> 1032:                     // Code below will write the remainder from 'in' to ibuffer
>> 1033:                 } else if (remainder > 0) {
> 
> If bLen == 0, there is no need to put the rest of 'buffer' into 'ibuffer'.
> It looks strange that the remaining buffer data is stored back into 'ibuffer', then the code proceeds to encrypt 'in' from line 1043-1046. This looks incorrect as all prior buffered input should be processed before process current input.

code has changed. not applicable anymore

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

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



More information about the security-dev mailing list