Home GnuPG

Add intel-pclmul accelerated POLYVAL for GCM-SIV

Description

Add intel-pclmul accelerated POLYVAL for GCM-SIV

* cipher/cipher-gcm-intel-pclmul.c (gfmul_pclmul_aggr4)
(gfmul_pclmul_aggr8): Move assembly to new GFMUL_AGGRx_ASM* macros.
(GFMUL_AGGR4_ASM_1, GFMUL_AGGR4_ASM_2, gfmul_pclmul_aggr4_le)
(GFMUL_AGGR8_ASM, gfmul_pclmul_aggr8_le)
(_gcry_polyval_intel_pclmul): New.
* cipher/cipher-gcm-siv.c (do_polyval_buf): Use polyval function
if available.
* cipher/cipher-gcm.c (_gcry_polyval_intel_pclmul): New.
(setupM): Setup 'c->u_mode.gcm.polyval_fn' with accelerated polyval
function if available.
* cipher/cipher-internal.h (gcry_cipher_handle): Add member
'u_mode.gcm.polyval_fn'.

Benchmark on AMD Ryzen 7 5800X:

Before:
AES | nanosecs/byte mebibytes/sec cycles/byte auto Mhz

 GCM-SIV enc |     0.150 ns/B      6337 MiB/s     0.730 c/B      4849
 GCM-SIV dec |     0.163 ns/B      5862 MiB/s     0.789 c/B      4850
GCM-SIV auth |     0.119 ns/B      8022 MiB/s     0.577 c/B      4850

After (enc/dec ~26% faster, auth ~43% faster):
AES | nanosecs/byte mebibytes/sec cycles/byte auto Mhz

 GCM-SIV enc |     0.117 ns/B      8138 MiB/s     0.568 c/B      4850
 GCM-SIV dec |     0.128 ns/B      7429 MiB/s     0.623 c/B      4850
GCM-SIV auth |     0.083 ns/B     11507 MiB/s     0.402 c/B      4851
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Oct 27 2021, 8:04 PM
Parents
rCec671cfa2398: random: Include getentropy random module.
Branches
Unknown
Tags
Unknown