summaryrefslogtreecommitdiff
path: root/cipher/hash-common.h
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/hash-common.h
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/hash-common.h')
-rw-r--r--cipher/hash-common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/cipher/hash-common.h b/cipher/hash-common.h
index 0b3ade11..561e77a7 100644
--- a/cipher/hash-common.h
+++ b/cipher/hash-common.h
@@ -51,7 +51,7 @@ typedef struct gcry_md_block_ctx
MD_NBLOCKS_TYPE nblocks;
MD_NBLOCKS_TYPE nblocks_high;
int count;
- size_t blocksize;
+ unsigned int blocksize_shift;
_gcry_md_block_write_t bwrite;
} gcry_md_block_ctx_t;