Commit d7301570 authored by Michael Graff's avatar Michael Graff
Browse files

Try a different tactic before returning failure

parent 2c12768b
...@@ -502,12 +502,18 @@ isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length, ...@@ -502,12 +502,18 @@ isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length,
* are not ok. * are not ok.
*/ */
if (goodonly) { if (goodonly) {
fillpool(ent, remain * 8, blocking); unsigned int fillcount;
if (!blocking && !partial unsigned int needcount;
&& ((ent->pool.entropy < count * 8)
|| (ent->pool.entropy fillcount = ISC_MAX(remain * 8, count * 8);
< RND_ENTROPY_THRESHOLD * 8))) needcount = ISC_MAX(count * 8,
goto zeroize; RND_ENTROPY_THRESHOLD * 8);
fillpool(ent, fillcount, blocking);
if (!partial && !blocking)
if (ent->pool.entropy < needcount)
goto zeroize;
if (blocking if (blocking
&& (ent->pool.entropy && (ent->pool.entropy
< RND_ENTROPY_THRESHOLD * 8)) < RND_ENTROPY_THRESHOLD * 8))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment