diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2019-10-14 22:08:29 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2019-10-14 22:08:29 +0300 |
commit | f9d8b5a0369cc94e125d36d9c8864d5cd2eaa1d2 (patch) | |
tree | 67a58ad7a8d040946964ac1753c00144ba4f9066 /cipher/gostr3411-94.c | |
parent | ff0f1782560eb45458d9a8dd97088dabeddb34e7 (diff) | |
download | libgcrypt-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/gostr3411-94.c')
-rw-r--r-- | cipher/gostr3411-94.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cipher/gostr3411-94.c b/cipher/gostr3411-94.c index d9746275..ebf9e0a2 100644 --- a/cipher/gostr3411-94.c +++ b/cipher/gostr3411-94.c @@ -61,7 +61,7 @@ gost3411_init (void *context, unsigned int flags) hd->bctx.nblocks = 0; hd->bctx.count = 0; - hd->bctx.blocksize = 32; + hd->bctx.blocksize_shift = _gcry_ctz(32); hd->bctx.bwrite = transform; hd->cryptopro = 0; } |