]> andersk Git - openssh.git/commitdiff
Added key generation progress meter
authordamien <damien>
Fri, 17 Dec 1999 03:02:47 +0000 (03:02 +0000)
committerdamien <damien>
Fri, 17 Dec 1999 03:02:47 +0000 (03:02 +0000)
rsa.c

diff --git a/rsa.c b/rsa.c
index e4827512dbb48411564a21554180cf4a500e0dc4..54039b385e00ab830abe92bd211b011ed1580051 100644 (file)
--- a/rsa.c
+++ b/rsa.c
@@ -55,6 +55,21 @@ rsa_alive()
        return (1);
 }
 
+/*
+ * 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
@@ -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.");
 
This page took 0.077018 seconds and 5 git commands to generate.