diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-01-21 10:05:09 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-01-21 21:47:28 +1100 |
commit | bb39bafb6dc520cc097780f4611a52da7f19c3e2 (patch) | |
tree | b5721488b62d4e8cc1ffa322ae659e5265a0c707 /kexecdhs.c | |
parent | dec5e9d33891e3bc3f1395d7db0e56fdc7f86dfc (diff) |
upstream: factor out kex_load_hostkey() - this is duplicated in
both the client and server implementations for most KEX methods.
from markus@ ok djm@
OpenBSD-Commit-ID: 8232fa7c21fbfbcaf838313b0c166dc6c8762f3c
Diffstat (limited to 'kexecdhs.c')
-rw-r--r-- | kexecdhs.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/kexecdhs.c b/kexecdhs.c index 4ba2072df..b9254eed7 100644 --- a/kexecdhs.c +++ b/kexecdhs.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexecdhs.c,v 1.20 2019/01/21 09:55:52 djm Exp $ */ | 1 | /* $OpenBSD: kexecdhs.c,v 1.21 2019/01/21 10:05:09 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2010 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2010 Damien Miller. All rights reserved. |
@@ -89,19 +89,9 @@ input_kex_ecdh_init(int type, u_int32_t seq, struct ssh *ssh) | |||
89 | sshkey_dump_ec_key(server_key); | 89 | sshkey_dump_ec_key(server_key); |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | if (kex->load_host_public_key == NULL || | 92 | if ((r = kex_load_hostkey(ssh, &server_host_private, |
93 | kex->load_host_private_key == NULL) { | 93 | &server_host_public)) != 0) |
94 | r = SSH_ERR_INVALID_ARGUMENT; | ||
95 | goto out; | 94 | goto out; |
96 | } | ||
97 | server_host_public = kex->load_host_public_key(kex->hostkey_type, | ||
98 | kex->hostkey_nid, ssh); | ||
99 | server_host_private = kex->load_host_private_key(kex->hostkey_type, | ||
100 | kex->hostkey_nid, ssh); | ||
101 | if (server_host_public == NULL) { | ||
102 | r = SSH_ERR_NO_HOSTKEY_LOADED; | ||
103 | goto out; | ||
104 | } | ||
105 | if ((client_public = EC_POINT_new(group)) == NULL) { | 95 | if ((client_public = EC_POINT_new(group)) == NULL) { |
106 | r = SSH_ERR_ALLOC_FAIL; | 96 | r = SSH_ERR_ALLOC_FAIL; |
107 | goto out; | 97 | goto out; |