summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2017-04-12 18:35:50 +0000
committerflorian <florian@openbsd.org>2017-04-12 18:35:50 +0000
commit4ed9de9b27c39777b5b514b84bf7ea382d9288ce (patch)
treed64ae2ee0135de1e885b907a1c3187a80a0ddd2e /sys
parentUse calloc(3) and recallocarray(3) instead of *alloc* + memset(0). (diff)
downloadwireguard-openbsd-4ed9de9b27c39777b5b514b84bf7ea382d9288ce.tar.xz
wireguard-openbsd-4ed9de9b27c39777b5b514b84bf7ea382d9288ce.zip
The kernel has to slightly different version of SipHash_Final but with
the same bug as just fixed in userland: ---------- 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 ---------- OK deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/crypto/siphash.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/crypto/siphash.c b/sys/crypto/siphash.c
index 478543096a0..1b3df7e3f1d 100644
--- a/sys/crypto/siphash.c
+++ b/sys/crypto/siphash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siphash.c,v 1.3 2015/02/20 11:51:03 tedu Exp $ */
+/* $OpenBSD: siphash.c,v 1.4 2017/04/12 18:35:50 florian Exp $ */
/*-
* Copyright (c) 2013 Andre Oppermann <andre@FreeBSD.org>
@@ -110,9 +110,8 @@ SipHash_Final(void *dst, SIPHASH_CTX *ctx, int rc, int rf)
{
uint64_t r;
- r = SipHash_End(ctx, rc, rf);
-
- htolem64((uint64_t *)dst, r);
+ htolem64(&r, SipHash_End(ctx, rc, rf));
+ memcpy(dst, &r, sizeof r);
}
uint64_t