summaryrefslogtreecommitdiff
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
parent8f9d5073d8bed2c15843eb0c374b70b4c9486605 (diff)
Added key generation progress meter
-rw-r--r--rsa.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/rsa.c b/rsa.c
index ab4859563..5e7297be0 100644
--- a/rsa.c
+++ b/rsa.c
@@ -35,7 +35,7 @@
35*/ 35*/
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$Id: rsa.c,v 1.5 1999/11/25 00:54:59 damien Exp $"); 38RCSID("$Id: rsa.c,v 1.6 1999/12/17 03:02:47 damien Exp $");
39 39
40#include "rsa.h" 40#include "rsa.h"
41#include "ssh.h" 41#include "ssh.h"
@@ -56,6 +56,21 @@ rsa_alive()
56} 56}
57 57
58/* 58/*
59 * Key generation progress meter callback
60 */
61void
62keygen_progress(int p, int n, void *arg)
63{
64 const char progress_chars[] = ".o+O?";
65
66 if ((p < 0) || (p > (sizeof(progress_chars) - 2)))
67 p = 4;
68
69 printf("%c", progress_chars[p]);
70 fflush(stdout);
71}
72
73/*
59 * Generates RSA public and private keys. This initializes the data 74 * Generates RSA public and private keys. This initializes the data
60 * structures; they should be freed with rsa_clear_private_key and 75 * structures; they should be freed with rsa_clear_private_key and
61 * rsa_clear_public_key. 76 * rsa_clear_public_key.
@@ -69,8 +84,11 @@ rsa_generate_key(RSA *prv, RSA *pub, unsigned int bits)
69 if (rsa_verbose) { 84 if (rsa_verbose) {
70 printf("Generating RSA keys: "); 85 printf("Generating RSA keys: ");
71 fflush(stdout); 86 fflush(stdout);
87 key = RSA_generate_key(bits, 35, keygen_progress, NULL);
88 printf("\n");
89 } else {
90 key = RSA_generate_key(bits, 35, NULL, NULL);
72 } 91 }
73 key = RSA_generate_key(bits, 35, NULL, NULL);
74 if (key == NULL) 92 if (key == NULL)
75 fatal("rsa_generate_key: key generation failed."); 93 fatal("rsa_generate_key: key generation failed.");
76 94