diff options
author | Colin Watson <cjwatson@debian.org> | 2011-01-24 12:43:25 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2011-01-24 12:43:25 +0000 |
commit | 626f1d986ff72aa514da63e34744e1de9cf21b9a (patch) | |
tree | d215a5280bc2e57251e4a9e08bfd3674ad824a94 /kex.c | |
parent | 6ed622cb6fe8f71bbe0d998cdd12280410bfb420 (diff) | |
parent | 0970072c89b079b022538e3c366fbfa2c53fc821 (diff) |
* New upstream release (http://www.openssh.org/txt/release-5.7):
- Implement Elliptic Curve Cryptography modes for key exchange (ECDH)
and host/user keys (ECDSA) as specified by RFC5656. ECDH and ECDSA
offer better performance than plain DH and DSA at the same equivalent
symmetric key length, as well as much shorter keys.
- sftp(1)/sftp-server(8): add a protocol extension to support a hard
link operation. It is available through the "ln" command in the
client. The old "ln" behaviour of creating a symlink is available
using its "-s" option or through the preexisting "symlink" command.
- scp(1): Add a new -3 option to scp: Copies between two remote hosts
are transferred through the local host (closes: #508613).
- ssh(1): "atomically" create the listening mux socket by binding it on
a temporary name and then linking it into position after listen() has
succeeded. This allows the mux clients to determine that the server
socket is either ready or stale without races (closes: #454784).
Stale server sockets are now automatically removed (closes: #523250).
- ssh(1): install a SIGCHLD handler to reap expired child process
(closes: #594687).
- ssh(1)/ssh-agent(1): honour $TMPDIR for client xauth and ssh-agent
temporary directories (closes: #357469, although only if you arrange
for ssh-agent to actually see $TMPDIR since the setgid bit will cause
it to be stripped off).
Diffstat (limited to 'kex.c')
-rw-r--r-- | kex.c | 40 |
1 files changed, 36 insertions, 4 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.c,v 1.82 2009/10/24 11:13:54 andreas Exp $ */ | 1 | /* $OpenBSD: kex.c,v 1.86 2010/09/22 05:01:29 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 | * |
@@ -66,6 +66,34 @@ extern const EVP_MD *evp_ssh_sha256(void); | |||
66 | static void kex_kexinit_finish(Kex *); | 66 | static void kex_kexinit_finish(Kex *); |
67 | static void kex_choose_conf(Kex *); | 67 | static void kex_choose_conf(Kex *); |
68 | 68 | ||
69 | /* Validate KEX method name list */ | ||
70 | int | ||
71 | kex_names_valid(const char *names) | ||
72 | { | ||
73 | char *s, *cp, *p; | ||
74 | |||
75 | if (names == NULL || strcmp(names, "") == 0) | ||
76 | return 0; | ||
77 | s = cp = xstrdup(names); | ||
78 | for ((p = strsep(&cp, ",")); p && *p != '\0'; | ||
79 | (p = strsep(&cp, ","))) { | ||
80 | if (strcmp(p, KEX_DHGEX_SHA256) != 0 && | ||
81 | strcmp(p, KEX_DHGEX_SHA1) != 0 && | ||
82 | strcmp(p, KEX_DH14) != 0 && | ||
83 | strcmp(p, KEX_DH1) != 0 && | ||
84 | (strncmp(p, KEX_ECDH_SHA2_STEM, | ||
85 | sizeof(KEX_ECDH_SHA2_STEM) - 1) != 0 || | ||
86 | kex_ecdh_name_to_nid(p) == -1)) { | ||
87 | error("Unsupported KEX algorithm \"%.100s\"", p); | ||
88 | xfree(s); | ||
89 | return 0; | ||
90 | } | ||
91 | } | ||
92 | debug3("kex names ok: [%s]", names); | ||
93 | xfree(s); | ||
94 | return 1; | ||
95 | } | ||
96 | |||
69 | /* put algorithm proposal into buffer */ | 97 | /* put algorithm proposal into buffer */ |
70 | static void | 98 | static void |
71 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) | 99 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) |
@@ -102,7 +130,7 @@ kex_buf2prop(Buffer *raw, int *first_kex_follows) | |||
102 | buffer_get_char(&b); | 130 | buffer_get_char(&b); |
103 | /* extract kex init proposal strings */ | 131 | /* extract kex init proposal strings */ |
104 | for (i = 0; i < PROPOSAL_MAX; i++) { | 132 | for (i = 0; i < PROPOSAL_MAX; i++) { |
105 | proposal[i] = buffer_get_string(&b,NULL); | 133 | proposal[i] = buffer_get_cstring(&b,NULL); |
106 | debug2("kex_parse_kexinit: %s", proposal[i]); | 134 | debug2("kex_parse_kexinit: %s", proposal[i]); |
107 | } | 135 | } |
108 | /* first kex follows / reserved */ | 136 | /* first kex follows / reserved */ |
@@ -329,6 +357,10 @@ choose_kex(Kex *k, char *client, char *server) | |||
329 | } else if (strcmp(k->name, KEX_DHGEX_SHA256) == 0) { | 357 | } else if (strcmp(k->name, KEX_DHGEX_SHA256) == 0) { |
330 | k->kex_type = KEX_DH_GEX_SHA256; | 358 | k->kex_type = KEX_DH_GEX_SHA256; |
331 | k->evp_md = evp_ssh_sha256(); | 359 | k->evp_md = evp_ssh_sha256(); |
360 | } else if (strncmp(k->name, KEX_ECDH_SHA2_STEM, | ||
361 | sizeof(KEX_ECDH_SHA2_STEM) - 1) == 0) { | ||
362 | k->kex_type = KEX_ECDH_SHA2; | ||
363 | k->evp_md = kex_ecdh_name_to_evpmd(k->name); | ||
332 | #endif | 364 | #endif |
333 | #ifdef GSSAPI | 365 | #ifdef GSSAPI |
334 | } else if (strncmp(k->name, KEX_GSS_GEX_SHA1_ID, | 366 | } else if (strncmp(k->name, KEX_GSS_GEX_SHA1_ID, |
@@ -577,11 +609,11 @@ derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus, | |||
577 | memset(&md, 0, sizeof(md)); | 609 | memset(&md, 0, sizeof(md)); |
578 | } | 610 | } |
579 | 611 | ||
580 | #if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) | 612 | #if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH) |
581 | void | 613 | void |
582 | dump_digest(char *msg, u_char *digest, int len) | 614 | dump_digest(char *msg, u_char *digest, int len) |
583 | { | 615 | { |
584 | u_int i; | 616 | int i; |
585 | 617 | ||
586 | fprintf(stderr, "%s\n", msg); | 618 | fprintf(stderr, "%s\n", msg); |
587 | for (i = 0; i < len; i++) { | 619 | for (i = 0; i < len; i++) { |