From: deraadt Date: Wed, 12 Apr 2017 17:41:49 +0000 (+0000) Subject: SipHash_Final() was assuming the digest was 64-bit aligned, resulting in X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=19f78c5e992334b272aab66e813e74eaa46da711;p=openbsd 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 --- 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 @@ -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);