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>