projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Precautions against using the PRNG uninitialized: RAND_bytes() now
[openssl.git]
/
crypto
/
bn
/
bn_rand.c
diff --git
a/crypto/bn/bn_rand.c
b/crypto/bn/bn_rand.c
index 91b8e34ae65b364c03ed333c5f181ed6840c7aca..b567b43a6ff96ecd8b925b8a0d791f674db419dd 100644
(file)
--- a/
crypto/bn/bn_rand.c
+++ b/
crypto/bn/bn_rand.c
@@
-81,9
+81,10
@@
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
/* make a random number and set the top and bottom bits */
time(&tim);
- RAND_
seed(&tim,sizeof(tim)
);
+ RAND_
add(&tim,sizeof(tim),0
);
- RAND_bytes(buf,(int)bytes);
+ if (RAND_bytes(buf,(int)bytes) <= 0)
+ goto err;
if (top)
{
if (bit == 0)