aboutsummaryrefslogtreecommitdiff
path: root/crypto/rand/randfile.c
diff options
context:
space:
mode:
authorLutz Jänicke <jaenicke@openssl.org>2008-05-16 07:14:26 +0000
committerLutz Jänicke <jaenicke@openssl.org>2008-05-16 07:14:26 +0000
commit8b99c79fae22f93319443d0bec7068dbc6dca968 (patch)
tree90bb6f53aabb61be8b27d44948555f092a13327b /crypto/rand/randfile.c
parent718f8f7a9e981cf9a7f3aaa4ba9e013151384d06 (diff)
downloadopenssl-8b99c79fae22f93319443d0bec7068dbc6dca968.zip
openssl-8b99c79fae22f93319443d0bec7068dbc6dca968.tar.gz
openssl-8b99c79fae22f93319443d0bec7068dbc6dca968.tar.bz2
Another occurance of possible valgrind/purify "uninitialized memory"
complaint related to the PRNG: with PURIFY policy don't feed uninitialized memory into the PRNG. Submitted by: Bodo Moeller <bmoeller@openssl.org> :-)
Diffstat (limited to 'crypto/rand/randfile.c')
-rw-r--r--crypto/rand/randfile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index 43053b1..7468eaa 100644
--- a/crypto/rand/randfile.c
+++ b/crypto/rand/randfile.c
@@ -129,7 +129,11 @@ int RAND_load_file(const char *file, long bytes)
i=fread(buf,1,n,in);
if (i <= 0) break;
/* even if n != i, use the full array */
+#ifdef PURIFY
+ RAND_add(buf,i,(double)i);
+#else
RAND_add(buf,n,(double)i);
+#endif
ret+=i;
if (bytes > 0)
{