From: florian Date: Wed, 12 Apr 2017 18:35:50 +0000 (+0000) Subject: The kernel has to slightly different version of SipHash_Final but with X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4ed9de9b27c39777b5b514b84bf7ea382d9288ce;p=openbsd 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@ --- 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 @@ -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