Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 15 Dec 2016 11:04:37 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Hannes Frederic Sowa' <hannes@...essinduktion.org>, "Jason A. Donenfeld"
	<Jason@...c4.com>
CC: Netdev <netdev@...r.kernel.org>, "kernel-hardening@...ts.openwall.com"
	<kernel-hardening@...ts.openwall.com>, Jean-Philippe Aumasson
	<jeanphilippe.aumasson@...il.com>, LKML <linux-kernel@...r.kernel.org>,
	"Linux Crypto Mailing List" <linux-crypto@...r.kernel.org>, "Daniel J .
 Bernstein" <djb@...yp.to>, Linus Torvalds <torvalds@...ux-foundation.org>,
	Eric Biggers <ebiggers3@...il.com>
Subject: RE: [PATCH v2 1/4] siphash: add cryptographically secure hashtable
 function

From: Hannes Frederic Sowa
> Sent: 14 December 2016 22:03
> On 14.12.2016 13:46, Jason A. Donenfeld wrote:
> > Hi David,
> >
> > On Wed, Dec 14, 2016 at 10:56 AM, David Laight <David.Laight@...lab.com> wrote:
> >> ...
> >>> +u64 siphash24(const u8 *data, size_t len, const u8 key[SIPHASH24_KEY_LEN])
> >> ...
> >>> +     u64 k0 = get_unaligned_le64(key);
> >>> +     u64 k1 = get_unaligned_le64(key + sizeof(u64));
> >> ...
> >>> +             m = get_unaligned_le64(data);
> >>
> >> All these unaligned accesses are going to get expensive on architectures
> >> like sparc64.
> >
> > Yes, the unaligned accesses aren't pretty. Since in pretty much all
> > use cases thus far, the data can easily be made aligned, perhaps it
> > makes sense to create siphash24() and siphash24_unaligned(). Any
> > thoughts on doing something like that?
> 
> I fear that the alignment requirement will be a source of bugs on 32 bit
> machines, where you cannot even simply take a well aligned struct on a
> stack and put it into the normal siphash(aligned) function without
> adding alignment annotations everywhere. Even blocks returned from
> kmalloc on 32 bit are not aligned to 64 bit.

Are you doing anything that will require 64bit alignment on 32bit systems?
It is unlikely that the kernel can use any simd registers that have wider
alignment requirements.

You also really don't want to request on-stack items have large alignments.
While gcc can generate code to do it, it isn't pretty.

	David


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.