All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v32 00/12] /dev/random - a new approach with full SP800-90B compliance
@ 2020-08-20  8:25 Stephan Müller
  2020-08-20  8:39 ` [PATCH v32 01/12] Linux Random Number Generator Stephan Müller
                   ` (12 more replies)
  0 siblings, 13 replies; 92+ messages in thread
From: Stephan Müller @ 2020-08-20  8:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, linux-crypto, LKML, linux-api,
	Eric W. Biederman, Alexander E. Patrakov, Ahmed S. Darwish,
	Theodore Y. Ts'o, Willy Tarreau, Matthew Garrett,
	Vito Caputo, Andreas Dilger, Jan Kara, Ray Strode,
	William Jon McCann, zhangjs, Andy Lutomirski, Florian Weimer,
	Lennart Poettering, Nicolai Stange, Peter, Matthias,
	Marcelo Henrique Cerri, Roman Drahtmueller, Neil Horman,
	Randy Dunlap, Julia Lawall, Dan Carpenter

Hi,

The following patch set provides a different approach to /dev/random which is
called Linux Random Number Generator (LRNG) to collect entropy within the Linux
kernel. The main improvements compared to the existing /dev/random is to provide
sufficient entropy during boot time as well as in virtual environments and when
using SSDs. A secondary design goal is to limit the impact of the entropy
collection on massive parallel systems and also allow the use accelerated
cryptographic primitives. Also, all steps of the entropic data processing are
testable.

The LRNG patch set allows a user to select use of the existing /dev/random or
the LRNG during compile time. As the LRNG provides API and ABI compatible
interfaces to the existing /dev/random implementation, the user can freely chose
the RNG implementation without affecting kernel or user space operations.

This patch set provides early boot-time entropy which implies that no
additional flags to the getrandom(2) system call discussed recently on
the LKML is considered to be necessary. Yet, if additional flags are
introduced to cover special hardware, the LRNG implementation will also
provide them to be fully ABI and API compliant as already discussed on
LKML.

The LRNG is fully compliant to SP800-90B requirements and is shipped with a
full SP800-90B assessment and all required test tools. The existing /dev/random
implementation on the other hand has architectural limitations which
does not easily allow to bring the implementation in compliance with
SP800-90B. The key statement that causes concern is SP800-90B section
3.1.6. This section denies crediting entropy to multiple similar noise
sources. This section explicitly references different noise sources resting
on the timing of events and their derivatives (i.e. it is a direct complaint
to the existing existing /dev/random implementation). Therefore, SP800-90B
now denies the very issue mentioned in [1] with the existing /dev/random
implementation for a long time: crediting entropy to interrupts as well as
crediting entropy to derivatives of interrupts (HID and disk events). This is
not permissible with SP800-90B.

SP800-90B specifies various requirements for the noise source(s) that seed any
DRNG including SP800-90A DRBGs. In about a year from now, SP800-90B will be
mandated for all noise sources that provide entropy to DRBGs as part of a FIPS
140-[2|3] validation or other evaluation types. That means, if we there are no
solutions to comply with the requirements of SP800-90B found till one year
from now, any random number generation and ciphers based on random numbers
on Linux will be considered and treated as not applicable and delivering
no entropy! As /dev/urandom, getrandom(2) and /dev/random are the most
common and prevalent noise sources for DRNGs, all these DRNGs are affected.
This applies across the board for all validations of cryptography executing on
Linux (kernel and user space modules).

For users that are not interested in SP800-90B, the entire code for the
compliance as well as test interfaces can be deselected at compile time.

The design and implementation is driven by a set of goals described in [1]
that the LRNG completely implements. Furthermore, [1] includes the full
assessment of the SP800-90B compliance as well as a comparison with RNG
design suggestions of SP800-90C, and AIS20/31.

The LRNG provides a complete separation of the noise source maintenance
and the collection of entropy into an entropy pool from the post-processing
using a pseudo-random number generator. Different DRNGs are supported,
including:

* The LRNG can be compile-time enabled to replace the existing /dev/random
  implementation. When not selecting the LRNG at compile time (default), the
  existing /dev/random implementation is built.

