summaryrefslogtreecommitdiff
path: root/ssh-rand-helper.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-02-16 13:20:07 +1100
committerDarren Tucker <dtucker@zip.com.au>2005-02-16 13:20:07 +1100
commit7b48d25527c372a6a5017897c7617a05d5f1e68e (patch)
tree735731371dda9e1a0f35c11f9fee0e2de0f8dcf4 /ssh-rand-helper.c
parented462d9a4557a400266c43d13fd6fa0ec8c7d9ea (diff)
- (dtucker) [ssh-rand-helper.c] Provide seed_rng since it may be called
via mkstemp in some configurations. ok djm@
Diffstat (limited to 'ssh-rand-helper.c')
-rw-r--r--ssh-rand-helper.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c
index 6412d44e..4da62a72 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.21 2005/02/16 02:02:45 djm Exp $");
+RCSID("$Id: ssh-rand-helper.c,v 1.22 2005/02/16 02:20:07 dtucker Exp $");
/* Number of bytes we write out */
#define OUTPUT_SEED_SIZE 48
@@ -888,3 +888,15 @@ main(int argc, char **argv)
return ret == bytes ? 0 : 1;
}
+
+/*
+ * We may attempt to re-seed during mkstemp if we are using the one in the
+ * compat library (via mkstemp -> arc4random -> seed_rng) so we need
+ * our own seed_rng(). We must also check that we have enough entropy.
+ */
+void
+seed_rng(void)
+{
+ if (!RAND_status())
+ fatal("Not enough entropy in RNG");
+}