summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/kexc25519s.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2019-01-21 10:05:10 +0000
committerDamien Miller <djm@cvs.openbsd.org>2019-01-21 10:05:10 +0000
commit13d057d5895866631bfd8774df1a8a572b12b015 (patch)
treed2c74c63ac45b5d949dd20b46b31f9640a16a2e9 /usr.bin/ssh/kexc25519s.c
parent43635f27e001110681c24e119e3f9c71205eb72c (diff)
factor out kex_load_hostkey() - this is duplicated in both the client and
server implementations for most KEX methods. from markus@ ok djm@
Diffstat (limited to 'usr.bin/ssh/kexc25519s.c')
-rw-r--r--usr.bin/ssh/kexc25519s.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.bin/ssh/kexc25519s.c b/usr.bin/ssh/kexc25519s.c
index 7d537fb711d..8446cce6159 100644
--- a/usr.bin/ssh/kexc25519s.c
+++ b/usr.bin/ssh/kexc25519s.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kexc25519s.c,v 1.14 2019/01/21 09:55:52 djm Exp $ */
+/* $OpenBSD: kexc25519s.c,v 1.15 2019/01/21 10:05:09 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -68,20 +68,9 @@ input_kex_c25519_init(int type, u_int32_t seq, struct ssh *ssh)
#ifdef DEBUG_KEXECDH
dump_digest("server private key:", server_key, sizeof(server_key));
#endif
- if (kex->load_host_public_key == NULL ||
- kex->load_host_private_key == NULL) {
- r = SSH_ERR_INVALID_ARGUMENT;
+ if ((r = kex_load_hostkey(ssh, &server_host_private,
+ &server_host_public)) != 0)
goto out;
- }
- server_host_public = kex->load_host_public_key(kex->hostkey_type,
- kex->hostkey_nid, ssh);
- server_host_private = kex->load_host_private_key(kex->hostkey_type,
- kex->hostkey_nid, ssh);
- if (server_host_public == NULL) {
- r = SSH_ERR_NO_HOSTKEY_LOADED;
- goto out;
- }
-
if ((r = sshpkt_get_string(ssh, &client_pubkey, &pklen)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
goto out;