diff options
author | Dominik Brodowski | 2022-01-28 08:02:54 +0100 |
---|---|---|
committer | Herbert Xu | 2022-02-05 15:10:51 +1100 |
commit | a43bed8220f26178f0f63bf4c0fc23b7b8b76763 (patch) | |
tree | f7158f7fc205e9aaa189a831f462e87877090f71 /crypto | |
parent | dfc6031ec917b7c34a7549c3120f841b2e2be6db (diff) |
hwrng: core - credit entropy for low quality sources of randomness
In case the entropy quality is low, there may be less than one bit to
credit in the call to add_hwgenerator_randomness(): The number of bytes
returned by rng_get_data() multiplied by the current quality (in entropy
bits per 1024 bits of input) must be larger than 128 to credit at least
one bit. However, imx-rngc.c sets the quality to 19, but may return less
than 32 bytes; hid_u2fzero.c sets the quality to 1; and users may override
the quality setting manually.
In case there is less than one bit to credit, keep track of it and add
that credit to the next iteration.
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
0 files changed, 0 insertions, 0 deletions