diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-12-17 15:35:38 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-12-17 15:35:38 +0200 |
commit | 50b8c8342d023038a4b528af83153293dd2756ea (patch) | |
tree | 603423305ea81754f728c85814d0dc908e6e96d6 /cipher/whirlpool.c | |
parent | 210b7237706f6ad5cbc1a3362707f63db2c8a780 (diff) | |
download | libgcrypt-50b8c8342d023038a4b528af83153293dd2756ea.tar.gz |
Add bulk processing for hash transform functions
* cipher/hash-common.c (_gcry_md_block_write): Preload 'hd->blocksize'
to stack, pass number of blocks to 'hd->bwrite'.
* cipher/hash-common.c (_gcry_md_block_write_t): Add 'nblks'.
* cipher/gostr3411-94.c: Rename 'transform' function to
'transform_blk', add new 'transform' function with 'nblks' as
additional input.
* cipher/md4.c: Ditto.
* cipher/md5.c: Ditto.
* cipher/md4.c: Ditto.
* cipher/rmd160.c: Ditto.
* cipher/sha1.c: Ditto.
* cipher/sha256.c: Ditto.
* cipher/sha512.c: Ditto.
* cipher/stribog.c: Ditto.
* cipher/tiger.c: Ditto.
* cipher/whirlpool.c: Ditto.
--
Pass number of blocks to algorithm for futher optimizations.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/whirlpool.c')
-rw-r--r-- | cipher/whirlpool.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cipher/whirlpool.c b/cipher/whirlpool.c index e562781d..57ca8826 100644 --- a/cipher/whirlpool.c +++ b/cipher/whirlpool.c @@ -1161,7 +1161,7 @@ static const u64 C7[256] = static unsigned int -whirlpool_transform (void *ctx, const unsigned char *data); +whirlpool_transform (void *ctx, const unsigned char *data, size_t nblks); @@ -1181,7 +1181,7 @@ whirlpool_init (void *ctx) * Transform block. */ static unsigned int -whirlpool_transform (void *ctx, const unsigned char *data) +whirlpool_transform_blk (void *ctx, const unsigned char *data) { whirlpool_context_t *context = ctx; whirlpool_block_t data_block; @@ -1280,6 +1280,21 @@ whirlpool_transform (void *ctx, const unsigned char *data) 4 * sizeof(void*); } +static unsigned int +whirlpool_transform ( void *c, const unsigned char *data, size_t nblks ) +{ + unsigned int burn; + + do + { + burn = whirlpool_transform_blk (c, data); + data += BLOCK_SIZE; + } + while (--nblks); + + return burn; +} + static void whirlpool_write (void *ctx, const void *buffer, size_t buffer_n) { |