From: Kyle Moffett <mrmacman_g4@mac.com>
To: daw-usenet@taverner.cs.berkeley.edu (David Wagner)
Cc: linux-kernel@vger.kernel.org
Subject: Re: Entropy Pool Contents
Date: Mon, 27 Nov 2006 16:52:19 -0500 [thread overview]
Message-ID: <EB3E5F09-6529-4AB9-B7EF-DFCACC6D445E@mac.com> (raw)
In-Reply-To: <ekfifg$n41$1@taverner.cs.berkeley.edu>
On Nov 27, 2006, at 15:40:16, David Wagner wrote:
> Phillip Susi wrote:
>> David Wagner wrote:
>>> Nope, I don't think so. If they could, that would be a security
>>> hole, but /dev/{,u}random was designed to try to make this
>>> impossible, assuming the cryptographic algorithms are secure.
Actually, our current /dev/random implementation is secure even if
the cryptographic algorithms can be broken under traditional
circumstances. Essentially /dev/random will refuse to output any
more data well before enough could be revealed to predict the current
pool state, such that it is fairly secure even in the event of total
failure of the cryptographic primatives.
>>> After all, some of the entropy sources come from untrusted
>>> sources and could be manipulated by an external adversary who
>>> doesn't have any account on your machine (root or non-root), so
>>> the scheme has to be secure against introduction of maliciously
>>> chosen samples in any event.
The way the /dev/random pool works is that writes are always
guaranteed to add entropy to the pool (or at least never remove it),
even if someone runs "dd if=/dev/zero of=/dev/random". The initial
state for any given write is secure, and when hashing a random value
for which a significant part of the state has not even been
theoretically revealed with a known value, the result is still
random. Even beyond that, the random pool also hashes the current
value of the cycle-counter or time of day into the pool with each
call, adding a bit of extra entropy in any case. The same hashing of
the time of day also occurs on reads.
>> Assuming it works because it would be a bug if it didn't is a
>> logical fallacy. Either the new entropy pool is guaranteed to be
>> improved by injecting data or it isn't. If it is, then only root
>> should be allowed to inject data. If it isn't, then the entropy
>> estimate should increase when the pool is stirred.
Well, actually the entropy pool is guaranteed not to lose entropy
when it is stirred with data, but the whole point is to ensure that
no userspace program *ever* has enough knowledge of the state of the
pool to even begin a theoretical attack against past or future random
values. As a result it is perfectly OK for programs to dump whatever
data they want into the random pool as extra security for _itself_,
but the kernel does not trust it as extra security for itself. Only
root may inject guaranteed entropy and even then only using a
specific ioctl, but any program may stir up the entropy pool however
much it likes.
> I am satisfied that it is safe to feed in entropy samples from
> malicious sources, as long as you don't bump up the entropy counter
> when you do so. Doing so can't do any harm, and cannot reduce the
> entropy in the pool. However, there is no guarantee that it will
> increase the entropy. If the adversary knows what bytes you are
> feeding into the pool, then it doesn't increase the entropy count,
> and the entropy estimate should not be increased.
Exactly.
> Note that, in any event, the vast majority of applications should
> be using /dev/urandom (not /dev/random!), so in an ideal world,
> most of these issues should be pretty much irrelevant to the vast
> majority of applications. Sadly, in practice many applications
> wrongly use /dev/random when they really should be using /dev/
> urandom, either out of ignorance, or because of serious flaws in
> the /dev/random man page.
Precisely. Personally I generate my random passwords using a little
perl script reading from /dev/random (as opposed to /dev/urandom) but
that's more due to personal paranoia than any practical reason.
When generating long-term cryptographic private keys, however, you
*should* use /dev/random as it provides better guarantees about
theoretical randomness security than does /dev/urandom. Such
guarantees are useful when the random data will be used as a
fundamental cornerstone of data security for a server or network
(think your root CA certificate or HTTPS certificate for your million-
dollar-per-year web store).
Cheers,
Kyle Moffett
next prev parent reply other threads:[~2006-11-27 21:52 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 23:54 Gunter Ohrner
2006-11-22 23:59 ` Gunter Ohrner
2006-11-23 0:10 ` Jan Engelhardt
2006-11-23 21:40 ` Gunter Ohrner
2006-11-27 16:16 ` Phillip Susi
2006-11-27 16:19 ` Chris Friesen
2006-11-27 18:54 ` Phillip Susi
2006-11-27 19:33 ` David Wagner
2006-11-27 20:38 ` Phillip Susi
2006-11-27 20:40 ` David Wagner
2006-11-27 21:52 ` Kyle Moffett [this message]
2006-11-28 4:17 ` David Wagner
2006-11-28 5:19 ` Ben Pfaff
2006-11-28 12:13 ` Henrique de Moraes Holschuh
2006-11-28 12:58 ` David Wagner
2006-11-28 13:32 ` Eran Tromer
2006-11-28 13:15 ` Martin Mares
2006-11-28 17:22 ` Phillip Susi
2006-11-28 17:24 ` Martin Mares
2006-11-28 17:46 ` Phillip Susi
2006-11-28 17:49 ` Martin Mares
2006-11-28 18:40 ` Phillip Susi
2006-11-28 21:05 ` Martin Mares
2006-11-29 20:04 ` Phillip Susi
2006-11-28 17:42 ` Phillip Susi
2006-11-28 17:59 ` Martin Mares
2006-11-28 22:50 ` Eran Tromer
2006-11-27 22:21 ` Gunter Ohrner
2006-11-24 0:48 ` Theodore Tso
2006-11-24 1:01 ` Jeff Garzik
2006-11-23 20:54 ` Lennart Sorensen
2006-11-23 21:34 ` Gunter Ohrner
2006-11-23 21:04 ` Jeff Garzik
2006-11-23 21:43 ` Gunter Ohrner
2006-11-26 1:26 ` Folkert van Heusden
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=EB3E5F09-6529-4AB9-B7EF-DFCACC6D445E@mac.com \
--to=mrmacman_g4@mac.com \
--cc=daw-usenet@taverner.cs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®