RFR: JDK-8314901: AES-GCM interleaved implementation using AVX2 instructions

Smita Kamath svkamath at openjdk.org
Thu Sep 7 23:32:37 UTC 2023


On Thu, 7 Sep 2023 23:23:13 GMT, Smita Kamath <svkamath at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 590:
>> 
>>> 588:     private static int implGCMCrypt(byte[] in, int inOfs, int inLen, byte[] ct,
>>> 589:                                     int ctOfs, byte[] out, int outOfs,
>>> 590:                                     GCTR gctr, GHASH ghash, boolean encryption) {
>> 
>> It looks to me that you don't need to introduce this "boolean encryption" here as it is simply (ct == out), which can easily be calculated in the intrinsics and that saves a lot of code change.
>
> @ferakocz Thank you for your comment. I will make the change.

@ascarpino Apologies for the delay in responding, I was away on vacation. There are fewer number of registers available in the AVX2 algorithm as compared to AVX512. That's why its essential for the intrinsic to know if it is encryption or decryption this time around. I will be implementing Ferenc's suggestion and remove the boolean variable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15410#discussion_r1319206174



More information about the security-dev mailing list