diff options
author | djm <> | 2008-09-06 12:17:54 +0000 |
---|---|---|
committer | djm <> | 2008-09-06 12:17:54 +0000 |
commit | 38ce604e3cc97706b876b0525ddff0121115456d (patch) | |
tree | 7ccc28afe1789ea3dbedf72365f955d5b8e105b5 /src/lib/libcrypto/rand/randfile.c | |
parent | 12867252827c8efaa8ddd1fa3b3d6e321e2bcdef (diff) | |
download | openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.gz openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.bz2 openbsd-38ce604e3cc97706b876b0525ddff0121115456d.zip |
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/rand/randfile.c')
-rw-r--r-- | src/lib/libcrypto/rand/randfile.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index d847d8ebdf..005cb38cb0 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
@@ -102,10 +102,8 @@ int RAND_load_file(const char *file, long bytes) | |||
102 | 102 | ||
103 | if (file == NULL) return(0); | 103 | if (file == NULL) return(0); |
104 | 104 | ||
105 | i=stat(file,&sb); | 105 | if (stat(file,&sb) < 0) return(0); |
106 | /* If the state fails, put some crap in anyway */ | 106 | RAND_add(&sb,sizeof(sb),0.0); |
107 | RAND_add(&sb,sizeof(sb),0); | ||
108 | if (i < 0) return(0); | ||
109 | if (bytes == 0) return(ret); | 107 | if (bytes == 0) return(ret); |
110 | 108 | ||
111 | in=fopen(file,"rb"); | 109 | in=fopen(file,"rb"); |
@@ -128,8 +126,12 @@ int RAND_load_file(const char *file, long bytes) | |||
128 | n = BUFSIZE; | 126 | n = BUFSIZE; |
129 | i=fread(buf,1,n,in); | 127 | i=fread(buf,1,n,in); |
130 | if (i <= 0) break; | 128 | if (i <= 0) break; |
129 | #ifdef PURIFY | ||
130 | RAND_add(buf,i,(double)i); | ||
131 | #else | ||
131 | /* even if n != i, use the full array */ | 132 | /* even if n != i, use the full array */ |
132 | RAND_add(buf,n,i); | 133 | RAND_add(buf,n,(double)i); |
134 | #endif | ||
133 | ret+=i; | 135 | ret+=i; |
134 | if (bytes > 0) | 136 | if (bytes > 0) |
135 | { | 137 | { |