summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2023-10-11 12:19:23 +1100
committerMatt Caswell <matt@openssl.org>2023-10-24 11:14:02 +0100
commit0a8faac3c7cc2e88f46a8bdce5bd039dc22abdec (patch)
tree4955fe18833a6d90ec3246ea443a3a9a670db079
parentfac61ea4618c83826b51aebf03cbc2bc3ac7b8c8 (diff)
rand: improve error message for rand pool overflows
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22394)
-rw-r--r--crypto/rand/rand_pool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/rand/rand_pool.c b/crypto/rand/rand_pool.c
index 8dc230b540..8d77b77fd2 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;
}