Home GnuPG

sha512: add AArch64 crypto/SHA512 extension implementation

Description

sha512: add AArch64 crypto/SHA512 extension implementation

* cipher/Makefile.am: Add 'sha512-armv8-aarch64-ce.S'.
* cipher/sha512-armv8-aarch64-ce.S: New.
* cipher/sha512.c (ATTR_ALIGNED_64, USE_ARM64_SHA512): New.
(k): Make array aligned to 64 bytes.
[USE_ARM64_SHA512] (_gcry_sha512_transform_armv8_ce): New.
[USE_ARM64_SHA512] (do_sha512_transform_armv8_ce): New.
(sha512_init_common) [USE_ARM64_SHA512]: Use ARMv8-SHA512 accelerated
implementation if HW feature available.
* configure.ac: Add 'sha512-armv8-aarch64-ce.lo'.
(gcry_cv_gcc_inline_asm_aarch64_sha3_sha512_sm3_sm4)
(HAVE_GCC_INLINE_ASM_AARCH64_SHA3_SHA512_SM3_SM4): New.

Benchmark on AWS Graviton3:

Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte  auto Mhz

SHA512 | 2.36 ns/B 404.2 MiB/s 6.13 c/B 2600

After (2.4x faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte  auto Mhz

SHA512 | 0.977 ns/B 976.6 MiB/s 2.54 c/B 2600

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

Details

Provenance
jukiviliAuthored on Jul 21 2022, 10:24 AM
Parents
rC909daa700e4b: blake2: add AVX512 accelerated implementations
Branches
Unknown
Tags
Unknown