summaryrefslogtreecommitdiff
path: root/ssh-rand-helper.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-03-17 16:13:53 +1100
committerDamien Miller <djm@mindrot.org>2003-03-17 16:13:53 +1100
commitcafbcc73349f4e14afed5207b81a1205afc2cee2 (patch)
tree5cca4638acb6fbaa67f84e1ac2a9f45d872e579b /ssh-rand-helper.c
parentc51d0735a4a68ddcd927f003ffb3fc917cb207c2 (diff)
- (djm) Fix return value checks for RAND_bytes. Report from
Steve G <linux_4ever@yahoo.com>
Diffstat (limited to 'ssh-rand-helper.c')
-rw-r--r--ssh-rand-helper.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c
index 375ba3cbf..68b77b208 100644
--- a/ssh-rand-helper.c
+++ b/ssh-rand-helper.c
@@ -39,7 +39,7 @@
#include "pathnames.h"
#include "log.h"
-RCSID("$Id: ssh-rand-helper.c,v 1.9 2002/10/21 00:13:37 djm Exp $");
+RCSID("$Id: ssh-rand-helper.c,v 1.10 2003/03/17 05:13:53 djm Exp $");
/* Number of bytes we write out */
#define OUTPUT_SEED_SIZE 48
@@ -562,7 +562,8 @@ prng_write_seedfile(void)
debug("writing PRNG seed to file %.100s", filename);
- RAND_bytes(seed, sizeof(seed));
+ if (RAND_bytes(seed, sizeof(seed)) <= 0)
+ fatal("PRNG seed extration failed");
/* Don't care if the seed doesn't exist */
prng_check_seedfile(filename);
@@ -849,7 +850,8 @@ main(int argc, char **argv)
if (!RAND_status())
fatal("Not enough entropy in RNG");
- RAND_bytes(buf, bytes);
+ if (RAND_bytes(buf, bytes) <= 0)
+ fatal("Couldn't extract entropy from PRNG");
if (output_hex) {
for(ret = 0; ret < bytes; ret++)