-typo
[oweals/gnunet.git] / src / util / gnunet-rsa.c
index 61e1b66dffa71f52af562b5caf3386fef4dbd65f..e9fbf15dffcbc6af6284bdd578d5311920697dfd 100644 (file)
@@ -43,6 +43,11 @@ static int print_peer_identity;
  */
 static int print_short_identity;
 
+/**
+ * Use weak random number generator for key generation.
+ */
+static int weak_random;
+
 
 /**
  * The private information of an RSA key pair.
@@ -104,6 +109,8 @@ run (void *cls, char *const *args, const char *cfgfile,
     fprintf (stderr, _("No hostkey file specified on command line\n"));
     return;
   }
+  if (0 != weak_random)    
+    GNUNET_CRYPTO_random_disable_entropy_gathering ();  
   pk = GNUNET_CRYPTO_rsa_key_create_from_file (args[0]);
   if (NULL == pk)
     return;
@@ -159,6 +166,9 @@ main (int argc, char *const *argv)
     { 's', "print-short-identity", NULL,
       gettext_noop ("print the short hash of the public key in ASCII format"),
       0, &GNUNET_GETOPT_set_one, &print_short_identity },
+    { 'w', "weak-random", NULL,
+      gettext_noop ("use insecure, weak random number generator for key generation (for testing only)"),
+      0, &GNUNET_GETOPT_set_one, &weak_random },
     GNUNET_GETOPT_OPTION_END
   };