RFR: 8267125: AES Galois CounterMode (GCM) interleaved implementation using AVX512 + VAES instructions [v4]

Anthony Scarpino ascarpino at openjdk.java.net
Sat Jul 17 16:53:52 UTC 2021


On Fri, 16 Jul 2021 19:41:53 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 629:
>> 
>>> 627:         GCTR gctr;
>>> 628:         GHASH ghash;
>>> 629:         GCMOperation op;
>> 
>> It seems clearer to initialize "op" in GCMEngine ctor since it's declared here. There is already logic in its method checking whether we are doing encryption or decryption.
>
> Now that you have GCMOperation op, but there is still if-else blocks checking whether it's encryption/decryption and uses gctr and ghash instead of op. Looks like a bit adhoc? Can GaloisCounterMode.implGCMCrypt(...) just take GCMOperation op instead, no need for ct, ctOfs, gctr and ghash?

Initializing op in abstract GCMEngine would mean another 'if(encryption)', when that would not be needed in the  GCMEncrypt() or GCMDecrypt().  I don't see why that is clearer. 

GaloisCounterMode.implGCMCrypt(...) is the intrinsic, so I have to use what is used by hotspot.

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

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



More information about the security-dev mailing list