When memsetting the entropy pool to 0, the count should be the size in bytes,

not words.
This commit is contained in:
Brian Wellington 2001-02-05 23:00:18 +00:00
parent 2fdaa940cc
commit 0ef3f4fb41

View file

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: entropy.c,v 1.56 2001/01/23 03:07:15 marka Exp $ */
/* $Id: entropy.c,v 1.57 2001/02/05 23:00:18 bwelling Exp $ */
#include <config.h>
@ -65,6 +65,7 @@
* size of entropy pool in 32-bit words. This _MUST_ be a power of 2.
*/
#define RND_POOLWORDS 128
#define RND_POOLBYTES (RND_POOLWORDS * 4)
#define RND_POOLBITS (RND_POOLWORDS * 32)
/*
@ -722,7 +723,7 @@ isc_entropy_getdata(isc_entropy_t *ent, void *data, unsigned int length,
isc_sha1_init(&hash);
isc_sha1_update(&hash, (void *)(ent->pool.pool),
RND_POOLWORDS * 4);
RND_POOLBYTES);
isc_sha1_final(&hash, digest);
/*
@ -772,7 +773,7 @@ isc_entropypool_init(isc_entropypool_t *pool) {
pool->entropy = 0;
pool->pseudo = 0;
pool->rotate = 0;
memset(pool->pool, 0, RND_POOLWORDS);
memset(pool->pool, 0, RND_POOLBYTES);
}
static void
@ -781,7 +782,7 @@ isc_entropypool_invalidate(isc_entropypool_t *pool) {
pool->entropy = 0;
pool->pseudo = 0;
pool->rotate = 0;
memset(pool->pool, 0, RND_POOLWORDS);
memset(pool->pool, 0, RND_POOLBYTES);
}
isc_result_t