linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/5] Seeding DRBG with more entropy
@ 2015-05-13 19:54 Stephan Mueller
  2015-05-13 19:54 ` [PATCH v6 1/5] random: Blocking API for accessing nonblocking_pool Stephan Mueller
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Stephan Mueller @ 2015-05-13 19:54 UTC (permalink / raw)
  To: herbert
  Cc: pebolle, andreas.steffen, tytso, sandyinchina, linux-kernel,
	linux-crypto

Hi,

as of now, the DRBG is only seeded from get_random_bytes. In various
circumstances, the nonblocking_pool behind get_random_bytes may not be fully
seeded from hardware events at the time the DRBG requires to be seeded.
Based on the discussion in [1], the DRBG seeding is updated such that it
does not completely rely on get_random_bytes any more.

The seeding approach can be characterized as follows:

1. pull buffer of size entropy + nonce from get_random_bytes

2. pull another buffer of size entropy + nonce from my Jitter RNG

3. concatenate both buffers

4. seed the DRBG with the concatenated buffer

5. trigger the async invocation of the blocking API for accessing
   the nonblocking pool with a buffer of size entropy

6. return the DRBG instance to the caller without waiting for the completion
   of step 5

7. at some point in time, the blocking API returns with a full buffer
   which is then used to re-seed the DRBG

This way, we will get entropy during the first initialization without
blocking.

The patch set adds a blocking API to access the nonblocking pool to wait
until the nonblocking pool is initialized.

Note: the DRBG and Jitter RNG patches are against the current cryptodev-2.6
tree.

The new Jitter RNG is an RNG that has large set of tests and was presented on
LKML some time back. After speaking with mathematicians at NIST, that Jitter
RNG approach would be acceptable from their side as a noise source. Note, I
personally think that the Jitter RNG has sufficient entropy in almost all
circumstances (see the massive testing I conducted on all more widely used
CPUs as shown in [2]).

Changes v6:
* patch 01: simplify patch by just adding a blocking API call to random.c as
  suggested by Herbert Xu.
* patch 03: move the async operation into this patch: the DRBG is in control
  of the async work.

Changes v5:
* drop patch 01 and therefore drop the creation of a kernel pool
* change patch 02 to use the nonblocking pool and block until the nonblocking
  pool is initialized or until the cancel operation is triggered.

Changes v4:
* Patch 02: Change get_blocking_random_bytes_cb to allow callers to call it
  multiple times without re-initializing the work data structure. Furthermore,
  only change the pointers to the output buffer and callback if work is not
  pending to avoid race conditions.
* Patch 04: No canceling of seeding during drbg_seed as the invocation of
  get_blocking_random_bytes_cb can now be done repeatedly without
  re-initializing the work data structure.

Changes v3:
* Patch 01: Correct calculation of entropy count as pointed out by Herbert Xu
* Patch 06: Correct a trivial coding issue in jent_entropy_init for
  checking JENT_EMINVARVAR reported by cppcheck

Changes v2:
* Use Dual BSD/GPL license in MODULE_LICENSE as suggested by
  Paul Bolle <pebolle@tiscali.nl>
* Patch 05, drbg_dealloc_state: only deallocate Jitter RNG if one was
  instantiated in the first place. There are two main reasons why the Jitter RNG
  may not be allocated: either it is not available as kernel module/in vmlinuz
  or during init time of the Jitter RNG, the performed testing shows that the
  underlying hardware is not suitable for the Jitter RNG (e.g. has a too coarse
  timer).


[1] http://www.mail-archive.com/linux-crypto@vger.kernel.org/msg13891.html

[2] http://www.chronox.de/jent.html


Stephan Mueller (5):
  random: Blocking API for accessing nonblocking_pool
  crypto: drbg - prepare for async seeding
  crypto: drbg - add async seeding operation
  crypto: drbg - use Jitter RNG to obtain seed
  crypto: add jitterentropy RNG

 crypto/Kconfig         |  10 +
 crypto/Makefile        |   2 +
 crypto/drbg.c          | 140 ++++++--
 crypto/jitterentropy.c | 909 +++++++++++++++++++++++++++++++++++++++++++++++++
 crypto/testmgr.c       |   4 +
 drivers/char/random.c  |  14 +
 include/crypto/drbg.h  |   5 +
 include/linux/random.h |   1 +
 8 files changed, 1058 insertions(+), 27 deletions(-)
 create mode 100644 crypto/jitterentropy.c

-- 
2.1.0



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-06-05  9:50 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13 19:54 [PATCH v6 0/5] Seeding DRBG with more entropy Stephan Mueller
2015-05-13 19:54 ` [PATCH v6 1/5] random: Blocking API for accessing nonblocking_pool Stephan Mueller
2015-05-15  6:46   ` Herbert Xu
2015-05-18  5:32     ` Stephan Mueller
2015-05-18  9:21       ` Herbert Xu
2015-05-18 13:07         ` Stephan Mueller
2015-05-18 13:26           ` Stephan Mueller
2015-05-18 15:02             ` Theodore Ts'o
2015-05-19  5:58               ` Stephan Mueller
2015-05-19  7:22                 ` Herbert Xu
2015-05-19  7:35                   ` Stephan Mueller
2015-05-19  7:51                     ` Herbert Xu
2015-05-19  7:56                       ` Stephan Mueller
2015-05-19 13:50                       ` Theodore Ts'o
2015-05-19 14:18                         ` Herbert Xu
2015-05-19 14:27                           ` Stephan Mueller
2015-05-19 14:30                             ` Herbert Xu
2015-05-19 14:36                               ` Stephan Mueller
2015-05-19 22:55                                 ` Herbert Xu
2015-05-20  6:13                                   ` Stephan Mueller
2015-06-05  5:28                           ` Herbert Xu
2015-06-05  9:50                             ` Stephan Mueller
2015-05-13 19:55 ` [PATCH v6 2/5] crypto: drbg - prepare for async seeding Stephan Mueller
2015-05-13 19:55 ` [PATCH v6 3/5] crypto: drbg - add async seeding operation Stephan Mueller
2015-05-13 19:56 ` [PATCH v6 4/5] crypto: drbg - use Jitter RNG to obtain seed Stephan Mueller
2015-05-13 19:56 ` [PATCH v6 5/5] crypto: add jitterentropy RNG Stephan Mueller

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).