* Built-in ChaCha20 DRNG which has no dependency to other kernel
  frameworks.

* SP800-90A DRBG using the kernel crypto API including its accelerated
  raw cipher implementations. This implies that the output of /dev/random,
  getrandom(2), /dev/urandom or get_random_bytes is fully compliant to
  SP800-90A.

* Arbitrary DRNGs registered with the kernel crypto API

* Full compliance with SP800-90B which covers the startup and runtime health
  tests mandated by SP800-90B as well as providing the test tools and test
  interfaces to obtain raw noise data securely. The test tools are provided at
  [1].

Booting the patch with the kernel command line option
"dyndbg=file drivers/char/lrng/* +p" generates logs indicating the operation
of the LRNG. Each log is pre-pended with "lrng".

The LRNG has a flexible design by allowing an easy replacement of the
deterministic random number generator component.

Compared to the existing /dev/random implementation, the compiled binary
is smaller when the LRNG is compiled with all options equal to the
existing /dev/random (i.e. only CONFIG_LRNG is set): random.o is 52.5 kBytes
whereas all LRNG object files are in 49 kBytes in size. The fully
SP800-90A/SP800-90B compliant binary code (CONFIG_LRNG,
CONFIG_LRNG_DRNG_SWITCH, CONFIG_LRNG_DRBG, CONFIG_LRNG_HEALTH_TESTS)
uses some 61 kBytes. In addition, the LRNG is about 50% faster in the
performance critical interrupt handler code path compared to the existing
/dev/random implementation.

Full SP800-90B testing is performed on the following systems - details
are given in [2] appendix C:

* x86 KVM virtualized guest 32 and 64 bit systems

* x86 bare metal

* older and newer ARMv7 system

* ARM64

* POWER7 LE and POWER 8 BE

* IBM Z System mainframe

* old MIPS embedded device

[1] https://www.chronox.de/lrng.html - If the patch is accepted, I would
be volunteering to convert the documentation into RST format and
contribute it to the Linux kernel documentation directory.

[2] https://www.chronox.de/lrng/doc/lrng.pdf

Changes (compared to the previous patch set):

* Use of SHA-256 for hashing the entropy pool per default to ensure
  the LRNG can be claimed to manage 256 bits of entropy pursuant to
  SP800-90B (note, the required CONFIG_CRYPTO_LIB_SHA256 current depends
  on CONFIG_CRYPTO due to artificial Kconfig settings - technically
  CONFIG_CRYPTO_LIB_SHA256 could be compiled without CONFIG_CRYPTO)

* When using CTR DRBG, use SHA-256 for hashing entropy pool instead of
  CMAC AES to fully comply with SP800-90B to the letter of the law

* Correctly use CONFIG_BASE_SMALL in C code

* speed up add_interrupt_randomness if high-resolution time stamp is not
  available

* integrate patch a2541dcb51127dc31934ab93bc99ae7df458e41b

* integrate patch f227e3ec3b5cad859ad15666874405e8c1bbc1d4 and ensure
  that its associated design concerns documented in [2] section 2.2.5
  are addressed

* add test interfaces for Jiffies, interrupt numbers, interrupt flags,
  and return instruction pointer supporting integration of patch
  f227e3ec3b5cad859ad15666874405e8c1bbc1d4 and systems with a missing
  high-resolution timer

As a side node: With the switchable DRNG support offered in this patch set,
the following areas could be removed. As the existing /dev/random has no support
for switchable DRNGs, however, this is not yet feasible though.

* remove lrng_ready_list and all code around it in lrng_interfaces.c

* remove the kernel crypto API RNG API to avoid having two random number
  providing APIs - this would imply that all RNGs developed for this API would
  be converted to the LRNG interface

CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: "Alexander E. Patrakov" <patrakov@gmail.com>
CC: "Ahmed S. Darwish" <darwish.07@gmail.com>
CC: "Theodore Y. Ts'o" <tytso@mit.edu>
CC: Willy Tarreau <w@1wt.eu>
CC: Matthew Garrett <mjg59@srcf.ucam.org>
CC: Vito Caputo <vcaputo@pengaru.com>
CC: Andreas Dilger <adilger.kernel@dilger.ca>
CC: Jan Kara <jack@suse.cz>
CC: Ray Strode <rstrode@redhat.com>
CC: William Jon McCann <mccann@jhu.edu>
CC: zhangjs <zachary@baishancloud.com>
CC: Andy Lutomirski <luto@kernel.org>
CC: Florian Weimer <fweimer@redhat.com>
CC: Lennart Poettering <mzxreary@0pointer.de>
CC: Nicolai Stange <nstange@suse.de>
Tested-by: Roman Drahtmüller <draht@schaltsekun.de>
Tested-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>

Stephan Mueller (12):
  Linux Random Number Generator
  LRNG - allocate one DRNG instance per NUMA node
  LRNG - sysctls and /proc interface
  LRNG - add switchable DRNG support
  crypto: DRBG - externalize DRBG functions for LRNG
  LRNG - add SP800-90A DRBG extension
  LRNG - add kernel crypto API PRNG extension
  crypto: provide access to a static Jitter RNG state
  LRNG - add Jitter RNG fast noise source
  LRNG - add SP800-90B compliant health tests
  LRNG - add interface for gathering of raw entropy
  LRNG - add power-on and runtime self-tests

 MAINTAINERS                                   |   7 +
 crypto/drbg.c                                 |  16 +-
 crypto/jitterentropy-kcapi.c                  |   3 +-
 crypto/jitterentropy.c                        |  31 +-
 drivers/char/Kconfig                          |   2 +
 drivers/char/Makefile                         |   9 +-
 drivers/char/lrng/Kconfig                     | 315 +++++++++
 drivers/char/lrng/Makefile                    |  19 +
 drivers/char/lrng/lrng_archrandom.c           |  93 +++
 drivers/char/lrng/lrng_aux.c                  | 136 ++++
 drivers/char/lrng/lrng_chacha20.c             | 320 +++++++++
 drivers/char/lrng/lrng_chacha20.h             |  29 +
 drivers/char/lrng/lrng_drbg.c                 | 259 +++++++
 drivers/char/lrng/lrng_drng.c                 | 409 +++++++++++
 drivers/char/lrng/lrng_health.c               | 407 +++++++++++
 drivers/char/lrng/lrng_interfaces.c           | 647 ++++++++++++++++++
 drivers/char/lrng/lrng_internal.h             | 342 +++++++++
 drivers/char/lrng/lrng_jent.c                 |  88 +++
 drivers/char/lrng/lrng_kcapi.c                | 321 +++++++++
 drivers/char/lrng/lrng_lfsr.h                 | 152 ++++
 drivers/char/lrng/lrng_numa.c                 | 101 +++
 drivers/char/lrng/lrng_pool.c                 | 589 ++++++++++++++++
 drivers/char/lrng/lrng_proc.c                 | 163 +++++
 drivers/char/lrng/lrng_selftest.c             | 504 ++++++++++++++
 drivers/char/lrng/lrng_sw_noise.c             | 155 +++++
 drivers/char/lrng/lrng_sw_noise.h             |  57 ++
 drivers/char/lrng/lrng_switch.c               | 189 +++++
 drivers/char/lrng/lrng_testing.c              | 575 ++++++++++++++++
 include/crypto/drbg.h                         |   7 +
 .../crypto/internal}/jitterentropy.h          |   3 +
 include/linux/lrng.h                          |  63 ++
 31 files changed, 6001 insertions(+), 10 deletions(-)
 create mode 100644 drivers/char/lrng/Kconfig
 create mode 100644 drivers/char/lrng/Makefile
 create mode 100644 drivers/char/lrng/lrng_archrandom.c
 create mode 100644 drivers/char/lrng/lrng_aux.c
 create mode 100644 drivers/char/lrng/lrng_chacha20.c
 create mode 100644 drivers/char/lrng/lrng_chacha20.h
 create mode 100644 drivers/char/lrng/lrng_drbg.c
 create mode 100644 drivers/char/lrng/lrng_drng.c
 create mode 100644 drivers/char/lrng/lrng_health.c
 create mode 100644 drivers/char/lrng/lrng_interfaces.c
 create mode 100644 drivers/char/lrng/lrng_internal.h
 create mode 100644 drivers/char/lrng/lrng_jent.c
 create mode 100644 drivers/char/lrng/lrng_kcapi.c
 create mode 100644 drivers/char/lrng/lrng_lfsr.h
 create mode 100644 drivers/char/lrng/lrng_numa.c
 create mode 100644 drivers/char/lrng/lrng_pool.c
 create mode 100644 drivers/char/lrng/lrng_proc.c
 create mode 100644 drivers/char/lrng/lrng_selftest.c
 create mode 100644 drivers/char/lrng/lrng_sw_noise.c
 create mode 100644 drivers/char/lrng/lrng_sw_noise.h
 create mode 100644 drivers/char/lrng/lrng_switch.c
 create mode 100644 drivers/char/lrng/lrng_testing.c
 rename {crypto => include/crypto/internal}/jitterentropy.h (84%)
 create mode 100644 include/linux/lrng.h

