Home GnuPG

Add s390x/zSeries acceleration for SHA3

Description

Add s390x/zSeries acceleration for SHA3

* cipher/asm-inline-s390x.h (KLMD_PADDING_STATE): New.
(kimd_execute): Change 'reg0' from read-only to read/write.
(klmd_shake_execute): New.
* cipher/keccak.c (USE_S390X_CRYPTO): New.
(KECCAK_CONTEXT) [USE_S390X_CRYPTO]: New members.
[USE_S390X_CRYPTO] (keccak_bwrite_s390x, keccak_final_s390x)
(keccak_bextract_s390x, keccak_write_s390x, keccak_extract_s390x): New.
(keccak_write) [USE_S390X_CRYPTO]: Use accelerated function if enabled.
(keccak_final) [USE_S390X_CRYPTO]: Likewise.
(keccak_extract) [USE_S390X_CRYPTO]: Likewise.
(keccak_init) [USE_S390X_CRYPTO]: Detect and setup zSeries
acceleration.

Benchmark (z15, 5.2Ghz):

Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA3-224 | 3.71 ns/B 256.9 MiB/s 19.31 c/B
SHA3-256 | 3.92 ns/B 243.0 MiB/s 20.41 c/B
SHA3-384 | 5.12 ns/B 186.2 MiB/s 26.63 c/B
SHA3-512 | 7.39 ns/B 129.0 MiB/s 38.43 c/B
SHAKE128 | 3.19 ns/B 299.4 MiB/s 16.57 c/B
SHAKE256 | 3.93 ns/B 242.9 MiB/s 20.42 c/B

After:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA3-224 | 0.115 ns/B 8320 MiB/s 0.596 c/B
SHA3-256 | 0.118 ns/B 8088 MiB/s 0.613 c/B
SHA3-384 | 0.139 ns/B 6868 MiB/s 0.722 c/B
SHA3-512 | 0.179 ns/B 5329 MiB/s 0.931 c/B
SHAKE128 | 0.107 ns/B 8950 MiB/s 0.554 c/B
SHAKE256 | 0.118 ns/B 8075 MiB/s 0.614 c/B

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

Details

Provenance
jukiviliAuthored on Nov 7 2020, 11:12 AM
Parents
rC45f0ec0c4e3b: Add s390x/zSeries acceleration for SHA512
Branches
Unknown
Tags
Unknown