All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@logfs.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Stephan Mueller <smueller@chronox.de>,
	"Theodore Ts'o" <tytso@mit.edu>,
	LKML <linux-kernel@vger.kernel.org>,
	dave.taht@bufferbloat.net
Subject: Re: [PATCH] /dev/random: Insufficient of entropy on many architectures
Date: Thu, 12 Sep 2013 17:18:44 -0400	[thread overview]
Message-ID: <20130912211844.GD3809@logfs.org> (raw)
In-Reply-To: <CAMuHMdX5-kSWVJ_QFXY+L2L6iY0Zo7GAL5uF-uPGJAXM=wZxgw@mail.gmail.com>

On Thu, 12 September 2013 14:15:35 +0200, Geert Uytterhoeven wrote:
> On Thu, Sep 12, 2013 at 2:08 PM, Stephan Mueller <smueller@chronox.de> wrote:
> >>BTW, I prefer a different name than "random_get_fast_cycles()", as it's
> >>better to have something that returns different and unpredictable
> >>numbers than an actual monotonic cycle counter.
> >
> > A monotonic counter is fully ok. Note, for /dev/random, the occurrence
> > of events delivers entropy. Thus, we have to be able to precisely
> > measure that occurrence. The timer itself does not need to deliver any
> > entropy as long as it is fast.
> 
> Well, in my specific case (m68k/Amiga) I can use:
>   - a 24-bit counter running at only ca. 15 or 31 kHz (actual
> frequency may vary),
>   - a 16-bit counter running at ca. 700 kHz.

Assuming the same cost, please use the 700kHz counter.  Or both.

Jiffies is a relatively poor choice, as it can be predicted with high
certainty.  Most of the time it will be identical to the last value
for jiffies, most of the remaining time it will be off by exactly one.
So on average you don't even get a single unpredictable bit from
jiffies.

A counter that is fast when compared to interrupt rate will give you
relatively many useful bits.  A slow counter - no matter how wide -
will have little useful randomness.  Ideal is a counter that cannot be
externally derived even with the most expensive measurement kit.  So
an unstable clock is actually a bonus.  Think high precision and low
realiability.

And if you have to drop bits from the counter, please drop the high
bits, as they are the easily predictable ones.

Jörn

--
I can say that I spend most of my time fixing bugs even if I have lots
of new features to implement in mind, but I give bugs more priority.
-- Andrea Arcangeli, 2000

  parent reply	other threads:[~2013-09-12 22:53 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 11:31 [PATCH] /dev/random: Insufficient of entropy on many architectures Stephan Mueller
2013-09-10 11:46 ` Geert Uytterhoeven
2013-09-10 15:04 ` Theodore Ts'o
2013-09-10 16:54   ` Stephan Mueller
2013-09-10 18:25     ` Theodore Ts'o
2013-09-10 19:15       ` Stephan Mueller
2013-10-10  6:50       ` Pavel Machek
2013-10-14 21:13         ` Theodore Ts'o
2013-09-10 20:48   ` Geert Uytterhoeven
2013-09-10 21:14     ` Theodore Ts'o
2013-09-11  6:49       ` Stephan Mueller
2013-09-12 11:59         ` Geert Uytterhoeven
2013-09-12 12:08           ` Stephan Mueller
2013-09-12 12:15             ` Geert Uytterhoeven
2013-09-12 12:35               ` Stephan Mueller
2013-09-12 12:47                 ` Geert Uytterhoeven
2013-09-12 12:57                   ` Stephan Mueller
2013-09-12 21:18               ` Jörn Engel [this message]
2013-09-13 11:33             ` Thorsten Glaser
2013-09-12 14:25           ` Theodore Ts'o
2013-09-10 19:38 ` John Stultz
2013-09-10 19:44   ` John Stultz
2013-09-10 19:47   ` Stephan Mueller
2013-09-10 20:35     ` John Stultz
2013-09-10 20:38   ` Theodore Ts'o
2013-09-10 20:46     ` John Stultz
2013-09-10 21:10       ` Theodore Ts'o
2013-09-10 22:08         ` John Stultz
2013-09-10 22:33           ` Theodore Ts'o
2013-09-11  0:31             ` John Stultz
2013-09-11  0:50               ` Theodore Ts'o
2013-09-11  1:14                 ` John Stultz
2013-09-12 20:46                 ` H. Peter Anvin
2013-09-12 21:07                 ` Jörn Engel
2013-09-12 23:31                   ` Theodore Ts'o
2013-09-12 23:35                     ` Jörn Engel
2013-09-13  0:00                       ` Jörn Engel
2013-09-16 15:40                     ` [PATCH,RFC] random: make fast_mix() honor its name Jörn Engel
2013-09-21 21:25                       ` Theodore Ts'o
2013-09-21 21:41                         ` Theodore Ts'o
2013-09-22  3:05                           ` Theodore Ts'o
2013-09-22 21:01                             ` Jörg-Volker Peetz
2013-09-22 21:27                               ` Theodore Ts'o
2013-09-22 20:53                                 ` Jörn Engel
2013-09-22 23:36                                   ` Theodore Ts'o
2013-09-23  0:16                                     ` Jörn Engel
2013-09-23  2:43                                       ` Theodore Ts'o
2013-09-23 15:02                                         ` Jörn Engel
2013-09-23  7:39                                 ` Jörg-Volker Peetz
2013-09-22 20:31                           ` Jörn Engel
2013-09-22 20:14                         ` Jörn Engel
2013-09-12 21:31           ` [PATCH] /dev/random: Insufficient of entropy on many architectures Jörn Engel
2013-09-13  5:36             ` Stephan Mueller
2013-09-13 11:54               ` Thorsten Glaser
2013-09-13 19:29                 ` Theodore Ts'o
2013-09-13 15:26               ` Jörn Engel
2013-09-13 18:59               ` Theodore Ts'o
2013-09-15 11:12                 ` Stephan Mueller

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=20130912211844.GD3809@logfs.org \
    --to=joern@logfs.org \
    --cc=dave.taht@bufferbloat.net \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smueller@chronox.de \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.