summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2022-01-28 10:02:54 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2022-02-05 07:10:51 +0300
commita43bed8220f26178f0f63bf4c0fc23b7b8b76763 (patch)
treef7158f7fc205e9aaa189a831f462e87877090f71 /crypto
parentdfc6031ec917b7c34a7549c3120f841b2e2be6db (diff)
downloadlinux-a43bed8220f26178f0f63bf4c0fc23b7b8b76763.tar.xz
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