Use unaligned_read_le64() to access input buffer when reading complete
64-bit words.
This should fix memory traps on platforms with strict aliasing.
#include "sparse-endian.h"
#include "siphash24.h"
#include "sparse-endian.h"
#include "siphash24.h"
#include "util.h"
static inline uint64_t rotate_left(uint64_t x, uint8_t b) {
#include "util.h"
static inline uint64_t rotate_left(uint64_t x, uint8_t b) {
end -= ( state->inlen % sizeof (uint64_t) );
for ( ; in < end; in += 8 ) {
end -= ( state->inlen % sizeof (uint64_t) );
for ( ; in < end; in += 8 ) {
- m = le64toh(*(le64_t*) in);
+ m = unaligned_read_le64(in);
#ifdef DEBUG
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
#ifdef DEBUG
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);