Home GnuPG

Add Intel PCLMUL acceleration for GCM
5a65ffabadd5Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Add Intel PCLMUL acceleration for GCM

* cipher/cipher-gcm.c (fillM): Rename...
(do_fillM): ...to this.
(ghash): Remove.
(fillM): New macro.
(GHASH): Use 'do_ghash' instead of 'ghash'.
[GCM_USE_INTEL_PCLMUL] (do_ghash_pclmul): New.
(ghash): New.
(setupM): New.
(_gcry_cipher_gcm_encrypt, _gcry_cipher_gcm_decrypt)
(_gcry_cipher_gcm_authenticate, _gcry_cipher_gcm_setiv)
(_gcry_cipher_gcm_tag): Use 'ghash' instead of 'GHASH' and
'c->u_mode.gcm.u_tag.tag' instead of 'c->u_tag.tag'.
* cipher/cipher-internal.h (GCM_USE_INTEL_PCLMUL): New.
(gcry_cipher_handle): Move 'u_tag' and 'gcm_table' under
'u_mode.gcm'.
* configure.ac (pclmulsupport, gcry_cv_gcc_inline_asm_pclmul): New.
* src/g10lib.h (HWF_INTEL_PCLMUL): New.
* src/global.c: Add "intel-pclmul".
* src/hwf-x86.c (detect_x86_gnuc): Add check for Intel PCLMUL.

Speed-up GCM for Intel CPUs.

Intel Haswell (x86-64):
Old:
AES GCM enc | 5.17 ns/B 184.4 MiB/s 16.55 c/B

 GCM dec |      4.38 ns/B     218.0 MiB/s     14.00 c/B
GCM auth |      3.17 ns/B     300.4 MiB/s     10.16 c/B

New:
AES GCM enc | 3.01 ns/B 317.2 MiB/s 9.62 c/B

 GCM dec |      1.96 ns/B     486.9 MiB/s      6.27 c/B
GCM auth |     0.848 ns/B    1124.8 MiB/s      2.71 c/B
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Nov 19 2013, 10:26 PM
Parents
rC0e9e7d72f3c9: GCM: GHASH optimizations
Branches
Unknown
Tags
Unknown

Event Timeline

Jussi Kivilinna <jussi.kivilinna@iki.fi> committed rC5a65ffabadd5: Add Intel PCLMUL acceleration for GCM (authored by Jussi Kivilinna <jussi.kivilinna@iki.fi>).Nov 20 2013, 5:26 PM