From 2f878669b7d1a22e52fa8ab86cf6a6095a9fad03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodo=20M=C3=B6ller?= Date: Fri, 14 Jan 2000 09:08:39 +0000 Subject: [PATCH] Avoid shadowing variables, and re-enable seeding with more data than read from DEVRANDOM -- just don't pretend it contains entropy. --- crypto/rand/md_rand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index 5eef93d4bd..dbed1dcde2 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -144,7 +144,7 @@ const char *RAND_version="RAND" OPENSSL_VERSION_PTEXT; static void ssleay_rand_cleanup(void); static void ssleay_rand_seed(const void *buf, int num); -static void ssleay_rand_add(const void *buf, int num, int entropy); +static void ssleay_rand_add(const void *buf, int num, int add_entropy); static int ssleay_rand_bytes(unsigned char *buf, int num); RAND_METHOD rand_ssleay_meth={ @@ -361,12 +361,12 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) if ((fh = fopen(DEVRANDOM, "r")) != NULL) { unsigned char tmpbuf[ENTROPY_NEEDED]; - int i; + int n; - i=fread((unsigned char *)tmpbuf,1,ENTROPY_NEEDED,fh); + n=fread((unsigned char *)tmpbuf,1,ENTROPY_NEEDED,fh); fclose(fh); - RAND_seed(tmpbuf,i); - memset(tmpbuf,0,i); + RAND_add(tmpbuf,sizeof tmpbuf,n); + memset(tmpbuf,0,n); } #endif #ifdef PURIFY