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

Anthony Scarpino ascarpino at openjdk.java.net
Thu Oct 22 20:11:16 UTC 2020


On Fri, 9 Oct 2020 02:38:05 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 614:
> 
>> 612:         }
>> 613: 
>> 614:         checkDataLength(processed, len);
> 
> It seems that both checks (line 605 and 614) can be combined into: 
> checkDataLength(processed, Math.addExact(len, tagLenBytes));

I changed both encryptFinal for byte[] and bytebuffer, as I got that check from copying the byte[] method.  They do look like mostly redundant checks, and I moved them to the top.

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

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



More information about the security-dev mailing list