aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/rand/randfile.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-01-27 19:13:33 +0100
committerEmilia Kasper <emilia@openssl.org>2016-01-29 16:33:13 +0100
commitd8ca44ba4158a9dafeaa30d3cba6f113904d2aa6 (patch)
tree96b3eb018ab876f0f8842ef909e709904b1168c3 /crypto/rand/randfile.c
parenta01dab94622715fe2dd92a6f87a826cef6724e54 (diff)
downloadopenssl-d8ca44ba4158a9dafeaa30d3cba6f113904d2aa6.tar.gz
Always DPURIFY
The use of the uninitialized buffer in the RNG has no real security benefits and is only a nuisance when using memory sanitizers. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Diffstat (limited to 'crypto/rand/randfile.c')
-rw-r--r--crypto/rand/randfile.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index 8490ec3340..1a06c4ecac 100644
--- a/crypto/rand/randfile.c
+++ b/crypto/rand/randfile.c
@@ -128,7 +128,6 @@ int RAND_load_file(const char *file, long bytes)
return (0);
#ifndef OPENSSL_NO_POSIX_IO
-# ifdef PURIFY
/*
* struct stat can have padding and unused fields that may not be
* initialized in the call to stat(). We need to clear the entire
@@ -136,7 +135,6 @@ int RAND_load_file(const char *file, long bytes)
* applications such as Valgrind.
*/
memset(&sb, 0, sizeof(sb));
-# endif
if (stat(file, &sb) < 0)
return (0);
RAND_add(&sb, sizeof(sb), 0.0);
@@ -170,12 +168,8 @@ int RAND_load_file(const char *file, long bytes)
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) {
bytes -= n;