Lines Matching +full:valid +full:- +full:sources
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
33 * It is also inspired by DJB's writing on buffered key-erasure PRNGs:
34 * https://blog.cr.yp.to/20170723-random.html
38 * - Extended to multi-CPU design
39 * - Extended to pre-buffer some PRNG output
40 * - Pool-based reseeding is solely time-based (rather than on-access w/
42 * - Extended to specify efficient userspace design
43 * - Always-available design (requires the equivalent of loader(8) for all
49 * - Relationship between root PRNG seed version and periodic reseed pool use.
53 * don't think first-time entropy sources should cause us to skip an entropy
55 * - Initial seeding. The paper is pretty terse on the subject. My
57 * relies on the loader(8)-provided material for initial seeding and either
58 * ignores or doesn't start entropy sources until after that time. So when
59 * the paper says that first-time entropy source material "bypasses the
61 * can generate 256 bits, mix it with the first-time entropy, and reseed
66 * - Blake2b instead of SHA-2 512 for entropy pooling
67 * - Chacha20 instead of AES-CTR DRBG for PRF
68 * - Initial seeding. We treat the 0->1 seed version (brng_generation) edge
77 * • All one-off sources are fed into pool0 and the result used to seed the
82 * present one-off source, to the extent it is in the control of
84 * - Timer interval reseeding. We also start the timer-based reseeding at
86 * load (usually within the order of micro- or milliseconds due to
91 * - Various initial seeding sources we don't have yet
92 * - In particular, VM migration/copy detection
133 * Top-level read API from randomdev. Responsible for NOWAIT-allocating
134 * per-cpu NUMA-local BRNGs, if needed and satisfiable; subroutines handle
136 * low-memory conditions when a local BRNG cannot be allocated, the request is
155 pcpu_brng_p = _DPCPU_PTR(pcpu->pc_dynamic, fxrng_brng); in _fxrng_alg_read()
161 * on-demand and need to check first. BRNGs are never deallocated and in _fxrng_alg_read()
162 * are valid as soon as the pointer is initialized. in _fxrng_alg_read()
169 domain = pcpu->pc_domain; in _fxrng_alg_read()
172 * Allocate pcpu BRNGs off-domain on weird NUMA machines like in _fxrng_alg_read()
178 * Otherwise, allocate strictly CPU-local memory. The in _fxrng_alg_read()
210 /* Establish lock order root->pcpu for WITNESS. */ in _fxrng_alg_read()
215 sizeof(newkey), &rng->brng_generation); in _fxrng_alg_read()
218 fxrng_rng_setkey(&rng->brng_rng, newkey, sizeof(newkey)); in _fxrng_alg_read()
222 * We have a valid RNG. Try to install it, or grab the other in _fxrng_alg_read()
236 * state -- it has already rekeyed. The generation in _fxrng_alg_read()
247 /* At this point we have a valid, initialized and seeded rng pointer. */ in _fxrng_alg_read()
250 *seed_version_out = rng->brng_generation; in _fxrng_alg_read()