-- 
2.26.2





^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: [PATCH v33 01/12] Linux Random Number Generator
@ 2020-08-23  1:24 kernel test robot
  0 siblings, 0 replies; 92+ messages in thread
From: kernel test robot @ 2020-08-23  1:24 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 11795 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <7836152.NyiUUSuA9g@positron.chronox.de>
References: <7836152.NyiUUSuA9g@positron.chronox.de>
TO: "Stephan Müller" <smueller@chronox.de>
TO: Arnd Bergmann <arnd@arndb.de>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
CC: linux-crypto(a)vger.kernel.org
CC: LKML <linux-kernel@vger.kernel.org>
CC: linux-api(a)vger.kernel.org
CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: "Alexander E. Patrakov" <patrakov@gmail.com>
CC: "Ahmed S. Darwish" <darwish.07@gmail.com>
CC: "Theodore Y. Ts'o" <tytso@mit.edu>
CC: Willy Tarreau <w@1wt.eu>

Hi "Stephan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on cryptodev/master crypto/master v5.9-rc1 next-20200821]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B-compliance/20200821-140523
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d162219c655c8cf8003128a13840d6c1e183fb80
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm64-randconfig-s031-20200821 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

   drivers/char/lrng/lrng_drng.c:381:6: sparse: sparse: symbol 'lrng_reset' was not declared. Should it be static?
>> drivers/char/lrng/lrng_drng.c:81:13: sparse: sparse: context imbalance in 'lrng_drngs_init_cc20' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:113:13: sparse: sparse: context imbalance in 'lrng_drng_inject' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:161:25: sparse: sparse: context imbalance in 'lrng_drng_seed' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:318:33: sparse: sparse: context imbalance in 'lrng_drng_get' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:373:9: sparse: sparse: context imbalance in '_lrng_reset' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:388:13: sparse: sparse: context imbalance in 'lrng_drng_init_early' - different lock contexts for basic block
--
>> drivers/char/lrng/lrng_chacha20.c:54:47: sparse: sparse: cast to restricted __le32
   drivers/char/lrng/lrng_chacha20.c:58:47: sparse: sparse: cast to restricted __le32
--
>> drivers/char/lrng/lrng_interfaces.c:482:16: sparse: sparse: incorrect type in return expression (different base types) @@     expected unsigned int @@     got restricted __poll_t [assigned] [usertype] mask @@
>> drivers/char/lrng/lrng_interfaces.c:482:16: sparse:     expected unsigned int
>> drivers/char/lrng/lrng_interfaces.c:482:16: sparse:     got restricted __poll_t [assigned] [usertype] mask
>> drivers/char/lrng/lrng_interfaces.c:612:18: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __poll_t ( *poll )( ... ) @@     got unsigned int ( * )( ... ) @@
>> drivers/char/lrng/lrng_interfaces.c:612:18: sparse:     expected restricted __poll_t ( *poll )( ... )
>> drivers/char/lrng/lrng_interfaces.c:612:18: sparse:     got unsigned int ( * )( ... )

