Progress meter for ssh-keygen

Damien Miller djm at mindrot.org
Thu Dec 16 14:22:23 EST 1999


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Attached is a patch to add a progress meter for ssh-keygen similar
to the one in the commercial ssh1.

Was this left out of the OpenBSD version because of security 
concerns?

Regards,
Damien Miller

- --
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.mindrot.org/
| Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE4WFr1ormJ9RG1dI8RAjYoAJ99bJwtjL7dKwrZhat9FAUj4nEUlwCgqvZ/
tFU5SXFtgbOsFx8gFlEdd8s=
=20cA
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: rsa.c
===================================================================
RCS file: /var/cvs/openssh/rsa.c,v
retrieving revision 1.5
diff -u -r1.5 rsa.c
--- rsa.c	1999/11/25 00:54:59	1.5
+++ rsa.c	1999/12/16 03:19:38
@@ -56,6 +56,21 @@
 }
 
 /*
+ * 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 @@
 	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.");
 


More information about the openssh-unix-dev mailing list