From: Richard Levitte Date: Wed, 11 Oct 2023 01:19:23 +0000 (+1100) Subject: rand: improve error message for rand pool overflows X-Git-Tag: openssl-3.2.0-beta1~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a8faac3c7cc2e88f46a8bdce5bd039dc22abdec;p=thirdparty%2Fopenssl.git rand: improve error message for rand pool overflows Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22394) --- diff --git a/crypto/rand/rand_pool.c b/crypto/rand/rand_pool.c index 8dc230b540f..8d77b77fd21 100644 --- a/crypto/rand/rand_pool.c +++ b/crypto/rand/rand_pool.c @@ -249,7 +249,11 @@ size_t ossl_rand_pool_bytes_needed(RAND_POOL *pool, unsigned int entropy_factor) if (bytes_needed > pool->max_len - pool->len) { /* not enough space left */ - ERR_raise(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW); + ERR_raise_data(ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW, + "entropy_factor=%u, entropy_needed=%zu, bytes_needed=%zu," + "pool->max_len=%zu, pool->len=%zu", + entropy_factor, entropy_needed, bytes_needed, + pool->max_len, pool->len); return 0; }