summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-12 17:41:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-12 17:41:50 +0000
commitb8cc90c932c4c28117e48591bd1f0624a5a252fa (patch)
treeb3049e9b0b3cb7ec36c8b243bb1d373bd1dac4e1 /lib/libc
parentfe40154811d5f6cd40e68865b994aca922ead818 (diff)
SipHash_Final() was assuming the digest was 64-bit aligned, resulting in
misaligned memory accesses with armv7 ramdisk -Os bsd.rd ping ok florian millert
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/hash/siphash.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/hash/siphash.c b/lib/libc/hash/siphash.c
index 0f056a35811..845c8b6f5a9 100644
--- a/lib/libc/hash/siphash.c
+++ b/lib/libc/hash/siphash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siphash.c,v 1.5 2015/09/11 09:18:27 guenther Exp $ */
+/* $OpenBSD: siphash.c,v 1.6 2017/04/12 17:41:49 deraadt Exp $ */
/*-
* Copyright (c) 2013 Andre Oppermann <andre@FreeBSD.org>
@@ -113,9 +113,8 @@ SipHash_Final(void *dst, SIPHASH_CTX *ctx, int rc, int rf)
{
uint64_t r;
- r = SipHash_End(ctx, rc, rf);
-
- *(uint64_t *)dst = htole64(r);
+ r = htole64(SipHash_End(ctx, rc, rf));
+ memcpy(dst, &r, sizeof r);
}
DEF_WEAK(SipHash_Final);