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

Anthony Scarpino ascarpino at openjdk.java.net
Sat Jul 17 04:04:56 UTC 2021


On Fri, 16 Jul 2021 20:49:20 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Smita Kamath has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Updated AES-GCM intrinsic to match latest Java Code
>
> src/java.base/share/classes/com/sun/crypto/provider/GHASH.java line 146:
> 
>> 144:         }
>> 145:         state = new long[2];
>> 146:         subkeyHtbl = new long[2*57]; // 48 keys for the interleaved implementation, 8 for avx-ghash implementation and one for the original key
> 
> nit: the comment is too long, i.e. > 80

Ah.. I forgot I didn't change GHASH with my changes.. but I'll fix that thanks

> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 743:
> 
>> 741:                             dst.array(), dst.arrayOffset() + dst.position(),
>> 742:                             gctr, ghash);
>> 743:                     }
> 
> Can we use another ByteBuffer variable to avoid almost-duplicate calls?
> 
> ByteBuffer ct = (encryption? dst : src);
> rlen -= GaloisCounterMode.implGCMCrypt(src.array(),
>                             src.arrayOffset() + src.position(), src.remaining(),
>                             ct.array(), ct.arrayOffset() + ct.position(),
>                             dst.array(), dst.arrayOffset() + dst.position(),
>                             gctr, ghash);

That maybe a better choice

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

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



More information about the security-dev mailing list