Add Intel SHA Extensions accelerated SHA256 implementation
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Thu, 15 Feb 2018 20:13:28 +0000 (22:13 +0200)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Fri, 16 Feb 2018 18:08:24 +0000 (20:08 +0200)
commit0b3ec359e2279c3b46b171372b1b7733bba20cd7
tree84bdec7b5319e9784de6d60621d50dea3df793dd
parentd02958bd300d2c80bc92b1e072103e95e256b297
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>
cipher/Makefile.am
cipher/sha256-intel-shaext.c [new file with mode: 0644]
cipher/sha256.c
configure.ac