From: mdw Date: Mon, 13 Dec 1999 15:34:28 +0000 (+0000) Subject: Increase the entropy threshhold in rand_getgood. X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/commitdiff_plain/b056b793e2d2b6be791cdfb1853ad781b800003d Increase the entropy threshhold in rand_getgood. --- diff --git a/rand.c b/rand.c index da07974..a93bf9b 100644 --- a/rand.c +++ b/rand.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: rand.c,v 1.3 1999/12/10 23:28:07 mdw Exp $ + * $Id: rand.c,v 1.4 1999/12/13 15:34:28 mdw Exp $ * * Secure random number generator * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: rand.c,v $ + * Revision 1.4 1999/12/13 15:34:28 mdw + * Increase the entropy threshhold in rand_getgood. + * * Revision 1.3 1999/12/10 23:28:07 mdw * Bug fix: rand_getgood didn't update buffer pointer. * @@ -389,7 +392,7 @@ void rand_getgood(rand_pool *r, void *p, size_t sz) if (chunk * 8 > r->obits) { if (chunk * 8 > r->ibits + r->obits) - do r->s->getnoise(r); while (r->ibits + r->obits < 128); + do r->s->getnoise(r); while (r->ibits + r->obits < 256); rand_gate(r); if (chunk * 8 > r->obits) chunk = r->obits / 8; @@ -429,6 +432,7 @@ static int gmisc(grand *r, unsigned op, ...) case GRAND_SEEDINT: case GRAND_SEEDUINT32: case GRAND_SEEDBLOCK: + case GRAND_SEEDRAND: case RAND_GATE: case RAND_STRETCH: case RAND_KEY: @@ -453,6 +457,12 @@ static int gmisc(grand *r, unsigned op, ...) size_t sz = va_arg(ap, size_t); rand_add(&g->p, p, sz, sz); } break; + case GRAND_SEEDRAND: { + grand *rr = va_arg(ap, grand *); + octet buf[16]; + rr->ops->fill(rr, buf, sizeof(buf)); + rand_add(&g->p, buf, sizeof(buf), 8); + } break; case RAND_GATE: rand_gate(&g->p); break;