From db24a2e50934010ca0638c28920645365d1b8130 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 25 Oct 2018 21:15:19 +0000 Subject: [PATCH] hash: fix hash_permutation on big endian --- src/crypto/hash.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/crypto/hash.c b/src/crypto/hash.c index 42f272e34..43ce32957 100644 --- a/src/crypto/hash.c +++ b/src/crypto/hash.c @@ -36,7 +36,14 @@ #include "keccak.h" void hash_permutation(union hash_state *state) { +#if BYTE_ORDER == LITTLE_ENDIAN keccakf((uint64_t*)state, 24); +#else + uint64_t le_state[25]; + memcpy_swap64le(le_state, state, 25); + keccakf(le_state, 24); + memcpy_swap64le(state, le_state, 25); +#endif } void hash_process(union hash_state *state, const uint8_t *buf, size_t count) {