diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:40:29 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:40:29 +0000 |
commit | a25ec0b132c44c9e341e08464ff830de06b81126 (patch) | |
tree | e20842d80f9e25cb6cf09525abea63f7bf655dd7 /kex.c | |
parent | 1b816ea846aca3ee89e7995373ace609e9518424 (diff) | |
parent | 70847d299887abb96f8703ca99db6d817b78960e (diff) |
import openssh-4.7p1-gsskex-20070927.patch
Diffstat (limited to 'kex.c')
-rw-r--r-- | kex.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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 ** | |||
91 | kex_buf2prop(Buffer *raw, int *first_kex_follows) | 91 | kex_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 */ | ||
130 | static void | 131 | static void |
131 | kex_protocol_error(int type, u_int32_t seq, void *ctxt) | 132 | kex_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 */ | ||
201 | void | 203 | void |
202 | kex_input_kexinit(int type, u_int32_t seq, void *ctxt) | 204 | kex_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; |