seedrng: reduce MAX_SEED_LEN from 512 to 256

As proposed by Jason.
getrandom() is more likely to block on reads larger than this.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2022-05-01 16:37:39 +02:00
parent 7471658038
commit b5624be6df

View File

@ -56,7 +56,11 @@
enum {
MIN_SEED_LEN = SHA256_OUTSIZE,
MAX_SEED_LEN = 512
/* kernels < 5.18 could return short reads from getrandom()
* if signal is pending and length is > 256.
* Let's limit our reads to 256 bytes.
*/
MAX_SEED_LEN = 256,
};
static size_t determine_optimal_seed_len(void)