aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-05-01 16:37:39 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2022-05-01 16:37:39 +0200
commitb5624be6df95fd26d19051af5d02001bbe8f2dd8 (patch)
tree8a43835c6a9a7bf2f98e97a652d180f3b406e380
parent74716580380d609165cc0be1ae37ee52d77243b2 (diff)
downloadbusybox-w32-b5624be6df95fd26d19051af5d02001bbe8f2dd8.tar.gz
busybox-w32-b5624be6df95fd26d19051af5d02001bbe8f2dd8.tar.bz2
busybox-w32-b5624be6df95fd26d19051af5d02001bbe8f2dd8.zip
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>
-rw-r--r--util-linux/seedrng.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util-linux/seedrng.c b/util-linux/seedrng.c
index 2965f3d47..04e52a996 100644
--- a/util-linux/seedrng.c
+++ b/util-linux/seedrng.c
@@ -56,7 +56,11 @@
56 56
57enum { 57enum {
58 MIN_SEED_LEN = SHA256_OUTSIZE, 58 MIN_SEED_LEN = SHA256_OUTSIZE,
59 MAX_SEED_LEN = 512 59 /* kernels < 5.18 could return short reads from getrandom()
60 * if signal is pending and length is > 256.
61 * Let's limit our reads to 256 bytes.
62 */
63 MAX_SEED_LEN = 256,
60}; 64};
61 65
62static size_t determine_optimal_seed_len(void) 66static size_t determine_optimal_seed_len(void)