summaryrefslogtreecommitdiffstats
path: root/crypto/rand/rand_lib.c
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2000-01-13 20:59:17 +0000
committerUlf Möller <ulf@openssl.org>2000-01-13 20:59:17 +0000
commiteb952088f0d5da59e569ae2aa33e9b96bc3b586d (patch)
tree1d722a423148a6b568a1e6d42f01943aed6cfb2a /crypto/rand/rand_lib.c
parent22e219d90f1ea5d3b2f4abb72c846a436ea33eff (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/rand_lib.c')
-rw-r--r--crypto/rand/rand_lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index 0f96e166e5..3cdba48ba8 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -89,9 +89,16 @@ void RAND_seed(const void *buf, int num)
rand_meth->seed(buf,num);
}
-void RAND_bytes(unsigned char *buf, int num)
+void RAND_add(const void *buf, int num, int entropy)
{
if (rand_meth != NULL)
- rand_meth->bytes(buf,num);
+ rand_meth->add(buf,num,entropy);
+ }
+
+int RAND_bytes(unsigned char *buf, int num)
+ {
+ if (rand_meth != NULL)
+ return rand_meth->bytes(buf,num);
+ return(-1);
}