Merge pull request #4757

db24a2e5 hash: fix hash_permutation on big endian (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-11-14 21:34:09 +02:00
commit 92c5a892b5
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -36,7 +36,14 @@
#include "keccak.h" #include "keccak.h"
void hash_permutation(union hash_state *state) { void hash_permutation(union hash_state *state) {
#if BYTE_ORDER == LITTLE_ENDIAN
keccakf((uint64_t*)state, 24); 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) { void hash_process(union hash_state *state, const uint8_t *buf, size_t count) {