Home GnuPG

Add SHA-256 implementations for POWER8 and POWER9

Description

Add SHA-256 implementations for POWER8 and POWER9

* cipher/Makefile.am: Add 'sha256-ppc.c'; Add extra CFLAG handling for
'sha256-ppc.c'.
* cipher/sha256-ppc.c: New.
* cipher/sha256.c (USE_PPC_CRYPTO, _gcry_sha256_transform_ppc8)
(_gcry_sha256_transform_ppc9, do_sha256_transform_ppc8)
(do_sha256_transform_ppc9): New.
(sha256_init, sha224_init): Split common part to new function named...
(sha256_common_init): ...this; Add PowerPC HW feature detection and
implementation selection.
* configure.ac: Add 'vshasigmaw' instruction to PowerPC assembly
support check; Add 'sha256-ppc.lo'.

Benchmark on POWER8 ~3.8Ghz:
Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 4.17 ns/B 228.6 MiB/s 15.85 c/B

After (~1.63x faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 2.55 ns/B 373.9 MiB/s 9.69 c/B

For comparison, OpenSSL 1.1.1b (~2.4% slower):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 2.61 ns/B 364.8 MiB/s 9.93 c/B

Benchmark on POWER9 ~3.8Ghz:
Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 3.23 ns/B 295.6 MiB/s 12.26 c/B

After (~1.04x faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 3.10 ns/B 307.7 MiB/s 11.78 c/B

For comparison, OpenSSL 1.1.1b (~6.4% faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 2.91 ns/B 327.5 MiB/s 11.07 c/B

  • GnuPG-bug-id: T4530
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Aug 31 2019, 12:24 AM
Parents
rC418179593080: hwf-ppc: add detection for PowerISA 3.00
Branches
Unknown
Tags
Unknown
Tasks
T4530: libgcrypt: POWER SHA-2 Vector Acceleration