diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2018-02-13 20:22:41 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2018-02-16 19:28:10 +0200 |
commit | d02958bd300d2c80bc92b1e072103e95e256b297 (patch) | |
tree | 07dd0fc52f3b1bed068bced26647b4d8230229d1 /src/hwfeatures.c | |
parent | da58a62ac1b7a8d97b0895dcb41d15af531e45e5 (diff) | |
download | libgcrypt-d02958bd300d2c80bc92b1e072103e95e256b297.tar.gz |
Add Intel SHA Extensions accelerated SHA1 implementation
* cipher/Makefile.am: Add 'sha1-intel-shaext.c'.
* cipher/sha1-intel-shaext.c: New.
* cipher/sha1.c (USE_SHAEXT, _gcry_sha1_transform_intel_shaext): New.
(sha1_init) [USE_SHAEXT]: Use shaext implementation is supported.
(transform) [USE_SHAEXT]: Use shaext if enabled.
(transform): Only add ASM_EXTRA_STACK if returned burn length is not
zero.
* cipher/sha1.h (SHA1_CONTEXT): Add 'use_shaext'.
* configure.ac: Add 'sha1-intel-shaext.lo'.
(shaextsupport, gcry_cv_gcc_inline_asm_shaext): New.
* src/g10lib.h: Add HWF_INTEL_SHAEXT and reorder HWF flags.
* src/hwf-x86.c (detect_x86_gnuc): Detect SHA Extensions.
* src/hwfeatures.c (hwflist): Add 'intel-shaext'.
--
Benchmark on Intel Celeron J3455 (1500 Mhz, no turbo):
Before:
| nanosecs/byte mebibytes/sec cycles/byte
SHA1 | 4.50 ns/B 211.7 MiB/s 6.76 c/B
After (4.0x faster):
| nanosecs/byte mebibytes/sec cycles/byte
SHA1 | 1.11 ns/B 858.1 MiB/s 1.67 c/B
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'src/hwfeatures.c')
-rw-r--r-- | src/hwfeatures.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/hwfeatures.c b/src/hwfeatures.c index 1cad546d..e0816694 100644 --- a/src/hwfeatures.c +++ b/src/hwfeatures.c @@ -58,6 +58,7 @@ static struct { HWF_INTEL_AVX2, "intel-avx2" }, { HWF_INTEL_FAST_VPGATHER, "intel-fast-vpgather" }, { HWF_INTEL_RDTSC, "intel-rdtsc" }, + { HWF_INTEL_SHAEXT, "intel-shaext" }, { HWF_ARM_NEON, "arm-neon" }, { HWF_ARM_AES, "arm-aes" }, { HWF_ARM_SHA1, "arm-sha1" }, |