mirror of
https://github.com/monero-project/monero.git
synced 2025-06-20 16:24:10 -04:00
keccak: guard against misaligned memory accesses on ARM
The code generated is exactly the same as the direct access one on x86_64
This commit is contained in:
parent
6335509727
commit
c2238327d0
2 changed files with 23 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue