From d6190507ac2b71e6de9e3929b63ecb83a00650f5 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 20 Jul 2017 16:53:36 +1000 Subject: [PATCH] Big endian fix for SHA-3 --- wolfcrypt/src/sha3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/sha3.c b/wolfcrypt/src/sha3.c index de203660d..a217531e9 100755 --- a/wolfcrypt/src/sha3.c +++ b/wolfcrypt/src/sha3.c @@ -485,11 +485,11 @@ static int Sha3Final(Sha3* sha3, byte* hash, byte p, byte l) for (i = 0; i < p; i++) sha3->s[i] ^= Load64BitBigEndian(sha3->t + 8 * i); BlockSha3(sha3->s); +#if defined(BIG_ENDIAN_ORDER) + ByteReverseWords64(sha3->s, sha3->s, ((l+7)/8)*8); +#endif for (i = 0; i < l; i++) hash[i] = s8[i]; -#if defined(BIG_ENDIAN_ORDER) - ByteReverseWords64((word64*)hash, (word64*)hash, l); -#endif return 0; }