summaryrefslogtreecommitdiff
path: root/src/basic/random-util.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-03-09 09:10:05 -0700
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-22 08:46:20 +0100
commitd328346944ae3f9d10c17959fd37cb151c15bba5 (patch)
treedfe12eaef4b10a4249b9f946e94844a30b2ed272 /src/basic/random-util.h
parent8bab6193831c58195ad65b227fdd47dbe017137b (diff)
downloadsystemd-d328346944ae3f9d10c17959fd37cb151c15bba5.tar.gz
random-util: use correct minimum pool size constant
The actual minimum size of the pool across supported kernel versions is 32 bytes. So adjust this minimum. I've audited every single usage of random_pool_size(), and cannot see anywhere that this would have any impact at all on anything. We could actually just not change the constant and everything would be fine, or we could change it here and that's fine too. From both a functionality and crypto perspective, it doesn't really seem to make a substantive difference any which way, so long as the value is ≥32. However, it's better to be correct and have the function do what it says, so clamp it to the right minimum.
Diffstat (limited to 'src/basic/random-util.h')
-rw-r--r--src/basic/random-util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/random-util.h b/src/basic/random-util.h
index df23dfe14a..ccee32792f 100644
--- a/src/basic/random-util.h
+++ b/src/basic/random-util.h
@@ -28,7 +28,7 @@ static inline uint32_t random_u32(void) {
}
/* Some limits on the pool sizes when we deal with the kernel random pool */
-#define RANDOM_POOL_SIZE_MIN 512U
+#define RANDOM_POOL_SIZE_MIN 32U
#define RANDOM_POOL_SIZE_MAX (10U*1024U*1024U)
size_t random_pool_size(void);