summaryrefslogtreecommitdiff
path: root/kexecdhc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-01-21 10:07:22 +0000
committerDamien Miller <djm@mindrot.org>2019-01-21 21:47:28 +1100
commitb1b2ff4ed559051d1035419f8f236275fa66d5d6 (patch)
tree53b2dbcf3540076c1effe3ce82c613c7fe23c58c /kexecdhc.c
parentbb39bafb6dc520cc097780f4611a52da7f19c3e2 (diff)
upstream: factor out kex_verify_hostkey() - again, duplicated
almost exactly across client and server for several KEX methods. from markus@ ok djm@ OpenBSD-Commit-ID: 4e4a16d949dadde002a0aacf6d280a684e20829c
Diffstat (limited to 'kexecdhc.c')
-rw-r--r--kexecdhc.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/kexecdhc.c b/kexecdhc.c
index 2cff3434..bfb9f470 100644
--- a/kexecdhc.c
+++ b/kexecdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kexecdhc.c,v 1.15 2019/01/21 09:55:52 djm Exp $ */
+/* $OpenBSD: kexecdhc.c,v 1.16 2019/01/21 10:07:22 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -109,10 +109,6 @@ input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh)
size_t klen = 0, hashlen;
int r;
- if (kex->verify_host_key == NULL) {
- r = SSH_ERR_INVALID_ARGUMENT;
- goto out;
- }
group = kex->ec_group;
client_key = kex->ec_client_key;
@@ -122,16 +118,8 @@ input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh)
(r = sshkey_from_blob(server_host_key_blob, sbloblen,
&server_host_key)) != 0)
goto out;
- if (server_host_key->type != kex->hostkey_type ||
- (kex->hostkey_type == KEY_ECDSA &&
- server_host_key->ecdsa_nid != kex->hostkey_nid)) {
- r = SSH_ERR_KEY_TYPE_MISMATCH;
+ if ((r = kex_verify_host_key(ssh, server_host_key)) != 0)
goto out;
- }
- if (kex->verify_host_key(server_host_key, ssh) == -1) {
- r = SSH_ERR_SIGNATURE_INVALID;
- goto out;
- }
/* Q_S, server public key */
/* signed H */