aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/hash.c
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-25 21:15:19 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-29 22:26:44 +0000
commitdb24a2e50934010ca0638c28920645365d1b8130 (patch)
treed2ecae298703928d0f05b52bfc71d09db397af1f /src/crypto/hash.c
parentMerge pull request #4721 (diff)
downloadmonero-db24a2e50934010ca0638c28920645365d1b8130.tar.xz
hash: fix hash_permutation on big endian
Diffstat (limited to 'src/crypto/hash.c')
-rw-r--r--src/crypto/hash.c7
1 files changed, 7 insertions, 0 deletions
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) {