Mix the noise from the key timings with some other environmental noise
authormdw <mdw>
Wed, 17 Sep 1997 15:29:28 +0000 (15:29 +0000)
committermdw <mdw>
Wed, 17 Sep 1997 15:29:28 +0000 (15:29 +0000)
(obtained from `noise_acquire') for a little bit more randomness.

src/keygen.c

index f1b0abe..eba38d9 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: keygen.c,v 1.2 1997/08/04 10:24:23 mdw Exp $
+ * $Id: keygen.c,v 1.3 1997/09/17 15:29:28 mdw Exp $
  *
  * Key generation
  *
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: keygen.c,v $
+ * Revision 1.3  1997/09/17 15:29:28  mdw
+ * Mix the noise from the key timings with some other environmental noise
+ * (obtained from `noise_acquire') for a little bit more randomness.
+ *
  * Revision 1.2  1997/08/04 10:24:23  mdw
  * Sources placed under CVS control.
  *
 /* --- Local headers --- */
 
 #include "config.h"
-#include "tx.h"
 #include "mdwopt.h"
+#include "noise.h"
+#include "rand.h"
+#include "tx.h"
 #include "utils.h"
 
 /*----- Static variables --------------------------------------------------*/
@@ -567,6 +573,14 @@ int main(int argc, char *argv[])
   kg__gen(uip, sz);
   kg__crepair();
 
+  /* --- Find some noise from the environment too --- */
+
+  rand_clear();
+  noise_acquire();
+  rand_add(uip, sz / 8);
+  rand_churn();
+  rand_extract(uip, sz / 8);
+
   /* --- Now write the number and exit --- */
 
   D( fputs("*** ", fp); tx_putBits(uip, sz, stdout); )
@@ -574,6 +588,7 @@ int main(int argc, char *argv[])
   if (file)
     fclose(fp);
   memset(uip, 0, sz / 8);              /* Burn temporary buffer */
+  rand_clear();
   return (0);
 }