diff options
author | Jeff Garzik <jeff@garzik.org> | 2012-10-03 03:09:56 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-10-03 03:09:56 -0400 |
commit | 0abc9ee3957475703f08884e1f83876efbb54394 (patch) | |
tree | 00b349cf736374bcab6509c73253dfbcaffa504d | |
parent | e52113b7b4ace50ab586b426098c6d69d75c263a (diff) | |
download | linux-sha3.tar.gz |
[CRYPTO] sha3: do not pass static parameter to keccakf()sha3
Also, trim trailing whitespace.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | crypto/sha3_generic.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/crypto/sha3_generic.c b/crypto/sha3_generic.c index 9255ea14fd1368..a51e2111556bd6 100644 --- a/crypto/sha3_generic.c +++ b/crypto/sha3_generic.c @@ -10,41 +10,41 @@ #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) -static const u64 keccakf_rndc[24] = +static const u64 keccakf_rndc[24] = { 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, 0x8000000080008081, 0x8000000000008009, 0x000000000000008a, 0x0000000000000088, 0x0000000080008009, 0x000000008000000a, 0x000000008000808b, 0x800000000000008b, 0x8000000000008089, - 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, + 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, 0x000000000000800a, 0x800000008000000a, 0x8000000080008081, 0x8000000000008080, 0x0000000080000001, 0x8000000080008008 }; -static const int keccakf_rotc[24] = +static const int keccakf_rotc[24] = { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, + 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 }; -static const int keccakf_piln[24] = +static const int keccakf_piln[24] = { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 + 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, + 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 }; // update the state with given number of rounds -static void keccakf(u64 st[25], int rounds) +static void keccakf(u64 st[25]) { int i, j, round; u64 t, bc[5]; - for (round = 0; round < rounds; round++) { + for (round = 0; round < KECCAK_ROUNDS; round++) { // Theta - for (i = 0; i < 5; i++) + for (i = 0; i < 5; i++) bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; for (i = 0; i < 5; i++) { @@ -134,7 +134,7 @@ static int sha3_update(struct shash_desc *desc, const u8 *data, for (i = 0; i < sctx->rsizw; i++) sctx->st[i] ^= ((u64 *) src)[i]; - keccakf(sctx->st, KECCAK_ROUNDS); + keccakf(sctx->st); done += sctx->rsiz; src = data + done; @@ -160,7 +160,7 @@ static int sha3_final(struct shash_desc *desc, u8 *out) for (i = 0; i < sctx->rsizw; i++) sctx->st[i] ^= ((u64 *) sctx->buf)[i]; - keccakf(sctx->st, KECCAK_ROUNDS); + keccakf(sctx->st); for (i = 0; i < sctx->rsizw; i++) sctx->st[i] = cpu_to_le64(sctx->st[i]); |