aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-11-14 21:34:09 +0200
committerRiccardo Spagni <ric@spagni.net>2018-11-14 21:34:09 +0200
commit92c5a892b51929150727a2fa73443fe716d5d5a7 (patch)
tree449dfe6ffda4b7e1d2b80a3b9cafe8a8d1eba416 /src/crypto
parentMerge pull request #4756 (diff)
parenthash: fix hash_permutation on big endian (diff)
downloadmonero-92c5a892b51929150727a2fa73443fe716d5d5a7.tar.xz
Merge pull request #4757
db24a2e5 hash: fix hash_permutation on big endian (moneromooo-monero)
Diffstat (limited to 'src/crypto')
-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) {