linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Epler <jepler@unpythonic.net>
To: Stephan Mueller <smueller@chronox.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	linux-crypto@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] Entropy generator with 100 kB/s throughput
Date: Sun, 10 Feb 2013 09:53:17 -0600	[thread overview]
Message-ID: <20130210155317.GA3070@unpythonic.net> (raw)
In-Reply-To: <5117969A.1080909@chronox.de>

OK, my original reading of the mixing code was not accurate.  This time
around, I started with the original posted tarball and turned the use of
the CPU clock into a very simple and clearly bad "clock" that will
provide no entropy.


--- jitterentropy-0.1/jitterentropy.c   2013-02-08 15:22:22.000000000 -0600
+++ jitterentropy-0.1-me/jitterentropy.c        2013-02-10 09:45:07.000000000 -0600
@@ -270,12 +270,13 @@
 typedef uint64_t __u64;
 
 static int fips_enabled = 0;
-#define jitterentropy_schedule sched_yield()
+#define jitterentropy_schedule (0)
 static inline void jitterentropy_get_nstime(__u64 *out)
 {
-       struct timespec time;
-       if (clock_gettime(CLOCK_REALTIME, &time) == 0)
-               *out = time.tv_nsec;
+        static __u64 t = 0;
+        const __u64 delta2 = 257;
+        static __u64 delta;
+        *out = (t += (delta += delta2));
 }
 
 /* note: these helper functions are shamelessly stolen from the kernel :-) */


This give a generator that has Entropy = 7.999907 bits per byte
and fails 6 in 10000 FIPS 140-2 tests.  It also passes some (but not
all) dieharder tests.

Jeff

  reply	other threads:[~2013-02-10 15:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 22:04 [RFC][PATCH] Entropy generator with 100 kB/s throughput Stephan Mueller
2013-02-09 18:06 ` Theodore Ts'o
2013-02-10  1:57   ` Jeff Epler
2013-02-10 12:46     ` Stephan Mueller
2013-02-10 15:53       ` Jeff Epler [this message]
2013-02-10 18:50       ` Theodore Ts'o
2013-02-10 19:27         ` Sandy Harris
2013-02-10 19:32         ` Stephan Mueller
2013-02-10 21:59           ` Sandy Harris
2013-02-11  0:05           ` Theodore Ts'o
2013-02-10 12:25   ` Stephan Mueller
2013-02-21 14:07 ` Phil Carmody
2013-02-21 14:17   ` Stephan Mueller
2013-02-21 17:46     ` Sandy Harris
2013-02-21 20:30       ` Theodore Ts'o
     [not found] ` <CAFtRNNzcUpxT3R6ttUJ0c-7QTVRxbwRVq6bPqvkSL93vbstT4g@mail.gmail.com>
2013-02-22 11:14   ` Nick Kossifidis

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=20130210155317.GA3070@unpythonic.net \
    --to=jepler@unpythonic.net \
    --cc=linux-crypto@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).