~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to kex.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-09-30 23:09:58 UTC
  • mfrom: (1.13.3 upstream) (29 hardy)
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20080930230958-o6vsgn8c4mm959s0
Tags: 1:5.1p1-3
* Remove unnecessary ssh-vulnkey output in non-verbose mode when no
  compromised or unknown keys were found (closes: #496495).
* Configure with --disable-strip; dh_strip will deal with stripping
  binaries and will honour DEB_BUILD_OPTIONS (thanks, Bernhard R. Link;
  closes: #498681).
* Fix handling of zero-length server banners (thanks, Tomas Mraz; closes:
  #497026).

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
3
 * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
4
4
 *
91
91
kex_buf2prop(Buffer *raw, int *first_kex_follows)
92
92
{
93
93
        Buffer b;
94
 
        int i;
 
94
        u_int i;
95
95
        char **proposal;
96
96
 
97
97
        proposal = xcalloc(PROPOSAL_MAX, sizeof(char *));
112
112
                *first_kex_follows = i;
113
113
        debug2("kex_parse_kexinit: first_kex_follows %d ", i);
114
114
        i = buffer_get_int(&b);
115
 
        debug2("kex_parse_kexinit: reserved %d ", i);
 
115
        debug2("kex_parse_kexinit: reserved %u ", i);
116
116
        buffer_free(&b);
117
117
        return proposal;
118
118
}
127
127
        xfree(proposal);
128
128
}
129
129
 
 
130
/* ARGSUSED */
130
131
static void
131
132
kex_protocol_error(int type, u_int32_t seq, void *ctxt)
132
133
{
198
199
        kex->flags |= KEX_INIT_SENT;
199
200
}
200
201
 
 
202
/* ARGSUSED */
201
203
void
202
204
kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
203
205
{
262
264
{
263
265
        char *name = match_list(client, server, NULL);
264
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
269
        if ((enc->cipher = cipher_by_name(name)) == NULL)
267
270
                fatal("matching cipher is not supported: %s", name);
268
271
        enc->name = name;
278
281
{
279
282
        char *name = match_list(client, server, NULL);
280
283
        if (name == NULL)
281
 
                fatal("no matching mac found: client %s server %s", client, server);
282
 
        if (mac_init(mac, name) < 0)
 
284
                fatal("no matching mac found: client %s server %s",
 
285
                    client, server);
 
286
        if (mac_setup(mac, name) < 0)
283
287
                fatal("unsupported mac %s", name);
284
288
        /* truncate the key */
285
289
        if (datafellows & SSH_BUG_HMAC)
312
316
{
313
317
        k->name = match_list(client, server, NULL);
314
318
        if (k->name == NULL)
315
 
                fatal("no kex alg");
 
319
                fatal("Unable to negotiate a key exchange method");
316
320
        if (strcmp(k->name, KEX_DH1) == 0) {
317
321
                k->kex_type = KEX_DH_GRP1_SHA1;
318
322
                k->evp_md = EVP_sha1();
406
410
        for (mode = 0; mode < MODE_MAX; mode++) {
407
411
                newkeys = xcalloc(1, sizeof(*newkeys));
408
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
415
                nenc  = ctos ? PROPOSAL_ENC_ALGS_CTOS  : PROPOSAL_ENC_ALGS_STOC;
411
416
                nmac  = ctos ? PROPOSAL_MAC_ALGS_CTOS  : PROPOSAL_MAC_ALGS_STOC;
412
417
                ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC;