aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-07-12 20:23:08 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-07-12 20:23:08 -0500
commite4e8954c040ebcf9f87232bbe98f5537adbac1ae (patch)
tree74ac913ac130d50c91735dad8ed4ab9073a1064f /src
parentMerge pull request #5704 (diff)
parentkeccak: guard against misaligned memory accesses on ARM (diff)
downloadmonero-e4e8954c040ebcf9f87232bbe98f5537adbac1ae.tar.xz
Merge pull request #5724
c223832 keccak: guard against misaligned memory accesses on ARM (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/crypto/keccak.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c
index 18ed3152f..851c70a25 100644
--- a/src/crypto/keccak.c
+++ b/src/crypto/keccak.c
@@ -105,9 +105,12 @@ void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen)
memset(st, 0, sizeof(st));
for ( ; inlen >= rsiz; inlen -= rsiz, in += rsiz) {
- for (i = 0; i < rsizw; i++)
- st[i] ^= swap64le(((uint64_t *) in)[i]);
- keccakf(st, KECCAK_ROUNDS);
+ for (i = 0; i < rsizw; i++) {
+ uint64_t ina;
+ memcpy(&ina, in + i * 8, 8);
+ st[i] ^= swap64le(ina);
+ }
+ keccakf(st, KECCAK_ROUNDS);
}
// last block and padding