Skip to content

Commit

Permalink
rand: improve error message for rand pool overflows
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #22394)

(cherry picked from commit 0a8faac)
  • Loading branch information
levitte authored and mattcaswell committed Oct 24, 2023
1 parent f0b1591 commit bb96159
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crypto/rand/rand_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit bb96159

Please sign in to comment.