From: "Theodore Ts'o" <tytso@mit.edu>
To: George Spelvin <linux@horizon.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Replace /dev/random input mix polynomial with Brent's xorgen?
Date: Sat, 14 Dec 2013 14:23:07 -0500 [thread overview]
Message-ID: <20131214192307.GA10457@thunk.org> (raw)
In-Reply-To: <20131214090607.30797.qmail@science.horizon.com>
On Sat, Dec 14, 2013 at 04:06:07AM -0500, George Spelvin wrote:
> Richard Brent extended some efficient XOR-based PRNGs designed by George
> Marsaglia into a family of "xorgen" generators which are efficent,
> non-sparse, maximal-period polynomials of length 64, 128, 256,... 4096
> bits.
>
> Anyway, the algorithm boils down to
>
> t1 = x[i-r]; t2 = x[i-s];
> t1 ^= t1 << a; t2 ^= t2 << c;
> t1 ^= t1 >> b; t2 ^= t2 >> d;
> x[i] = t1 ^ t2;
>
> For various constants r = 2..128, s < r, and shifts a, b, c and d.
> Both 32- and 64-bit versions are included.
The mixing function doesn't have to be a good quality PRNG, since
that's not its function. One of the things that is highly desirable,
though, is that it "smears" recently mixed in data across the entire
pool as quickly as possible. The above algorithm is more efficient
because it only needs to touch two memory locations --- but for our
use case, we want to be able to read from multiple memory locations.
In particular, it's important that when we mix the hash back into pool
to prevent backtracking attacks, and extract from the pool again and
re-hash (see extract_entropy), it's important that when we mix in the
hash, it affects the portion of the pool that we rehash. We could
work around this if we changed the mixing function, true, but I'm not
sure I see the benefit of making this change.
I'm much more inclined to think about changing how we generate random
numbers from the output pool by switching from using SHA to AES in
some one-way random function mode (i.e., such as the Davies-Meyer
construction), since that is where we are spending most of our CPU
time in the random driver at the moment.
Regards,
- Ted
next prev parent reply other threads:[~2013-12-14 19:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-14 9:06 Replace /dev/random input mix polynomial with Brent's xorgen? George Spelvin
2013-12-14 19:23 ` Theodore Ts'o [this message]
2013-12-14 21:55 ` George Spelvin
2013-12-15 2:21 ` Theodore Ts'o
2013-12-15 8:34 ` George Spelvin
2013-12-15 22:19 ` Theodore Ts'o
2013-12-16 4:22 ` George Spelvin
2013-12-16 6:43 ` Theodore Ts'o
2013-12-16 6:49 ` Theodore Ts'o
2013-12-16 15:03 ` George Spelvin
2013-12-15 20:03 ` Greg Price
2013-12-15 22:09 ` George Spelvin
2013-12-16 0:32 ` Greg Price
2013-12-16 6:53 ` George Spelvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131214192307.GA10457@thunk.org \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox