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 79438611f284abd48e54b000a54afb6532d3f3ef..ce901759db14bd376ce604cc9a2ac74e67b6138b 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);