diff options
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r-- | ssh-keyscan.c | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 1f95239a3..3231ee342 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keyscan.c,v 1.109 2017/03/10 04:26:06 djm Exp $ */ | 1 | /* $OpenBSD: ssh-keyscan.c,v 1.110 2017/04/30 23:10:43 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. | 3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
4 | * | 4 | * |
@@ -187,52 +187,6 @@ strnnsep(char **stringp, char *delim) | |||
187 | return (tok); | 187 | return (tok); |
188 | } | 188 | } |
189 | 189 | ||
190 | #ifdef WITH_SSH1 | ||
191 | static struct sshkey * | ||
192 | keygrab_ssh1(con *c) | ||
193 | { | ||
194 | static struct sshkey *rsa; | ||
195 | static struct sshbuf *msg; | ||
196 | int r; | ||
197 | u_char type; | ||
198 | |||
199 | if (rsa == NULL) { | ||
200 | if ((rsa = sshkey_new(KEY_RSA1)) == NULL) { | ||
201 | error("%s: sshkey_new failed", __func__); | ||
202 | return NULL; | ||
203 | } | ||
204 | if ((msg = sshbuf_new()) == NULL) | ||
205 | fatal("%s: sshbuf_new failed", __func__); | ||
206 | } | ||
207 | if ((r = sshbuf_put(msg, c->c_data, c->c_plen)) != 0 || | ||
208 | (r = sshbuf_consume(msg, 8 - (c->c_plen & 7))) != 0 || /* padding */ | ||
209 | (r = sshbuf_get_u8(msg, &type)) != 0) | ||
210 | goto buf_err; | ||
211 | if (type != (int) SSH_SMSG_PUBLIC_KEY) { | ||
212 | error("%s: invalid packet type", c->c_name); | ||
213 | sshbuf_reset(msg); | ||
214 | return NULL; | ||
215 | } | ||
216 | if ((r = sshbuf_consume(msg, 8)) != 0 || /* cookie */ | ||
217 | /* server key */ | ||
218 | (r = sshbuf_get_u32(msg, NULL)) != 0 || | ||
219 | (r = sshbuf_get_bignum1(msg, NULL)) != 0 || | ||
220 | (r = sshbuf_get_bignum1(msg, NULL)) != 0 || | ||
221 | /* host key */ | ||
222 | (r = sshbuf_get_u32(msg, NULL)) != 0 || | ||
223 | (r = sshbuf_get_bignum1(msg, rsa->rsa->e)) != 0 || | ||
224 | (r = sshbuf_get_bignum1(msg, rsa->rsa->n)) != 0) { | ||
225 | buf_err: | ||
226 | error("%s: buffer error: %s", __func__, ssh_err(r)); | ||
227 | sshbuf_reset(msg); | ||
228 | return NULL; | ||
229 | } | ||
230 | |||
231 | sshbuf_reset(msg); | ||
232 | |||
233 | return (rsa); | ||
234 | } | ||
235 | #endif | ||
236 | 190 | ||
237 | static int | 191 | static int |
238 | key_print_wrapper(struct sshkey *hostkey, struct ssh *ssh) | 192 | key_print_wrapper(struct sshkey *hostkey, struct ssh *ssh) |
@@ -585,12 +539,6 @@ conread(int s) | |||
585 | c->c_data = xmalloc(c->c_len); | 539 | c->c_data = xmalloc(c->c_len); |
586 | c->c_status = CS_KEYS; | 540 | c->c_status = CS_KEYS; |
587 | break; | 541 | break; |
588 | #ifdef WITH_SSH1 | ||
589 | case CS_KEYS: | ||
590 | keyprint(c, keygrab_ssh1(c)); | ||
591 | confree(s); | ||
592 | return; | ||
593 | #endif | ||
594 | default: | 542 | default: |
595 | fatal("conread: invalid status %d", c->c_status); | 543 | fatal("conread: invalid status %d", c->c_status); |
596 | break; | 544 | break; |
@@ -756,11 +704,6 @@ main(int argc, char **argv) | |||
756 | int type = sshkey_type_from_name(tname); | 704 | int type = sshkey_type_from_name(tname); |
757 | 705 | ||
758 | switch (type) { | 706 | switch (type) { |
759 | #ifdef WITH_SSH1 | ||
760 | case KEY_RSA1: | ||
761 | get_keytypes |= KT_RSA1; | ||
762 | break; | ||
763 | #endif | ||
764 | case KEY_DSA: | 707 | case KEY_DSA: |
765 | get_keytypes |= KT_DSA; | 708 | get_keytypes |= KT_DSA; |
766 | break; | 709 | break; |