From: Jason A. Donenfeld Date: Wed, 9 Mar 2022 16:10:05 +0000 (-0700) Subject: random-util: use correct minimum pool size constant X-Git-Tag: v251-rc1~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d328346944ae3f9d10c17959fd37cb151c15bba5;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/random-util.h b/src/basic/random-util.h index df23dfe14a0..ccee32792f3 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);