From e87e9156020746cdd30978366c0ea01463e3bdac Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Wed, 12 Apr 2017 17:41:49 +0000 Subject: [PATCH] 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 --- src/lib/libc/hash/siphash.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/libc/hash/siphash.c b/src/lib/libc/hash/siphash.c index 0f056a35..845c8b6f 100644 --- a/src/lib/libc/hash/siphash.c +++ b/src/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);