diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2011-09-27 01:26:24 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-10-21 08:24:16 -0400 |
commit | ac4385d250d83fae0148607d9fb694aa6e90ab9c (patch) | |
tree | edd6dca83cdb14679353905022ef6d672c6faa91 /crypto | |
parent | 540b97c1dd9ee68112269be322d901f1edc1a282 (diff) |
crypto: whirlpool - count rounds from 0
rc[0] is unused because rounds are counted from 1.
Save an u64!
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/wp512.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/crypto/wp512.c b/crypto/wp512.c index 723427273687..71719a2be25a 100644 --- a/crypto/wp512.c +++ b/crypto/wp512.c | |||
@@ -762,11 +762,17 @@ static const u64 C7[256] = { | |||
762 | 0x86228644a411c286ULL, | 762 | 0x86228644a411c286ULL, |
763 | }; | 763 | }; |
764 | 764 | ||
765 | static const u64 rc[WHIRLPOOL_ROUNDS + 1] = { | 765 | static const u64 rc[WHIRLPOOL_ROUNDS] = { |
766 | 0x0000000000000000ULL, 0x1823c6e887b8014fULL, 0x36a6d2f5796f9152ULL, | 766 | 0x1823c6e887b8014fULL, |
767 | 0x60bc9b8ea30c7b35ULL, 0x1de0d7c22e4bfe57ULL, 0x157737e59ff04adaULL, | 767 | 0x36a6d2f5796f9152ULL, |
768 | 0x58c9290ab1a06b85ULL, 0xbd5d10f4cb3e0567ULL, 0xe427418ba77d95d8ULL, | 768 | 0x60bc9b8ea30c7b35ULL, |
769 | 0xfbee7c66dd17479eULL, 0xca2dbf07ad5a8333ULL, | 769 | 0x1de0d7c22e4bfe57ULL, |
770 | 0x157737e59ff04adaULL, | ||
771 | 0x58c9290ab1a06b85ULL, | ||
772 | 0xbd5d10f4cb3e0567ULL, | ||
773 | 0xe427418ba77d95d8ULL, | ||
774 | 0xfbee7c66dd17479eULL, | ||
775 | 0xca2dbf07ad5a8333ULL, | ||
770 | }; | 776 | }; |
771 | 777 | ||
772 | /** | 778 | /** |
@@ -793,7 +799,7 @@ static void wp512_process_buffer(struct wp512_ctx *wctx) { | |||
793 | state[6] = block[6] ^ (K[6] = wctx->hash[6]); | 799 | state[6] = block[6] ^ (K[6] = wctx->hash[6]); |
794 | state[7] = block[7] ^ (K[7] = wctx->hash[7]); | 800 | state[7] = block[7] ^ (K[7] = wctx->hash[7]); |
795 | 801 | ||
796 | for (r = 1; r <= WHIRLPOOL_ROUNDS; r++) { | 802 | for (r = 0; r < WHIRLPOOL_ROUNDS; r++) { |
797 | 803 | ||
798 | L[0] = C0[(int)(K[0] >> 56) ] ^ | 804 | L[0] = C0[(int)(K[0] >> 56) ] ^ |
799 | C1[(int)(K[7] >> 48) & 0xff] ^ | 805 | C1[(int)(K[7] >> 48) & 0xff] ^ |