summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-12-24 10:29:57 +0000
committerColin Watson <cjwatson@debian.org>2007-12-24 10:29:57 +0000
commitc3e531b12b2335b7fa5a6bcc9a309d3c523ff64b (patch)
treeb72c0867348e7e7914d64af6fc5e25c728922e03 /kex.c
parent6b222fdf3cb54c11a446df38e027fe7acf2220cb (diff)
parent70847d299887abb96f8703ca99db6d817b78960e (diff)
* New upstream release (closes: #453367).
- CVE-2007-4752: Prevent ssh(1) from using a trusted X11 cookie if creation of an untrusted cookie fails; found and fixed by Jan Pechanec (closes: #444738). - sshd(8) in new installations defaults to SSH Protocol 2 only. Existing installations are unchanged. - The SSH channel window size has been increased, and both ssh(1) sshd(8) now send window updates more aggressively. These improves performance on high-BDP (Bandwidth Delay Product) networks. - ssh(1) and sshd(8) now preserve MAC contexts between packets, which saves 2 hash calls per packet and results in 12-16% speedup for arcfour256/hmac-md5. - A new MAC algorithm has been added, UMAC-64 (RFC4418) as "umac-64@openssh.com". UMAC-64 has been measured to be approximately 20% faster than HMAC-MD5. - Failure to establish a ssh(1) TunnelForward is now treated as a fatal error when the ExitOnForwardFailure option is set. - ssh(1) returns a sensible exit status if the control master goes away without passing the full exit status. - When using a ProxyCommand in ssh(1), set the outgoing hostname with gethostname(2), allowing hostbased authentication to work. - Make scp(1) skip FIFOs rather than hanging (closes: #246774). - Encode non-printing characters in scp(1) filenames. These could cause copies to be aborted with a "protocol error". - Handle SIGINT in sshd(8) privilege separation child process to ensure that wtmp and lastlog records are correctly updated. - Report GSSAPI mechanism in errors, for libraries that support multiple mechanisms. - Improve documentation for ssh-add(1)'s -d option. - Rearrange and tidy GSSAPI code, removing server-only code being linked into the client. - Delay execution of ssh(1)'s LocalCommand until after all forwardings have been established. - In scp(1), do not truncate non-regular files. - Improve exit message from ControlMaster clients. - Prevent sftp-server(8) from reading until it runs out of buffer space, whereupon it would exit with a fatal error (closes: #365541). - pam_end() was not being called if authentication failed (closes: #405041). - Manual page datestamps updated (closes: #433181).
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/kex.c b/kex.c
index 5f9b1dc40..5c8361bac 100644
--- a/kex.c
+++ b/kex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.c,v 1.77 2007/01/21 01:41:54 stevesk Exp $ */ 1/* $OpenBSD: kex.c,v 1.79 2007/06/05 06:52:37 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -91,7 +91,7 @@ static char **
91kex_buf2prop(Buffer *raw, int *first_kex_follows) 91kex_buf2prop(Buffer *raw, int *first_kex_follows)
92{ 92{
93 Buffer b; 93 Buffer b;
94 int i; 94 u_int i;
95 char **proposal; 95 char **proposal;
96 96
97 proposal = xcalloc(PROPOSAL_MAX, sizeof(char *)); 97 proposal = xcalloc(PROPOSAL_MAX, sizeof(char *));
@@ -112,7 +112,7 @@ kex_buf2prop(Buffer *raw, int *first_kex_follows)
112 *first_kex_follows = i; 112 *first_kex_follows = i;
113 debug2("kex_parse_kexinit: first_kex_follows %d ", i); 113 debug2("kex_parse_kexinit: first_kex_follows %d ", i);
114 i = buffer_get_int(&b); 114 i = buffer_get_int(&b);
115 debug2("kex_parse_kexinit: reserved %d ", i); 115 debug2("kex_parse_kexinit: reserved %u ", i);
116 buffer_free(&b); 116 buffer_free(&b);
117 return proposal; 117 return proposal;
118} 118}
@@ -127,6 +127,7 @@ kex_prop_free(char **proposal)
127 xfree(proposal); 127 xfree(proposal);
128} 128}
129 129
130/* ARGSUSED */
130static void 131static void
131kex_protocol_error(int type, u_int32_t seq, void *ctxt) 132kex_protocol_error(int type, u_int32_t seq, void *ctxt)
132{ 133{
@@ -198,6 +199,7 @@ kex_send_kexinit(Kex *kex)
198 kex->flags |= KEX_INIT_SENT; 199 kex->flags |= KEX_INIT_SENT;
199} 200}
200 201
202/* ARGSUSED */
201void 203void
202kex_input_kexinit(int type, u_int32_t seq, void *ctxt) 204kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
203{ 205{
@@ -262,7 +264,8 @@ choose_enc(Enc *enc, char *client, char *server)
262{ 264{
263 char *name = match_list(client, server, NULL); 265 char *name = match_list(client, server, NULL);
264 if (name == NULL) 266 if (name == NULL)
265 fatal("no matching cipher found: client %s server %s", client, server); 267 fatal("no matching cipher found: client %s server %s",
268 client, server);
266 if ((enc->cipher = cipher_by_name(name)) == NULL) 269 if ((enc->cipher = cipher_by_name(name)) == NULL)
267 fatal("matching cipher is not supported: %s", name); 270 fatal("matching cipher is not supported: %s", name);
268 enc->name = name; 271 enc->name = name;
@@ -278,8 +281,9 @@ choose_mac(Mac *mac, char *client, char *server)
278{ 281{
279 char *name = match_list(client, server, NULL); 282 char *name = match_list(client, server, NULL);
280 if (name == NULL) 283 if (name == NULL)
281 fatal("no matching mac found: client %s server %s", client, server); 284 fatal("no matching mac found: client %s server %s",
282 if (mac_init(mac, name) < 0) 285 client, server);
286 if (mac_setup(mac, name) < 0)
283 fatal("unsupported mac %s", name); 287 fatal("unsupported mac %s", name);
284 /* truncate the key */ 288 /* truncate the key */
285 if (datafellows & SSH_BUG_HMAC) 289 if (datafellows & SSH_BUG_HMAC)
@@ -312,7 +316,7 @@ choose_kex(Kex *k, char *client, char *server)
312{ 316{
313 k->name = match_list(client, server, NULL); 317 k->name = match_list(client, server, NULL);
314 if (k->name == NULL) 318 if (k->name == NULL)
315 fatal("no kex alg"); 319 fatal("Unable to negotiate a key exchange method");
316 if (strcmp(k->name, KEX_DH1) == 0) { 320 if (strcmp(k->name, KEX_DH1) == 0) {
317 k->kex_type = KEX_DH_GRP1_SHA1; 321 k->kex_type = KEX_DH_GRP1_SHA1;
318 k->evp_md = EVP_sha1(); 322 k->evp_md = EVP_sha1();
@@ -406,7 +410,8 @@ kex_choose_conf(Kex *kex)
406 for (mode = 0; mode < MODE_MAX; mode++) { 410 for (mode = 0; mode < MODE_MAX; mode++) {
407 newkeys = xcalloc(1, sizeof(*newkeys)); 411 newkeys = xcalloc(1, sizeof(*newkeys));
408 kex->newkeys[mode] = newkeys; 412 kex->newkeys[mode] = newkeys;
409 ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); 413 ctos = (!kex->server && mode == MODE_OUT) ||
414 (kex->server && mode == MODE_IN);
410 nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC; 415 nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC;
411 nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC; 416 nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC;
412 ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC; 417 ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC;