summaryrefslogtreecommitdiff
path: root/cipher/whirlpool.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2019-10-14 22:08:29 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2019-10-14 22:08:29 +0300
commitf9d8b5a0369cc94e125d36d9c8864d5cd2eaa1d2 (patch)
tree67a58ad7a8d040946964ac1753c00144ba4f9066 /cipher/whirlpool.c
parentff0f1782560eb45458d9a8dd97088dabeddb34e7 (diff)
downloadlibgcrypt-f9d8b5a0369cc94e125d36d9c8864d5cd2eaa1d2.tar.gz
hash-common: avoid integer division to reduce call overhead
* cipher/hash-common.h (gcry_md_block_ctx): Replace 'blocksize' with 'blocksize_shift'. * cipher/hash-common.c (_gcry_md_block_write): Use bit-level operations instead of division to get number of blocks. * cipher/gostr2411-94.c (gost3411_init): Initialize 'blocksize_shift' instead of 'blocksize'. * cipher/md2.c (md2_init): Ditto. * cipher/md4.c (md4_init): Ditto. * cipher/md5.c (md5_init): Ditto. * cipher/rmd160.c (rmd160_init): Ditto. * cipher/sha1.c (sha1_init): Ditto. * cipher/sha256.c (sha256_common_init): Ditto. * cipher/sha512.c (sha512_init_common): Ditto. * cipher/sm3.c (sm3_init): Ditto. * cipher/stribog.c (stribog_init_512): Ditto. * cipher/tiger.c (do_init): Ditto. * cipher/whirlpool.c (whirlpool_init): Ditto. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/whirlpool.c')
-rw-r--r--cipher/whirlpool.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cipher/whirlpool.c b/cipher/whirlpool.c
index d9b79cf1..79b2026b 100644
--- a/cipher/whirlpool.c
+++ b/cipher/whirlpool.c
@@ -1179,7 +1179,7 @@ whirlpool_init (void *ctx, unsigned int flags)
memset (context, 0, sizeof (*context));
- context->bctx.blocksize = BLOCK_SIZE;
+ context->bctx.blocksize_shift = _gcry_ctz(BLOCK_SIZE);
context->bctx.bwrite = whirlpool_transform;
if ((flags & GCRY_MD_FLAG_BUGEMU1))
{