Another occurance of possible valgrind/purify "uninitialized memory"
authorLutz Jänicke <jaenicke@openssl.org>
Fri, 16 May 2008 07:14:26 +0000 (07:14 +0000)
committerLutz Jänicke <jaenicke@openssl.org>
Fri, 16 May 2008 07:14:26 +0000 (07:14 +0000)
complaint related to the PRNG: with PURIFY policy don't feed uninitialized
memory into the PRNG.

Submitted by: Bodo Moeller <bmoeller@openssl.org> :-)

crypto/rand/randfile.c

index 43053b19bf8679b878d026760e5d5877fb715519..7468eaa578484f34950ad9d9eb908f2b4174968a 100644 (file)
@@ -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)
                        {