summaryrefslogtreecommitdiffstats
path: root/rsa.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-12-17 14:02:47 +1100
committerDamien Miller <djm@mindrot.org>1999-12-17 14:02:47 +1100
commitfdb5f13c5b5e73dffd50dbf61a37bf3aeb3e5fae (patch)
tree66bb9e00d0b89abade1efdb4c603c220381622fe /rsa.c
parent8f9d5073d8bed2c15843eb0c374b70b4c9486605 (diff)
Added key generation progress meter
Diffstat (limited to 'rsa.c')
-rw-r--r--rsa.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/rsa.c b/rsa.c
index ab485956..5e7297be 100644
--- a/rsa.c
+++ b/rsa.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$Id: rsa.c,v 1.5 1999/11/25 00:54:59 damien Exp $");
+RCSID("$Id: rsa.c,v 1.6 1999/12/17 03:02:47 damien Exp $");
#include "rsa.h"
#include "ssh.h"
@@ -56,6 +56,21 @@ rsa_alive()
}
/*
+ * Key generation progress meter callback
+ */
+void
+keygen_progress(int p, int n, void *arg)
+{
+ const char progress_chars[] = ".o+O?";
+
+ if ((p < 0) || (p > (sizeof(progress_chars) - 2)))
+ p = 4;
+
+ printf("%c", progress_chars[p]);
+ fflush(stdout);
+}
+
+/*
* Generates RSA public and private keys. This initializes the data
* structures; they should be freed with rsa_clear_private_key and
* rsa_clear_public_key.
@@ -69,8 +84,11 @@ rsa_generate_key(RSA *prv, RSA *pub, unsigned int bits)
if (rsa_verbose) {
printf("Generating RSA keys: ");
fflush(stdout);
+ key = RSA_generate_key(bits, 35, keygen_progress, NULL);
+ printf("\n");
+ } else {
+ key = RSA_generate_key(bits, 35, NULL, NULL);
}
- key = RSA_generate_key(bits, 35, NULL, NULL);
if (key == NULL)
fatal("rsa_generate_key: key generation failed.");