summaryrefslogtreecommitdiff
path: root/kexgexc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-01-26 06:10:03 +0000
committerDamien Miller <djm@mindrot.org>2015-01-27 00:00:57 +1100
commit5104db7cbd6cdd9c5971f4358e74414862fc1022 (patch)
tree94692c77a4888f8adade706324fdee3a999bc6b0 /kexgexc.c
parent8d4f87258f31cb6def9b3b55b6a7321d84728ff2 (diff)
upstream commit
correctly match ECDSA subtype (== curve) for offered/recevied host keys. Fixes connection-killing host key mismatches when a server offers multiple ECDSA keys with different curve type (an extremely unlikely configuration). ok markus, "looks mechanical" deraadt@
Diffstat (limited to 'kexgexc.c')
-rw-r--r--kexgexc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kexgexc.c b/kexgexc.c
index 0898824f3..e8e059a88 100644
--- a/kexgexc.c
+++ b/kexgexc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexgexc.c,v 1.19 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: kexgexc.c,v 1.20 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -176,6 +176,12 @@ input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt)
176 r = SSH_ERR_KEY_TYPE_MISMATCH; 176 r = SSH_ERR_KEY_TYPE_MISMATCH;
177 goto out; 177 goto out;
178 } 178 }
179 if (server_host_key->type != kex->hostkey_type ||
180 (kex->hostkey_type == KEY_ECDSA &&
181 server_host_key->ecdsa_nid != kex->hostkey_nid)) {
182 r = SSH_ERR_KEY_TYPE_MISMATCH;
183 goto out;
184 }
179 if (kex->verify_host_key(server_host_key, ssh) == -1) { 185 if (kex->verify_host_key(server_host_key, ssh) == -1) {
180 r = SSH_ERR_SIGNATURE_INVALID; 186 r = SSH_ERR_SIGNATURE_INVALID;
181 goto out; 187 goto out;