diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2015-08-12 18:17:01 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2015-08-12 18:17:01 +0300 |
commit | 48822ae0b436bcea0fe92dbf0d88475ba3179320 (patch) | |
tree | 3875fd589398f69b812077283cfcdda353520366 /cipher/keccak.c | |
parent | 24ebf53f1e8a8afa27dcd768339bda70a740bb03 (diff) | |
download | libgcrypt-48822ae0b436bcea0fe92dbf0d88475ba3179320.tar.gz |
Keccak: Fix array indexes in θ step
* cipher/keccak.c (keccak_f1600_state_permute): Fix indexes for D[5].
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/keccak.c')
-rw-r--r-- | cipher/keccak.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/cipher/keccak.c b/cipher/keccak.c index 4ca8dbde..4a9c1f27 100644 --- a/cipher/keccak.c +++ b/cipher/keccak.c @@ -100,8 +100,8 @@ static unsigned int keccak_f1600_state_permute(KECCAK_STATE *hd) D[0] = C[4] ^ rol64(C[1], 1); D[1] = C[0] ^ rol64(C[2], 1); D[2] = C[1] ^ rol64(C[3], 1); - D[4] = C[2] ^ rol64(C[4], 1); - D[5] = C[3] ^ rol64(C[0], 1); + D[3] = C[2] ^ rol64(C[4], 1); + D[4] = C[3] ^ rol64(C[0], 1); /* Add the θ effect to the whole column */ hd->state[0][0] ^= D[0]; @@ -125,18 +125,18 @@ static unsigned int keccak_f1600_state_permute(KECCAK_STATE *hd) hd->state[4][2] ^= D[2]; /* Add the θ effect to the whole column */ - hd->state[0][3] ^= D[4]; - hd->state[1][3] ^= D[4]; - hd->state[2][3] ^= D[4]; - hd->state[3][3] ^= D[4]; - hd->state[4][3] ^= D[4]; + hd->state[0][3] ^= D[3]; + hd->state[1][3] ^= D[3]; + hd->state[2][3] ^= D[3]; + hd->state[3][3] ^= D[3]; + hd->state[4][3] ^= D[3]; /* Add the θ effect to the whole column */ - hd->state[0][4] ^= D[5]; - hd->state[1][4] ^= D[5]; - hd->state[2][4] ^= D[5]; - hd->state[3][4] ^= D[5]; - hd->state[4][4] ^= D[5]; + hd->state[0][4] ^= D[4]; + hd->state[1][4] ^= D[4]; + hd->state[2][4] ^= D[4]; + hd->state[3][4] ^= D[4]; + hd->state[4][4] ^= D[4]; } { |