diff options
author | Ulf Möller <ulf@openssl.org> | 2000-01-13 20:59:17 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2000-01-13 20:59:17 +0000 |
commit | eb952088f0d5da59e569ae2aa33e9b96bc3b586d (patch) | |
tree | 1d722a423148a6b568a1e6d42f01943aed6cfb2a /crypto/rand/randfile.c | |
parent | 22e219d90f1ea5d3b2f4abb72c846a436ea33eff (diff) |
Precautions against using the PRNG uninitialized: RAND_bytes() now
returns int (1 = ok, 0 = not seeded). New function RAND_add() is the
same as RAND_seed() but takes an estimate of the entropy as an additional
argument.
Diffstat (limited to 'crypto/rand/randfile.c')
-rw-r--r-- | crypto/rand/randfile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 942a963e83..97c3ece535 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -91,7 +91,7 @@ int RAND_load_file(const char *file, long bytes) i=stat(file,&sb); /* If the state fails, put some crap in anyway */ - RAND_seed(&sb,sizeof(sb)); + RAND_add(&sb,sizeof(sb),0); ret+=sizeof(sb); if (i < 0) return(0); if (bytes <= 0) return(ret); @@ -104,7 +104,7 @@ 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 */ - RAND_seed(buf,n); + RAND_add(buf,n,i); ret+=i; bytes-=n; if (bytes <= 0) break; |