diff options
Diffstat (limited to 'kexecdhc.c')
-rw-r--r-- | kexecdhc.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/kexecdhc.c b/kexecdhc.c index d8a8b660f..ac146a362 100644 --- a/kexecdhc.c +++ b/kexecdhc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexecdhc.c,v 1.11 2017/05/30 14:23:52 markus Exp $ */ | 1 | /* $OpenBSD: kexecdhc.c,v 1.13 2018/02/07 02:06:51 jsing 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,8 +89,7 @@ kexecdh_client(struct ssh *ssh) | |||
89 | ssh_dispatch_set(ssh, SSH2_MSG_KEX_ECDH_REPLY, &input_kex_ecdh_reply); | 89 | ssh_dispatch_set(ssh, SSH2_MSG_KEX_ECDH_REPLY, &input_kex_ecdh_reply); |
90 | r = 0; | 90 | r = 0; |
91 | out: | 91 | out: |
92 | if (client_key) | 92 | EC_KEY_free(client_key); |
93 | EC_KEY_free(client_key); | ||
94 | return r; | 93 | return r; |
95 | } | 94 | } |
96 | 95 | ||
@@ -188,7 +187,7 @@ input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh) | |||
188 | goto out; | 187 | goto out; |
189 | 188 | ||
190 | if ((r = sshkey_verify(server_host_key, signature, slen, hash, | 189 | if ((r = sshkey_verify(server_host_key, signature, slen, hash, |
191 | hashlen, ssh->compat)) != 0) | 190 | hashlen, kex->hostkey_alg, ssh->compat)) != 0) |
192 | goto out; | 191 | goto out; |
193 | 192 | ||
194 | /* save session id */ | 193 | /* save session id */ |
@@ -206,18 +205,14 @@ input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh) | |||
206 | r = kex_send_newkeys(ssh); | 205 | r = kex_send_newkeys(ssh); |
207 | out: | 206 | out: |
208 | explicit_bzero(hash, sizeof(hash)); | 207 | explicit_bzero(hash, sizeof(hash)); |
209 | if (kex->ec_client_key) { | 208 | EC_KEY_free(kex->ec_client_key); |
210 | EC_KEY_free(kex->ec_client_key); | 209 | kex->ec_client_key = NULL; |
211 | kex->ec_client_key = NULL; | 210 | EC_POINT_clear_free(server_public); |
212 | } | ||
213 | if (server_public) | ||
214 | EC_POINT_clear_free(server_public); | ||
215 | if (kbuf) { | 211 | if (kbuf) { |
216 | explicit_bzero(kbuf, klen); | 212 | explicit_bzero(kbuf, klen); |
217 | free(kbuf); | 213 | free(kbuf); |
218 | } | 214 | } |
219 | if (shared_secret) | 215 | BN_clear_free(shared_secret); |
220 | BN_clear_free(shared_secret); | ||
221 | sshkey_free(server_host_key); | 216 | sshkey_free(server_host_key); |
222 | free(server_host_key_blob); | 217 | free(server_host_key_blob); |
223 | free(signature); | 218 | free(signature); |