summaryrefslogtreecommitdiff
path: root/kexecdhs.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-09-14 23:42:11 +0100
committerColin Watson <cjwatson@debian.org>2013-09-14 23:42:11 +0100
commit327155e6824b3ee13837bdde04e4eb47e147ff46 (patch)
tree8f8743122403c7a2e6ed919156711fb1520c657f /kexecdhs.c
parent0334ce32304e9ba2a10ee5ca49ca6e8ff3ba6cf4 (diff)
parent74e339b8f8936bc0d985e053a076d0c9b5e9ea51 (diff)
* New upstream release (http://www.openssh.com/txt/release-6.3).
- sftp(1): add support for resuming partial downloads using the "reget" command and on the sftp commandline or on the "get" commandline using the "-a" (append) option (closes: #158590). - ssh(1): add an "IgnoreUnknown" configuration option to selectively suppress errors arising from unknown configuration directives (closes: #436052). - sftp(1): update progressmeter when data is acknowledged, not when it's sent (partially addresses #708372). - ssh(1): do not fatally exit when attempting to cleanup multiplexing- created channels that are incompletely opened (closes: #651357).
Diffstat (limited to 'kexecdhs.c')
-rw-r--r--kexecdhs.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/kexecdhs.c b/kexecdhs.c
index 8c515dfa6..3a580aacf 100644
--- a/kexecdhs.c
+++ b/kexecdhs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexecdhs.c,v 1.2 2010/09/22 05:01:29 djm Exp $ */ 1/* $OpenBSD: kexecdhs.c,v 1.5 2013/07/19 07:37:48 markus 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.
@@ -59,11 +59,8 @@ kexecdh_server(Kex *kex)
59 u_char *server_host_key_blob = NULL, *signature = NULL; 59 u_char *server_host_key_blob = NULL, *signature = NULL;
60 u_char *kbuf, *hash; 60 u_char *kbuf, *hash;
61 u_int klen, slen, sbloblen, hashlen; 61 u_int klen, slen, sbloblen, hashlen;
62 int curve_nid;
63 62
64 if ((curve_nid = kex_ecdh_name_to_nid(kex->name)) == -1) 63 if ((server_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL)
65 fatal("%s: unsupported ECDH curve \"%s\"", __func__, kex->name);
66 if ((server_key = EC_KEY_new_by_curve_name(curve_nid)) == NULL)
67 fatal("%s: EC_KEY_new_by_curve_name failed", __func__); 64 fatal("%s: EC_KEY_new_by_curve_name failed", __func__);
68 if (EC_KEY_generate_key(server_key) != 1) 65 if (EC_KEY_generate_key(server_key) != 1)
69 fatal("%s: EC_KEY_generate_key failed", __func__); 66 fatal("%s: EC_KEY_generate_key failed", __func__);
@@ -81,9 +78,6 @@ kexecdh_server(Kex *kex)
81 if (server_host_public == NULL) 78 if (server_host_public == NULL)
82 fatal("Unsupported hostkey type %d", kex->hostkey_type); 79 fatal("Unsupported hostkey type %d", kex->hostkey_type);
83 server_host_private = kex->load_host_private_key(kex->hostkey_type); 80 server_host_private = kex->load_host_private_key(kex->hostkey_type);
84 if (server_host_private == NULL)
85 fatal("Missing private key for hostkey type %d",
86 kex->hostkey_type);
87 81
88 debug("expecting SSH2_MSG_KEX_ECDH_INIT"); 82 debug("expecting SSH2_MSG_KEX_ECDH_INIT");
89 packet_read_expect(SSH2_MSG_KEX_ECDH_INIT); 83 packet_read_expect(SSH2_MSG_KEX_ECDH_INIT);
@@ -115,7 +109,7 @@ kexecdh_server(Kex *kex)
115 if (BN_bin2bn(kbuf, klen, shared_secret) == NULL) 109 if (BN_bin2bn(kbuf, klen, shared_secret) == NULL)
116 fatal("%s: BN_bin2bn failed", __func__); 110 fatal("%s: BN_bin2bn failed", __func__);
117 memset(kbuf, 0, klen); 111 memset(kbuf, 0, klen);
118 xfree(kbuf); 112 free(kbuf);
119 113
120 /* calc H */ 114 /* calc H */
121 key_to_blob(server_host_public, &server_host_key_blob, &sbloblen); 115 key_to_blob(server_host_public, &server_host_key_blob, &sbloblen);
@@ -142,9 +136,8 @@ kexecdh_server(Kex *kex)
142 } 136 }
143 137
144 /* sign H */ 138 /* sign H */
145 if (PRIVSEP(key_sign(server_host_private, &signature, &slen, 139 kex->sign(server_host_private, server_host_public, &signature, &slen,
146 hash, hashlen)) < 0) 140 hash, hashlen);
147 fatal("kexdh_server: key_sign failed");
148 141
149 /* destroy_sensitive_data(); */ 142 /* destroy_sensitive_data(); */
150 143
@@ -155,8 +148,8 @@ kexecdh_server(Kex *kex)
155 packet_put_string(signature, slen); 148 packet_put_string(signature, slen);
156 packet_send(); 149 packet_send();
157 150
158 xfree(signature); 151 free(signature);
159 xfree(server_host_key_blob); 152 free(server_host_key_blob);
160 /* have keys, free server key */ 153 /* have keys, free server key */
161 EC_KEY_free(server_key); 154 EC_KEY_free(server_key);
162 155