All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Johan Adolfsson" <johan.adolfsson@axis.com>
To: "Alex Bligh - linux-kernel" <linux-kernel@alex.org.uk>,
	"David Lang" <david.lang@digitalinsight.com>
Cc: "David Schwartz" <davids@webmaster.com>, <linux-kernel@vger.kernel.org>
Subject: Re: Entropy from net devices - keyboard & IDE just as 'bad' (better timing in random.c)
Date: Tue, 21 Aug 2001 12:06:58 +0200	[thread overview]
Message-ID: <256901c12a29$03e30580$0a070d0a@axis.se> (raw)
In-Reply-To: <Pine.LNX.4.33.0108210042520.32719-100000@dlang.diginsite.com> <608038730.998389316@[169.254.45.213]>


Alex Bligh - linux-kernel <linux-kernel@alex.org.uk> wrote:

> Well, I was arguing that network traffic was sufficiently unobservable
> that it constitutes valid entropy under some circumstances, until I went
> and read the code. It is so (it seems to me) on some i386 versions, where
> the cycle clock is used. It is definitely not (and neither are any of
> the other interrupt timings) where jiffies are used, for a start
> because /proc/interrupts gives you the jiffie count (timer interrupts)
> and the other interrupt counters simultaneously. So my argument is
> that in some situations (where you know are happy with the extent
> to which there is no observation of your wire locally), net IRQs
> are no worse than the other sources of entropy, and sometimes they
> are better (consider keyboards connected by radio). Obviously, in
> cases like 802.11, they are substantially worse (and, no doubt, we
> could omit Robert's patch from things like 802.11 drivers which
> are obvious 'don't do that' cases).

How about improving that with something like this (not test compiled)

static void add_timer_randomness(struct timer_rand_state *state, unsigned
num)
{
 __u32  time;
 __s32  delta, delta2, delta3;
 int  entropy = 0;

#if defined (__i386__)
 if ( test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability) ) {
  __u32 high;
  __asm__(".byte 0x0f,0x31"
   :"=a" (time), "=d" (high));
  num ^= high;
 } else {
  time = jiffies;
 }
#else
+ struct timeval tv;
+ do_gettimeofday(&tv);
+ num ^= tv.tv_usec;
 time = jiffies;
#endif

Of course do_gettimeofday() is probably a little to heavyweigt for doing
this,
so how about adding an arch specific macro:
GET_JIFFIES_USEC()
that returns the number of microseconds in the current jiffie and simply
use that to modify the num?

/Johan



  reply	other threads:[~2001-08-21 10:06 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-16  4:36 [PATCH] Optionally let Net Devices feed Entropy Robert Love
2001-08-16  4:40 ` [PATCH] 2.4.9-pre4: Optionally let Net Devices feed Entropy (1/2) Robert Love
2001-08-16  4:42 ` [PATCH] 2.4.9-pre4: Optionally let Net Devices feed Entropy (2/2) Robert Love
2001-08-16  4:43 ` [PATCH] 2.4.8-ac5: let Net Devices feed Entropy (1/2) Robert Love
2001-08-16  4:44 ` [PATCH] 2.4.8-ac5: let Net Devices feed Entropy (2/2) Robert Love
2001-08-16  8:50 ` [PATCH] Optionally let Net Devices feed Entropy Francois Romieu
2001-08-16 14:50   ` Robert Love
2001-08-16 17:02     ` Francois Romieu
2001-08-16 19:28       ` Alex Bligh - linux-kernel
2001-08-16 20:19         ` D. Stimits
2001-08-17  0:47           ` Robert Love
2001-08-17 22:56             ` D. Stimits
2001-08-18  5:57               ` Robert Love
2001-08-18 17:44                 ` [PATCH] let Net Devices feed Entropy, updated (1/2) Robert Love
2001-08-18 23:41                   ` Oliver Xymoron
2001-08-19  0:38                     ` Rik van Riel
2001-08-19  3:33                       ` Oliver Xymoron
2001-08-19  3:49                         ` Robert Love
2001-08-21  7:17                         ` Philipp Matthias Hahn
2001-08-19 18:46                       ` Mike Castle
2001-08-19  3:12                     ` Robert Love
2001-08-19  3:36                       ` Oliver Xymoron
2001-08-19  3:41                         ` Rik van Riel
2001-08-19  3:57                           ` Robert Love
2001-08-19  3:56                         ` Robert Love
2001-08-19 14:43                           ` lists
2001-08-19 21:34                             ` Alex Bligh - linux-kernel
2001-08-19 22:08                               ` Entropy from net devices - keyboard & IDE just as 'bad' [was Re: [PATCH] let Net Devices feed Entropy, updated (1/2)] Alex Bligh - linux-kernel
2001-08-19 22:18                                 ` Alex Bligh - linux-kernel
2001-08-19 22:30                                 ` David Schwartz
2001-08-19 22:38                                   ` Alex Bligh - linux-kernel
2001-08-19 22:46                                     ` David Schwartz
2001-08-20 13:25                                       ` Alex Bligh - linux-kernel
2001-08-20 19:48                                         ` David Schwartz
2001-08-21  8:50                                           ` Alex Bligh - linux-kernel
2001-08-21  7:49                                             ` David Lang
2001-08-21  9:21                                               ` Alex Bligh - linux-kernel
2001-08-21 10:06                                                 ` Johan Adolfsson [this message]
2001-08-21 18:31                                               ` David Wagner
2001-08-21 21:53                                                 ` Robert Love
2001-08-21 18:29                                             ` David Wagner
2001-08-21 21:50                                               ` Robert Love
2001-08-21 21:57                                                 ` Robert Love
2001-08-19 17:08                           ` [PATCH] let Net Devices feed Entropy, updated (1/2) Oliver Xymoron
2001-08-19 18:02                             ` David Madore
2001-08-19 23:47                             ` Oliver Xymoron
2001-08-19 21:19                           ` Alex Bligh - linux-kernel
2001-08-19 22:24                             ` David Ford
2001-08-20 10:02                           ` Martin Dalecki
2001-08-20 10:34                             ` Johan Adolfsson
2001-08-20 10:47                               ` Martin Dalecki
2001-08-20 13:07                                 ` Johan Adolfsson
2001-08-20 13:57                                 ` Alex Bligh - linux-kernel
2001-08-20 14:25                                   ` Martin Dalecki
2001-08-21  1:11                                     ` Theodore Tso
2001-08-21  1:36                                       ` Richard Gooch
2001-08-21  9:43                                         ` Martin Dalecki
2001-08-21  9:59                                           ` Johan Adolfsson
2001-08-21 17:19                                           ` Richard Gooch
2001-08-21 18:33                                           ` David Wagner
2001-08-21  4:33                                       ` Robert Love
2001-08-20 16:15                                 ` Robert Love
2001-08-20 16:36                               ` Robert Love
2001-08-22  6:10                           ` Mike Touloumtzis
2001-08-22  6:26                             ` Robert Love
2001-08-22 17:27                               ` Mike Touloumtzis
2001-08-22  8:54                             ` Alex Bligh - linux-kernel
2001-08-22 13:47                             ` Chris Friesen
2001-08-19 20:58                     ` Alex Bligh - linux-kernel
2001-08-19 22:19                       ` Mike Castle
2001-08-19 22:29                         ` Alex Bligh - linux-kernel
2001-08-20  2:26                           ` Mike Castle
2001-08-20 23:08                             ` Tom Rini
2001-08-17  0:47         ` [PATCH] Optionally let Net Devices feed Entropy Robert Love
2001-08-17 14:34           ` Alex Bligh - linux-kernel
2001-08-17  0:47       ` Robert Love
2001-08-17  9:05         ` Francois Romieu
2001-08-17 15:00           ` Alex Bligh - linux-kernel

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='256901c12a29$03e30580$0a070d0a@axis.se' \
    --to=johan.adolfsson@axis.com \
    --cc=david.lang@digitalinsight.com \
    --cc=davids@webmaster.com \
    --cc=linux-kernel@alex.org.uk \
    --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 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.