Don't use buffered fread() to read from DEVRANDOM,
authorBodo Möller <bodo@openssl.org>
Thu, 24 Feb 2000 20:24:45 +0000 (20:24 +0000)
committerBodo Möller <bodo@openssl.org>
Thu, 24 Feb 2000 20:24:45 +0000 (20:24 +0000)
because this will drain the entropy pool.

crypto/rand/md_rand.c

index 7943861..ce90175 100644 (file)
@@ -327,6 +327,7 @@ static void ssleay_rand_initialize(void)
                unsigned char tmpbuf[ENTROPY_NEEDED];
                int n;
                
+               setvbuf(fh, NULL, _IONBF, 0);
                n=fread((unsigned char *)tmpbuf,1,ENTROPY_NEEDED,fh);
                fclose(fh);
                RAND_add(tmpbuf,sizeof tmpbuf,n);