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:16:26 +0100
commitbb9615930882fd9b6677c27a01446f38e417ddcd (patch)
treedc4d7d428ead46718e00fc1597e0779f0693cecc
parentf0b1591b3764acef29c944c2f02dda3265fd479d (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) (cherry picked from commit 0a8faac3c7cc2e88f46a8bdce5bd039dc22abdec)
-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 55f14be60e..cda93dfd37 100644
--- a/crypto/rand/rand_pool.c
+++ b/crypto/rand/rand_pool.c
@@ -257,7 +257,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;
}