diff options
Diffstat (limited to 'crypto/rand/randfile.c')
| -rw-r--r-- | crypto/rand/randfile.c | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index d69bdf8b8a04..6c0ec9a41cdf 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -102,10 +102,8 @@ int RAND_load_file(const char *file, long bytes)  	if (file == NULL) return(0); -	i=stat(file,&sb); -	/* If the state fails, put some crap in anyway */ +	if (stat(file,&sb) < 0) return(0);  	RAND_add(&sb,sizeof(sb),0.0); -	if (i < 0) return(0);  	if (bytes == 0) return(ret);  	in=fopen(file,"rb"); @@ -128,8 +126,12 @@ int RAND_load_file(const char *file, long bytes)  			n = BUFSIZE;  		i=fread(buf,1,n,in);  		if (i <= 0) break; +#ifdef PURIFY +		RAND_add(buf,i,(double)i); +#else  		/* even if n != i, use the full array */  		RAND_add(buf,n,(double)i); +#endif  		ret+=i;  		if (bytes > 0)  			{ | 
