summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-06-23 17:05:23 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-06-23 17:05:23 +0000
commitecb635bf3e0ca36556871fec476030cd66be1c9e (patch)
tree06703c51e8a1cc2f9ab3ae4149ebf7a46a5b1b2e
parent568e9456f5cfd4e0de7462ff5f47369ed0085bd8 (diff)
fix import for (broken?) ssh.com/f-secure private keys
(i tested > 1000 RSA keys)
-rw-r--r--usr.bin/ssh/ssh-keygen.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index 5e122aef906..b407dbe12e4 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.63 2001/06/23 15:12:20 itojun Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.64 2001/06/23 17:05:22 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -183,9 +183,11 @@ do_convert_private_ssh2_from_blob(char *blob, int blen)
{
Buffer b;
Key *key = NULL;
+ char *type, *cipher;
+ u_char *sig, data[10] = "abcde12345";
int magic, rlen, ktype, i1, i2, i3, i4;
+ u_int slen;
u_long e;
- char *type, *cipher;
buffer_init(&b);
buffer_append(&b, blob, blen);
@@ -260,16 +262,11 @@ do_convert_private_ssh2_from_blob(char *blob, int blen)
error("do_convert_private_ssh2_from_blob: "
"remaining bytes in key blob %d", rlen);
buffer_free(&b);
-#ifdef DEBUG_PK
- {
- u_int slen;
- u_char *sig, data[10] = "abcde12345";
- key_sign(key, &sig, &slen, data, sizeof(data));
- key_verify(key, sig, slen, data, sizeof(data));
- xfree(sig);
- }
-#endif
+ /* try the key */
+ key_sign(key, &sig, &slen, data, sizeof(data));
+ key_verify(key, sig, slen, data, sizeof(data));
+ xfree(sig);
return key;
}
@@ -308,6 +305,9 @@ do_convert_from_ssh2(struct passwd *pw)
strstr(line, ": ") != NULL) {
if (strstr(line, SSH_COM_PRIVATE_BEGIN) != NULL)
private = 1;
+ if (strstr(line, " END ") != NULL) {
+ break;
+ }
/* fprintf(stderr, "ignore: %s", line); */
continue;
}