summaryrefslogtreecommitdiff
path: root/p/haskell-cryptonite/debian/patches/crypto-buffer-alignment.patch
blob: c7695f5b9a15f68cd33dad8635c1cc2bb7ad5a98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: actually use the aligned buffer when required
 Upstream implemented a fix for issue 108, but didn't actually use the
 aligned buffer in place of the unaligned data.  This worked fine everywhere
 except our armhf buildds, since other archs don't actually raise SIGBUS on
 unaligned access.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Upstream: https://github.com/haskell-crypto/cryptonite/issues/108
Bug-Debian: https://bugs.debian.org/841983
Forwarded-Upstream: yes

--- a/cbits/cryptonite_sha3.c
+++ b/cbits/cryptonite_sha3.c
@@ -135,8 +135,8 @@ void cryptonite_sha3_update(struct sha3_
 		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 */