From: Niels Möller Date: Thu, 15 Nov 2012 16:18:03 +0000 (+0100) Subject: Fixes for big-endian sha3 code. X-Git-Tag: nettle_2.6_release_20130116~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=894e849ba25384d14e64dd96d5065f113d99de47;p=thirdparty%2Fnettle.git Fixes for big-endian sha3 code. --- diff --git a/ChangeLog b/ChangeLog index d2c8e6d1..ca63f91b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2012-11-15 Niels Möller + * sha3.c (sha3_absorb): Fixed big-endian code. Need macros.h. + * macros.h (LE_READ_UINT64): New macro. 2012-11-13 Niels Möller diff --git a/sha3.c b/sha3.c index a878e3bc..d7aec46e 100644 --- a/sha3.c +++ b/sha3.c @@ -32,6 +32,7 @@ #include "sha3.h" +#include "macros.h" #include "memxor.h" static void @@ -41,7 +42,7 @@ sha3_absorb (struct sha3_state *state, unsigned length, const uint8_t *data) #if WORDS_BIGENDIAN { uint64_t *p; - for (p = &state->a[0][0]; length > 0; p++, length -= 8, data += 8) + for (p = state->a; length > 0; p++, length -= 8, data += 8) *p ^= LE_READ_UINT64 (data); } #else /* !WORDS_BIGENDIAN */