Clean-up implementation selection for SHA1 and SHA2
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Tue, 19 Jun 2018 19:10:49 +0000 (22:10 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Tue, 19 Jun 2018 19:10:49 +0000 (22:10 +0300)
commit8a44c55d2fb758f726b8b436aa5c0b88a6c6f112
tree3b7051fbf9dc861dea2c1b78c5d3a6aeb9d35b81
parent59c4e344eec61cff45185e1caea6815b3266a0f8
Clean-up implementation selection for SHA1 and SHA2

* cipher/sha1.c (ASM_EXTRA_STACK): Increase by sizeof(void*)*4.
(do_sha1_transform_amd64_ssse3, do_sha1_transform_amd64_avx)
(do_sha1_transform_amd64_avx_bmi2, do_sha1_transform_intel_shaext)
(do_sha1_transform_armv7_neon, do_sha1_transform_armv8_ce): New.
(transform_blk, transform): Merge to ...
(do_transform_generic): ... this and remove calls to assembly
implementations.
(sha1_init): Select hd->bctx.bwrite based on HW features.
(_gcry_sha1_mixblock, sha1_final): Call hd->bctx.bwrite instead of
transform.
* cipher/sha1.h (SHA1_CONTEXT): Remove implementation selection bits.
* cipher/sha256.h (SHA256_CONTEXT): Remove implementation selection
bits.
(ASM_EXTRA_STACK): Increase by sizeof(void*)*4.
(do_sha256_transform_amd64_ssse3, do_sha256_transform_amd64_avx)
(do_sha256_transform_amd64_avx2, do_sha256_transform_intel_shaext)
(do_sha256_transform_armv8_ce): New.
(transform_blk, transform): Merge to ...
(do_transform_generic): ... this and remove calls to assembly
implementations.
(sha256_init, sha224_init): Select hd->bctx.bwrite based on HW
features.
(sha256_final): Call hd->bctx.bwrite instead of transform.
* cipher/sha512-armv7-neon.S
(_gcry_sha512_transform_armv7_neon): Return zero.
* cipher/sha512.h (SHA512_CONTEXT): Remove implementation selection
bits.
(ASM_EXTRA_STACK): Increase by sizeof(void*)*4.
(do_sha512_transform_armv7_neon, do_sha512_transform_amd64_ssse3)
(do_sha512_transform_amd64_avx, do_sha512_transform_amd64_avx2): New.
[USE_ARM_ASM] (do_transform_generic): New.
(transform_blk, transform): Merge to ...
[!USE_ARM_ASM] (do_transform_generic): ... this and remove calls to
assembly implementations.
(sha512_init, sha384_init): Select hd->bctx.bwrite based on HW
features.
(sha512_final): Call hd->bctx.bwrite instead of transform.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/sha1.c
cipher/sha1.h
cipher/sha256.c
cipher/sha512-armv7-neon.S
cipher/sha512.c