Add ARM/NEON implementation for SHA-1
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Tue, 17 Dec 2013 13:35:38 +0000 (15:35 +0200)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Wed, 18 Dec 2013 15:00:33 +0000 (17:00 +0200)
commitfc7dcf616937afaf73cfda1bf7bd79566a96b130
treecf2736324f73aa279bb6ecc66dc197b56a707963
parentdf629ba53a662427ebd3ddca90c3fe9ddd6511d3
Add ARM/NEON implementation for SHA-1

* cipher/Makefile.am: Add 'sha1-armv7-neon.S'.
* cipher/sha1-armv7-neon.S: New.
* cipher/sha1.c (USE_NEON): New.
(SHA1_CONTEXT, sha1_init) [USE_NEON]: Add and initialize 'use_neon'.
[USE_NEON] (_gcry_sha1_transform_armv7_neon): New.
(transform) [USE_NEON]: Use ARM/NEON assembly if enabled.
* configure.ac: Add 'sha1-armv7-neon.lo'.
--

Patch adds ARM/NEON implementation for SHA-1.

Benchmarks show 1.72x improvement on ARM Cortex-A8, 1008 Mhz:

jussi@cubie:~/libgcrypt$ tests/bench-slope --cpu-mhz 1008 hash sha1
Hash:
                |  nanosecs/byte   mebibytes/sec   cycles/byte
 SHA1           |      7.80 ns/B     122.3 MiB/s      7.86 c/B
                =
jussi@cubie:~/libgcrypt$ tests/bench-slope --disable-hwf arm-neon --cpu-mhz 1008 hash sha1
Hash:
                |  nanosecs/byte   mebibytes/sec   cycles/byte
 SHA1           |     13.41 ns/B     71.10 MiB/s     13.52 c/B
                =

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/Makefile.am
cipher/sha1-armv7-neon.S [new file with mode: 0644]
cipher/sha1.c
configure.ac