Add SHA-512 implementations for POWER8 and POWER9

Authored by jukivili on Aug 31 2019, 12:24 AM.

Description

Add SHA-512 implementations for POWER8 and POWER9

* cipher/Makefile.am: Add 'sha512-ppc.c'; Add extra CFLAG handling for
'sha512-ppc.c'.
* cipher/sha512-ppc.c: New.
* cipher/sha512.c (USE_PPC_CRYPTO, _gcry_sha512_transform_ppc8)
(_gcry_sha512_transform_ppc9, do_sha512_transform_ppc8)
(do_sha512_transform_ppc9): New.
(sha512_init_common): Add PowerPC HW feature detection and
implementation selection.
* configure.ac: Add 'vshasigmad' instruction to PowerPC assembly
support check; Add 'sha512-ppc.lo'.

Benchmark on POWER8 ~3.8Ghz:
Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA512 | 3.47 ns/B 274.6 MiB/s 13.20 c/B

After (~2.1x faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA512 | 1.64 ns/B 581.8 MiB/s 6.23 c/B

For comparison, OpenSSL 1.1.1b (~same):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA512 | 1.64 ns/B 582.2 MiB/s 6.22 c/B

Benchmark on POWER9 ~3.8Ghz:
Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA512 | 2.65 ns/B 359.6 MiB/s 10.08 c/B

After (~1.33x faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA512 | 1.99 ns/B 480.3 MiB/s 7.55 c/B

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

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA512 | 1.82 ns/B 524.4 MiB/s 6.91 c/B

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

Details