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 /kexgexs.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 'kexgexs.c')
-rw-r--r-- | kexgexs.c | 16 |
1 files changed, 3 insertions, 13 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexgexs.c,v 1.40 2019/01/21 10:03:37 djm Exp $ */ | 1 | /* $OpenBSD: kexgexs.c,v 1.41 2019/01/21 10:05:09 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. |
@@ -136,19 +136,9 @@ input_kex_dh_gex_init(int type, u_int32_t seq, struct ssh *ssh) | |||
136 | size_t hashlen; | 136 | size_t hashlen; |
137 | int r; | 137 | int r; |
138 | 138 | ||
139 | if (kex->load_host_public_key == NULL || | 139 | if ((r = kex_load_hostkey(ssh, &server_host_private, |
140 | kex->load_host_private_key == NULL) { | 140 | &server_host_public)) != 0) |
141 | r = SSH_ERR_INVALID_ARGUMENT; | ||
142 | goto out; | 141 | goto out; |
143 | } | ||
144 | server_host_public = kex->load_host_public_key(kex->hostkey_type, | ||
145 | kex->hostkey_nid, ssh); | ||
146 | server_host_private = kex->load_host_private_key(kex->hostkey_type, | ||
147 | kex->hostkey_nid, ssh); | ||
148 | if (server_host_public == NULL) { | ||
149 | r = SSH_ERR_NO_HOSTKEY_LOADED; | ||
150 | goto out; | ||
151 | } | ||
152 | 142 | ||
153 | /* key, cert */ | 143 | /* key, cert */ |
154 | if ((r = sshpkt_get_bignum2(ssh, &dh_client_pub)) != 0 || | 144 | if ((r = sshpkt_get_bignum2(ssh, &dh_client_pub)) != 0 || |