From 7f0f5bd3fad5caf220460fb181aaaf884e529821 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 23 Jun 2017 21:46:43 -0700 Subject: [PATCH] Actually process unaligned data through trampoline buffer Follow-on to commit ba10930, which implemented a trampoline buffer but then used the unaligned input character array instead. This commit /actually/ fixes #108, having been tested on an affected architecture :) --- cbits/cryptonite_sha3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cbits/cryptonite_sha3.c b/cbits/cryptonite_sha3.c index 8982ea8..02278e2 100644 --- a/cbits/cryptonite_sha3.c +++ b/cbits/cryptonite_sha3.c @@ -135,8 +135,8 @@ void cryptonite_sha3_update(struct sha3_ctx *ctx, const uint8_t *data, uint32_t uint64_t tramp[SHA3_BUF_SIZE_MAX/8]; ASSERT_ALIGNMENT(tramp, 8); for (; len >= ctx->bufsz; len -= ctx->bufsz, data += ctx->bufsz) { - memcpy(tramp, data, ctx->bufsz / 8); - sha3_do_chunk(ctx->state, (uint64_t *) data, ctx->bufsz / 8); + memcpy(tramp, data, ctx->bufsz); + sha3_do_chunk(ctx->state, tramp, ctx->bufsz / 8); } } else { /* process as much ctx->bufsz-block */