Date: Thu, 15 Dec 2016 00:29:55 +0100 From: "Jason A. Donenfeld" <Jason@...c4.com> To: Hannes Frederic Sowa <hannes@...essinduktion.org> Cc: David Laight <David.Laight@...lab.com>, Netdev <netdev@...r.kernel.org>, 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 Hi Hannes, On Wed, Dec 14, 2016 at 11:03 PM, Hannes Frederic Sowa <hannes@...essinduktion.org> wrote: > 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. That's what the "__aligned(SIPHASH24_ALIGNMENT)" attribute is for. The aligned siphash function will be for structs explicitly made for siphash consumption. For everything else there's siphash_unaligned. > Can we do this a runtime check and just have one function (siphash) > dealing with that? Seems like the runtime branching on the aligned function would be bad for performance, when we likely know at compile time if it's going to be aligned or not. I suppose we could add that check just to the unaligned version, and rename it to "maybe_unaligned"? Is this what you have in mind? Jason
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.