summaryrefslogtreecommitdiff
path: root/kexecdhc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-01-21 09:55:52 +0000
committerDamien Miller <djm@mindrot.org>2019-01-21 21:47:28 +1100
commit5ae3f6d314465026d028af82609c1d49ad197655 (patch)
tree6fa154f6478dd9b35d90716573420f3c517c49ab /kexecdhc.c
parent7be8572b32a15d5c3dba897f252e2e04e991c307 (diff)
upstream: save the derived session id in kex_derive_keys() rather
than making each kex method implementation do it. from markus@ ok djm@ OpenBSD-Commit-ID: d61ade9c8d1e13f665f8663c552abff8c8a30673
Diffstat (limited to 'kexecdhc.c')
-rw-r--r--kexecdhc.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/kexecdhc.c b/kexecdhc.c
index af556dc58..2cff34347 100644
--- a/kexecdhc.c
+++ b/kexecdhc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexecdhc.c,v 1.14 2018/12/27 03:25:25 djm Exp $ */ 1/* $OpenBSD: kexecdhc.c,v 1.15 2019/01/21 09:55:52 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.
@@ -190,17 +190,6 @@ input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh)
190 hashlen, kex->hostkey_alg, ssh->compat)) != 0) 190 hashlen, kex->hostkey_alg, ssh->compat)) != 0)
191 goto out; 191 goto out;
192 192
193 /* save session id */
194 if (kex->session_id == NULL) {
195 kex->session_id_len = hashlen;
196 kex->session_id = malloc(kex->session_id_len);
197 if (kex->session_id == NULL) {
198 r = SSH_ERR_ALLOC_FAIL;
199 goto out;
200 }
201 memcpy(kex->session_id, hash, kex->session_id_len);
202 }
203
204 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0) 193 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
205 r = kex_send_newkeys(ssh); 194 r = kex_send_newkeys(ssh);
206 out: 195 out: