Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9pyXhcqCDQXDS03tCfz_8AXWb-99KM-LFyeLHTO1+eqfg@mail.gmail.com>
Date: Wed, 14 Dec 2016 18:58:47 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: kernel-hardening@...ts.openwall.com, "Theodore Ts'o" <tytso@....edu>, 
	"Jason A. Donenfeld" <Jason@...c4.com>, Netdev <netdev@...r.kernel.org>, 
	David Miller <davem@...emloft.net>, Linus Torvalds <torvalds@...ux-foundation.org>, 
	LKML <linux-kernel@...r.kernel.org>, George Spelvin <linux@...izon.com>, 
	Scott Bauer <sbauer@....utah.edu>, Andi Kleen <ak@...ux.intel.com>, 
	Andy Lutomirski <luto@...capital.net>, Greg KH <gregkh@...uxfoundation.org>, 
	Eric Biggers <ebiggers3@...il.com>, 
	Linux Crypto Mailing List <linux-crypto@...r.kernel.org>, 
	Jean-Philippe Aumasson <jeanphilippe.aumasson@...il.com>
Subject: Re: Re: [PATCH 4/3] random: use siphash24 instead
 of md5 for get_random_int/long

Hey Ted,

On Wed, Dec 14, 2016 at 5:37 PM, Theodore Ts'o <tytso@....edu> wrote:
> One somewhat undesirable aspect of the current algorithm is that we
> never change random_int_secret.

Why exactly would this be a problem? So long as the secret is kept
secret, the PRF is secure. If an attacker can read arbitrary kernel
memory, there are much much bigger issues to be concerned about. As
well, the "chaining" variable I introduce ensures that the random
numbers are, per-cpu, related to the uniqueness of timing of
subsequent calls.

> So I've been toying with the
> following, which is 4 times faster than md5.  (I haven't tried
> benchmarking against siphash yet.)
>
> [    3.606139] random benchmark!!
> [    3.606276] get_random_int # cycles: 326578
> [    3.606317] get_random_int_new # cycles: 95438
> [    3.607423] get_random_bytes # cycles: 2653388

Cool, I'll benchmark it against the siphash implementation. I like
what you did with batching up lots of chacha output, and doling it out
bit by bit. I suspect this will be quite fast, because with chacha20
you get an entire block.

> P.S.  It's interesting to note that siphash24 and chacha20 are both
> add-rotate-xor based algorithms.

Quite! Lots of nice shiny things are turning out be be ARX -- ChaCha,
BLAKE2, Siphash, NORX. The simplicity is really appealing.

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.