# https://github.com/0day-ci/linux/commit/95481f9aadd4408e56c65cd95e47b929224fbc28
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B-compliance/20200821-140523
git checkout 95481f9aadd4408e56c65cd95e47b929224fbc28
vim +/lrng_drngs_init_cc20 +81 drivers/char/lrng/lrng_drng.c

95481f9aadd440 Stephan Müller 2020-08-21   79  
95481f9aadd440 Stephan Müller 2020-08-21   80  /* Initialize the default DRNG during boot */
95481f9aadd440 Stephan Müller 2020-08-21  @81  static void lrng_drngs_init_cc20(void)
95481f9aadd440 Stephan Müller 2020-08-21   82  {
95481f9aadd440 Stephan Müller 2020-08-21   83  	unsigned long flags = 0;
95481f9aadd440 Stephan Müller 2020-08-21   84  
95481f9aadd440 Stephan Müller 2020-08-21   85  	if (lrng_get_available())
95481f9aadd440 Stephan Müller 2020-08-21   86  		return;
95481f9aadd440 Stephan Müller 2020-08-21   87  
95481f9aadd440 Stephan Müller 2020-08-21   88  	lrng_drng_lock(&lrng_drng_init, &flags);
95481f9aadd440 Stephan Müller 2020-08-21   89  	if (lrng_get_available()) {
95481f9aadd440 Stephan Müller 2020-08-21   90  		lrng_drng_unlock(&lrng_drng_init, &flags);
95481f9aadd440 Stephan Müller 2020-08-21   91  		return;
95481f9aadd440 Stephan Müller 2020-08-21   92  	}
95481f9aadd440 Stephan Müller 2020-08-21   93  
95481f9aadd440 Stephan Müller 2020-08-21   94  	lrng_drng_reset(&lrng_drng_init);
95481f9aadd440 Stephan Müller 2020-08-21   95  	lrng_cc20_init_state(&chacha20);
95481f9aadd440 Stephan Müller 2020-08-21   96  	lrng_state_init_seed_work();
95481f9aadd440 Stephan Müller 2020-08-21   97  	lrng_drng_unlock(&lrng_drng_init, &flags);
95481f9aadd440 Stephan Müller 2020-08-21   98  
95481f9aadd440 Stephan Müller 2020-08-21   99  	lrng_drng_lock(&lrng_drng_atomic, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  100  	lrng_drng_reset(&lrng_drng_atomic);
95481f9aadd440 Stephan Müller 2020-08-21  101  	/*
95481f9aadd440 Stephan Müller 2020-08-21  102  	 * We do not initialize the state of the atomic DRNG as it is identical
95481f9aadd440 Stephan Müller 2020-08-21  103  	 * to the DRNG at this point.
95481f9aadd440 Stephan Müller 2020-08-21  104  	 */
95481f9aadd440 Stephan Müller 2020-08-21  105  	lrng_drng_unlock(&lrng_drng_atomic, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  106  
95481f9aadd440 Stephan Müller 2020-08-21  107  	lrng_set_available();
95481f9aadd440 Stephan Müller 2020-08-21  108  }
95481f9aadd440 Stephan Müller 2020-08-21  109  
95481f9aadd440 Stephan Müller 2020-08-21  110  /************************* Random Number Generation ***************************/
95481f9aadd440 Stephan Müller 2020-08-21  111  
95481f9aadd440 Stephan Müller 2020-08-21  112  /* Inject a data buffer into the DRNG */
95481f9aadd440 Stephan Müller 2020-08-21 @113  static void lrng_drng_inject(struct lrng_drng *drng,
95481f9aadd440 Stephan Müller 2020-08-21  114  			     const u8 *inbuf, u32 inbuflen)
95481f9aadd440 Stephan Müller 2020-08-21  115  {
95481f9aadd440 Stephan Müller 2020-08-21  116  	const char *drng_type = unlikely(drng == &lrng_drng_atomic) ?
95481f9aadd440 Stephan Müller 2020-08-21  117  				"atomic" : "regular";
95481f9aadd440 Stephan Müller 2020-08-21  118  	unsigned long flags = 0;
95481f9aadd440 Stephan Müller 2020-08-21  119  
95481f9aadd440 Stephan Müller 2020-08-21  120  	BUILD_BUG_ON(LRNG_DRNG_RESEED_THRESH > INT_MAX);
95481f9aadd440 Stephan Müller 2020-08-21  121  	pr_debug("seeding %s DRNG with %u bytes\n", drng_type, inbuflen);
95481f9aadd440 Stephan Müller 2020-08-21  122  	lrng_drng_lock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  123  	if (drng->crypto_cb->lrng_drng_seed_helper(drng->drng,
95481f9aadd440 Stephan Müller 2020-08-21  124  						    inbuf, inbuflen) < 0) {
95481f9aadd440 Stephan Müller 2020-08-21  125  		pr_warn("seeding of %s DRNG failed\n", drng_type);
95481f9aadd440 Stephan Müller 2020-08-21  126  		atomic_set(&drng->requests, 1);
95481f9aadd440 Stephan Müller 2020-08-21  127  	} else {
95481f9aadd440 Stephan Müller 2020-08-21  128  		pr_debug("%s DRNG stats since last seeding: %lu secs; generate calls: %d\n",
95481f9aadd440 Stephan Müller 2020-08-21  129  			 drng_type,
95481f9aadd440 Stephan Müller 2020-08-21  130  			 (time_after(jiffies, drng->last_seeded) ?
95481f9aadd440 Stephan Müller 2020-08-21  131  			  (jiffies - drng->last_seeded) : 0) / HZ,
95481f9aadd440 Stephan Müller 2020-08-21  132  			 (LRNG_DRNG_RESEED_THRESH -
95481f9aadd440 Stephan Müller 2020-08-21  133  			  atomic_read(&drng->requests)));
95481f9aadd440 Stephan Müller 2020-08-21  134  		drng->last_seeded = jiffies;
95481f9aadd440 Stephan Müller 2020-08-21  135  		atomic_set(&drng->requests, LRNG_DRNG_RESEED_THRESH);
95481f9aadd440 Stephan Müller 2020-08-21  136  		drng->force_reseed = false;
95481f9aadd440 Stephan Müller 2020-08-21  137  
95481f9aadd440 Stephan Müller 2020-08-21  138  		if (drng->drng == lrng_drng_atomic.drng) {
95481f9aadd440 Stephan Müller 2020-08-21  139  			lrng_drng_atomic.last_seeded = jiffies;
95481f9aadd440 Stephan Müller 2020-08-21  140  			atomic_set(&lrng_drng_atomic.requests,
95481f9aadd440 Stephan Müller 2020-08-21  141  				   LRNG_DRNG_RESEED_THRESH);
95481f9aadd440 Stephan Müller 2020-08-21  142  			lrng_drng_atomic.force_reseed = false;
95481f9aadd440 Stephan Müller 2020-08-21  143  		}
95481f9aadd440 Stephan Müller 2020-08-21  144  	}
95481f9aadd440 Stephan Müller 2020-08-21  145  	lrng_drng_unlock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  146  }
95481f9aadd440 Stephan Müller 2020-08-21  147  
95481f9aadd440 Stephan Müller 2020-08-21  148  /*
95481f9aadd440 Stephan Müller 2020-08-21  149   * Perform the seeding of the DRNG with data from noise source
95481f9aadd440 Stephan Müller 2020-08-21  150   */
95481f9aadd440 Stephan Müller 2020-08-21  151  static inline int _lrng_drng_seed(struct lrng_drng *drng)
95481f9aadd440 Stephan Müller 2020-08-21  152  {
95481f9aadd440 Stephan Müller 2020-08-21  153  	struct entropy_buf seedbuf __aligned(LRNG_KCAPI_ALIGN);
95481f9aadd440 Stephan Müller 2020-08-21  154  	unsigned long flags = 0;
95481f9aadd440 Stephan Müller 2020-08-21  155  	u32 total_entropy_bits;
95481f9aadd440 Stephan Müller 2020-08-21  156  	int ret;
95481f9aadd440 Stephan Müller 2020-08-21  157  
95481f9aadd440 Stephan Müller 2020-08-21  158  	lrng_drng_lock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  159  	total_entropy_bits = lrng_fill_seed_buffer(drng->crypto_cb, drng->hash,
95481f9aadd440 Stephan Müller 2020-08-21  160  						   &seedbuf, 0);
95481f9aadd440 Stephan Müller 2020-08-21 @161  	lrng_drng_unlock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  162  
95481f9aadd440 Stephan Müller 2020-08-21  163  	/* Allow the seeding operation to be called again */
95481f9aadd440 Stephan Müller 2020-08-21  164  	lrng_pool_unlock();
95481f9aadd440 Stephan Müller 2020-08-21  165  	lrng_init_ops(total_entropy_bits);
95481f9aadd440 Stephan Müller 2020-08-21  166  	ret = total_entropy_bits >> 3;
95481f9aadd440 Stephan Müller 2020-08-21  167  
95481f9aadd440 Stephan Müller 2020-08-21  168  	lrng_drng_inject(drng, (u8 *)&seedbuf, sizeof(seedbuf));
95481f9aadd440 Stephan Müller 2020-08-21  169  	memzero_explicit(&seedbuf, sizeof(seedbuf));
95481f9aadd440 Stephan Müller 2020-08-21  170  
95481f9aadd440 Stephan Müller 2020-08-21  171  	return ret;
95481f9aadd440 Stephan Müller 2020-08-21  172  }
95481f9aadd440 Stephan Müller 2020-08-21  173  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34610 bytes --]

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

end of thread, other threads:[~2020-09-20 16:50 UTC | newest]

Thread overview: 92+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20  8:25 [PATCH v32 00/12] /dev/random - a new approach with full SP800-90B compliance Stephan Müller
2020-08-20  8:39 ` [PATCH v32 01/12] Linux Random Number Generator Stephan Müller
2020-08-20 11:46   ` kernel test robot
2020-08-20 11:46     ` kernel test robot
2020-08-20 12:31     ` Stephan Müller
2020-08-20 12:31       ` Stephan Müller
2020-08-20  8:40 ` [PATCH v32 02/12] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-08-20  8:40 ` [PATCH v32 03/12] LRNG - sysctls and /proc interface Stephan Müller
2020-08-20  8:41 ` [PATCH v32 04/12] LRNG - add switchable DRNG support Stephan Müller
2020-08-20  8:42 ` [PATCH v32 05/12] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-08-20  8:42 ` [PATCH v32 06/12] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-08-20 12:07   ` kernel test robot
2020-08-20 12:07     ` kernel test robot
2020-08-20 12:27     ` Stephan Müller
2020-08-20 12:27       ` Stephan Müller
2020-08-20  8:43 ` [PATCH v32 07/12] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-08-20 12:32   ` kernel test robot
2020-08-20 12:32     ` kernel test robot
2020-08-20  8:43 ` [PATCH v32 08/12] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-08-20  8:44 ` [PATCH v32 09/12] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-08-20  8:44 ` [PATCH v32 10/12] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-08-20  8:45 ` [PATCH v32 11/12] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-08-20 12:47   ` kernel test robot
2020-08-20 12:47     ` kernel test robot
2020-08-20  8:45 ` [PATCH v32 12/12] LRNG - add power-on and runtime self-tests Stephan Müller
2020-08-21  5:37 ` [PATCH v33 00/12] /dev/random - a new approach with full SP800-90B compliance Stephan Müller
2020-08-21  5:38   ` [PATCH v33 01/12] Linux Random Number Generator Stephan Müller
2020-08-21 19:42     ` kernel test robot
2020-08-21 19:42       ` kernel test robot
2020-08-22  4:49       ` Stephan Müller
2020-08-22  4:49         ` Stephan Müller
2020-08-22  3:34     ` kernel test robot
2020-08-22  3:34       ` kernel test robot
2020-08-26 14:27     ` kernel test robot
2020-08-26 14:27       ` kernel test robot
2020-08-26 14:22       ` Stephan Mueller
2020-08-26 14:22         ` Stephan Mueller
2020-08-21  5:39   ` [PATCH v33 02/12] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-08-21  5:39   ` [PATCH v33 03/12] LRNG - sysctls and /proc interface Stephan Müller
2020-08-23  7:10     ` kernel test robot
2020-08-23  7:10       ` kernel test robot
2020-08-21  5:40   ` [PATCH v33 04/12] LRNG - add switchable DRNG support Stephan Müller
2020-08-21  5:40   ` [PATCH v33 05/12] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-08-21  5:41   ` [PATCH v33 06/12] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-08-21  5:42   ` [PATCH v33 07/12] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-08-21  5:42   ` [PATCH v33 08/12] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-08-21  5:42   ` [PATCH v33 09/12] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-08-21  5:43   ` [PATCH v33 10/12] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-08-21  5:43   ` [PATCH v33 11/12] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-08-21  5:44   ` [PATCH v33 12/12] LRNG - add power-on and runtime self-tests Stephan Müller
2020-08-23 14:50     ` kernel test robot
2020-08-23 14:50       ` kernel test robot
2020-08-25  7:21   ` [PATCH v34 00/12] /dev/random - a new approach with full SP800-90B compliance Stephan Müller
2020-08-25  7:22     ` [PATCH v34 01/12] Linux Random Number Generator Stephan Müller
2020-08-25 11:28       ` kernel test robot
2020-08-25 11:28         ` kernel test robot
2020-08-25 11:51         ` Stephan Mueller
2020-08-25 11:51           ` Stephan Mueller
2020-08-31  9:24       ` kernel test robot
2020-08-31  9:24         ` kernel test robot
2020-08-25  7:23     ` [PATCH v34 02/12] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-08-25  7:23     ` [PATCH v34 03/12] LRNG - sysctls and /proc interface Stephan Müller
2020-08-25  7:24     ` [PATCH v34 04/12] LRNG - add switchable DRNG support Stephan Müller
2020-08-31 10:03       ` kernel test robot
2020-08-31 10:03         ` kernel test robot
2020-08-25  7:24     ` [PATCH v34 05/12] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-08-25  7:25     ` [PATCH v34 06/12] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-08-25  7:25     ` [PATCH v34 07/12] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-08-25  7:26     ` [PATCH v34 08/12] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-08-25  7:26     ` [PATCH v34 09/12] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-08-25  7:27     ` [PATCH v34 10/12] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-08-25  7:27     ` [PATCH v34 11/12] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-08-25  7:27     ` [PATCH v34 12/12] LRNG - add power-on and runtime self-tests Stephan Müller
2020-09-18  9:47   ` [PATCH v35 00/13] /dev/random - a new approach Stephan Müller
2020-09-18  9:48     ` [PATCH v35 01/13] Linux Random Number Generator Stephan Müller
2020-09-18 13:02       ` kernel test robot
2020-09-18 13:02         ` kernel test robot
2020-09-20 16:49         ` Stephan Mueller
2020-09-20 16:49           ` Stephan Mueller
2020-09-18  9:48     ` [PATCH v35 02/13] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-09-18  9:49     ` [PATCH v35 03/13] LRNG - sysctls and /proc interface Stephan Müller
2020-09-18  9:49     ` [PATCH v35 04/13] LRNG - add switchable DRNG support Stephan Müller
2020-09-18  9:49     ` [PATCH v35 05/13] LRNG - add common generic hash support Stephan Müller
2020-09-18  9:50     ` [PATCH v35 06/13] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-09-18  9:50     ` [PATCH v35 07/13] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-09-18  9:51     ` [PATCH v35 08/13] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-09-18  9:51     ` [PATCH v35 09/13] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-09-18  9:51     ` [PATCH v35 10/13] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-09-18  9:52     ` [PATCH v35 11/13] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-09-18  9:53     ` [PATCH v35 12/13] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-09-18  9:53     ` [PATCH v35 13/13] LRNG - add power-on and runtime self-tests Stephan Müller
2020-08-23  1:24 [PATCH v33 01/12] Linux Random Number Generator kernel test robot

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.