Home GnuPG

Add Intel SHA Extensions accelerated SHA256 implementation

Description

Add Intel SHA Extensions accelerated SHA256 implementation

* cipher/Makefile.am: Add 'sha256-intel-shaext.c'.
* cipher/sha256-intel-shaext.c: New.
* cipher/sha256.c (USE_SHAEXT)
(_gcry_sha256_transform_intel_shaext): New.
(SHA256_CONTEXT): Add 'use_shaext'.
(sha256_init, sha224_init) [USE_SHAEXT]: Use shaext if supported.
(transform) [USE_SHAEXT]: Use shaext if enabled.
(transform): Only add ASM_EXTRA_STACK if returned burn length is not
zero.
* configure.ac: Add 'sha256-intel-shaext.lo'.

Benchmark on Intel Celeron J3455 (1500 Mhz, no turbo):

Before:

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 10.07 ns/B 94.72 MiB/s 15.10 c/B

After (3.7x faster):

|  nanosecs/byte   mebibytes/sec   cycles/byte

SHA256 | 2.70 ns/B 353.8 MiB/s 4.04 c/B

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

Details

Provenance
jukiviliAuthored on Feb 15 2018, 9:13 PM
Parents
rCd02958bd300d: Add Intel SHA Extensions accelerated SHA1 implementation
Branches
Unknown
Tags
Unknown