From: Oliver Xymoron <oxymoron@waste.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] (0/4) Entropy accounting fixes
Date: Sun, 18 Aug 2002 12:31:40 -0500 [thread overview]
Message-ID: <20020818173140.GU21643@waste.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0208180916560.10546-100000@home.transmeta.com>
On Sun, Aug 18, 2002 at 09:59:41AM -0700, Linus Torvalds wrote:
>
> On Sun, 18 Aug 2002, Oliver Xymoron wrote:
> >
> > The key word is actually conservative, as in conservative estimate.
> > Conservative here means less than or equal to.
>
> Your argument is that even with a gigahz logic analyzer on the network
> line, you should certainly see randomness that is worth considering.
>
> I dare you to actually show perfect correlation from it: the interrupt may
> be synchronized to the PCI clock, but the code executed there-after
> certainly will not. And even if the machine is 100% idle, and the whole
> working set fits in the L1 cache, the DMA generated by the packet itself
> will result in cache invalidations.
>
> In other words, in order for you to actually be able to predict the TSC
> from the outside, you'd have to not just have the gigahz logic analyzer on
> the network line, you' dalso have to be able to correlate the ethernet
> heartbeat to the PCI clock (which you probably could do by looking at the
> timing of the reply packets from a ping flood, although it would be
> "interestng" to say the least and probably depends on how the network card
> generates the ethernet clock), _and_ you'd have to be able to do a cache
> eviction analysis (which in turn requires knowing the initial memory
> layout for the kernel data structures for networking).
Yes, obviously 'nontrivial'. But then so are sideband attacks on smart
cards.
> And your argument that there is zero randomness in the TSC _depends_ on
> your ability to perfectly estimate what the TSC is. If you cannot do it,
> there is obviously at least one bit of randomness there. So I don't think
> your "zero" is a good conservative estimate.
Have you seen my compromise patch yet? I think this (or something like
it) should make us both happy.
diff -ur a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c 2002-08-17 20:54:02.000000000 -0500
+++ b/drivers/char/random.c 2002-08-18 01:38:58.000000000 -0500
@@ -724,6 +724,7 @@
*/
static int benford[16]={0,0,0,1,2,3,4,5,5,6,7,7,8,9,9,10};
static int last_ctxt=0;
+static int trust_break=50, trust_pct=0, trust_min=0, trust_max=100;
void add_timing_entropy(void *src, unsigned datum)
{
@@ -764,6 +765,18 @@
delta>>=es->shift;
bits=benford[int_log2_16bits(delta & 0xffff)];
}
+
+ /* Throw in an untrusted bit as entropy trust_pct% of the time */
+ if(trust_pct && !bits)
+ {
+ trust_break+=trust_pct;
+ if(trust_break>=100)
+ {
+ bits=1;
+ trust_break-=100;
+ }
+ }
+
batch_entropy_store(datum^time, bits);
}
@@ -1779,6 +1792,10 @@
{RANDOM_UUID, "uuid",
NULL, 16, 0444, NULL,
&proc_do_uuid, &uuid_strategy},
+ {RANDOM_TRUST_PCT, "trust_pct",
+ &trust_pct, sizeof(int), 0644, NULL,
+ &proc_dointvec_minmax, &sysctl_intvec, 0,
+ &trust_min, &trust_max},
{0}
};
diff -ur a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h 2002-08-17 00:30:00.000000000 -0500
+++ b/include/linux/sysctl.h 2002-08-18 01:37:54.000000000 -0500
@@ -182,7 +182,8 @@
RANDOM_READ_THRESH=3,
RANDOM_WRITE_THRESH=4,
RANDOM_BOOT_ID=5,
- RANDOM_UUID=6
+ RANDOM_UUID=6,
+ RANDOM_TRUST_PCT=7
};
/* /proc/sys/bus/isa */
>
> [ Side note: the most common source of pseudo-random numbers is the old
> linear congruental generator, which really is a sampling of a "beat"
> between two frequencies that are supposed to be "close", but prime.
>
> That's a fairly simple and accepted pseudo-random generator _despite_
> the fact that the two frequencies are totally known, and there is zero
> noise inserted. I'll bet you'll see a _very_ hard-to-predict stream from
> something like the PCI clock / CPU clock thing, with noise inserted
> thanks to things like cache misses and shared bus interactions. Never
> mind the _real_ noise of having a work-load. ]
In practically all modern machines, the CPU clock is driven off the
same source as the PCI clock, the northbus clock, and every other
clock used in the core.
> > No, it says /dev/random is primarily useful for generating large
> > (>>160 bit) keys.
>
> Which is exactly what something like sshd would want to use for generating
> keys for the machine, right? That is _the_ primary reason to use
> /dev/random.
Sshd doesn't generate large keys, ssh-keygen does.
--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."
next prev parent reply other threads:[~2002-08-18 17:27 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-18 2:15 [PATCH] (0/4) Entropy accounting fixes Oliver Xymoron
2002-08-18 2:23 ` [PATCH] (1/4) " Oliver Xymoron
2002-08-18 2:26 ` [PATCH] (2/4) Update input drivers Oliver Xymoron
2002-08-18 2:29 ` [PATCH] (3/4) SA_RANDOM user fixup Oliver Xymoron
2002-08-18 2:32 ` [PATCH] (4/4) entropy batching update Oliver Xymoron
2002-08-18 2:30 ` [PATCH] (0/4) Entropy accounting fixes Linus Torvalds
2002-08-18 2:59 ` Oliver Xymoron
2002-08-18 3:08 ` Linus Torvalds
2002-08-18 3:25 ` Linus Torvalds
2002-08-18 4:42 ` Oliver Xymoron
2002-08-18 4:53 ` Linus Torvalds
2002-08-18 5:05 ` Dmitri
2002-08-18 6:18 ` Oliver Xymoron
2002-08-22 3:33 ` David Wagner
2002-08-18 10:30 ` Alan Cox
2002-08-18 15:08 ` Oliver Xymoron
2002-08-18 17:31 ` Jonathan Lundell
2002-08-22 3:27 ` David Wagner
2002-08-18 4:30 ` Oliver Xymoron
2002-08-21 8:44 ` Rogier Wolff
2002-08-21 12:47 ` Oliver Xymoron
2002-08-18 5:28 ` Andreas Dilger
2002-08-18 5:53 ` Oliver Xymoron
2002-08-22 3:25 ` David Wagner
2002-08-18 3:05 ` Linus Torvalds
2002-08-18 3:51 ` Robert Love
2002-08-18 4:01 ` Linus Torvalds
2002-08-18 5:38 ` Oliver Xymoron
2002-08-19 4:21 ` Theodore Ts'o
2002-08-19 10:15 ` Marco Colombo
2002-08-19 10:25 ` Oliver Neukum
2002-08-19 11:03 ` Marco Colombo
2002-08-19 14:22 ` Oliver Neukum
2002-08-19 15:21 ` Marco Colombo
2002-08-19 16:29 ` Oliver Neukum
2002-08-19 12:39 ` Oliver Xymoron
2002-08-18 6:31 ` Robert Love
2002-08-18 6:48 ` Oliver Xymoron
2002-08-18 4:06 ` dean gaudet
2002-08-18 4:44 ` Oliver Xymoron
2002-08-18 7:31 ` Bernd Eckenfels
2002-08-18 9:48 ` Ralf Baechle
2002-08-20 12:51 ` Bernd Eckenfels
2002-08-18 16:58 ` Robert Love
2002-08-18 10:25 ` Alan Cox
2002-08-19 10:47 ` Marco Colombo
2002-08-19 12:29 ` Alan Cox
2002-08-19 12:56 ` Marco Colombo
2002-09-08 3:43 ` D. Hugh Redelmeier
2002-09-08 18:03 ` David Wagner
2002-09-09 16:53 ` Oliver Xymoron
2002-09-09 16:58 ` David Wagner
2002-09-09 19:47 ` Oliver Xymoron
2002-09-09 23:22 ` David Wagner
2002-09-16 22:51 ` dean gaudet
2002-09-17 1:18 ` Oliver Xymoron
2002-09-09 18:54 ` Kent Borg
2002-09-09 19:57 ` Oliver Xymoron
2002-09-09 20:11 ` Kent Borg
2002-08-18 4:57 ` Oliver Xymoron
2002-08-18 4:28 ` Oliver Xymoron
2002-08-18 4:51 ` Linus Torvalds
2002-08-18 5:24 ` Oliver Xymoron
2002-08-18 16:59 ` Linus Torvalds
2001-11-02 10:34 ` Pavel Machek
2002-08-23 20:16 ` Linus Torvalds
2002-08-18 17:03 ` Robert Love
2002-08-18 17:31 ` Oliver Xymoron [this message]
2002-08-18 16:54 ` Robert Love
2002-08-18 17:18 ` Oliver Xymoron
2002-08-18 17:20 ` Robert Love
2002-08-19 5:43 ` Theodore Ts'o
2001-11-02 10:05 ` Pavel Machek
2002-08-19 6:06 ` *Challenge* Finding a solution (When kernel boots it does not display any system info) louie miranda
2002-08-19 7:30 ` Gilad Ben-Yossef
2002-08-19 7:30 ` Ryan Cumming
2002-08-20 0:55 ` louie miranda
2002-08-19 13:52 ` [PATCH] (0/4) Entropy accounting fixes Oliver Xymoron
2002-08-20 8:59 ` Tommi Kyntola
2002-08-20 13:21 ` Oliver Xymoron
2002-08-20 16:19 ` Tommi Kyntola
2002-08-20 17:22 ` Oliver Xymoron
2002-09-08 3:51 ` D. Hugh Redelmeier
2002-09-08 4:31 ` Oliver Xymoron
-- strict thread matches above, loose matches on Subject: below --
2002-08-18 4:57 David Brownell
2002-08-18 6:02 ` Oliver Xymoron
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=20020818173140.GU21643@waste.org \
--to=oxymoron@waste.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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