- djm@cvs.openbsd.org 2007/05/30 05:58:13

[kex.c]
     tidy: KNF, ARGSUSED and u_int
This commit is contained in:
Darren Tucker 2007-06-05 18:23:28 +10:00
parent 4a40ae28c3
commit 0d0d195969
2 changed files with 16 additions and 8 deletions

View File

@ -4,6 +4,9 @@
[sshd.c] [sshd.c]
zap double include; from p_nowaczyk AT o2.pl zap double include; from p_nowaczyk AT o2.pl
(not required in -portable, Id sync only) (not required in -portable, Id sync only)
- djm@cvs.openbsd.org 2007/05/30 05:58:13
[kex.c]
tidy: KNF, ARGSUSED and u_int
20070520 20070520
- (dtucker) OpenBSD CVS Sync - (dtucker) OpenBSD CVS Sync
@ -2947,4 +2950,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4671 2007/06/05 08:22:32 dtucker Exp $ $Id: ChangeLog,v 1.4672 2007/06/05 08:23:28 dtucker Exp $

19
kex.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: kex.c,v 1.77 2007/01/21 01:41:54 stevesk Exp $ */ /* $OpenBSD: kex.c,v 1.78 2007/05/30 05:58:13 djm Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* *
@ -87,7 +87,7 @@ static char **
kex_buf2prop(Buffer *raw, int *first_kex_follows) kex_buf2prop(Buffer *raw, int *first_kex_follows)
{ {
Buffer b; Buffer b;
int i; u_int i;
char **proposal; char **proposal;
proposal = xcalloc(PROPOSAL_MAX, sizeof(char *)); proposal = xcalloc(PROPOSAL_MAX, sizeof(char *));
@ -108,7 +108,7 @@ kex_buf2prop(Buffer *raw, int *first_kex_follows)
*first_kex_follows = i; *first_kex_follows = i;
debug2("kex_parse_kexinit: first_kex_follows %d ", i); debug2("kex_parse_kexinit: first_kex_follows %d ", i);
i = buffer_get_int(&b); i = buffer_get_int(&b);
debug2("kex_parse_kexinit: reserved %d ", i); debug2("kex_parse_kexinit: reserved %u ", i);
buffer_free(&b); buffer_free(&b);
return proposal; return proposal;
} }
@ -123,6 +123,7 @@ kex_prop_free(char **proposal)
xfree(proposal); xfree(proposal);
} }
/* ARGSUSED */
static void static void
kex_protocol_error(int type, u_int32_t seq, void *ctxt) kex_protocol_error(int type, u_int32_t seq, void *ctxt)
{ {
@ -194,6 +195,7 @@ kex_send_kexinit(Kex *kex)
kex->flags |= KEX_INIT_SENT; kex->flags |= KEX_INIT_SENT;
} }
/* ARGSUSED */
void void
kex_input_kexinit(int type, u_int32_t seq, void *ctxt) kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
{ {
@ -258,7 +260,8 @@ choose_enc(Enc *enc, char *client, char *server)
{ {
char *name = match_list(client, server, NULL); char *name = match_list(client, server, NULL);
if (name == NULL) if (name == NULL)
fatal("no matching cipher found: client %s server %s", client, server); fatal("no matching cipher found: client %s server %s",
client, server);
if ((enc->cipher = cipher_by_name(name)) == NULL) if ((enc->cipher = cipher_by_name(name)) == NULL)
fatal("matching cipher is not supported: %s", name); fatal("matching cipher is not supported: %s", name);
enc->name = name; enc->name = name;
@ -274,7 +277,8 @@ choose_mac(Mac *mac, char *client, char *server)
{ {
char *name = match_list(client, server, NULL); char *name = match_list(client, server, NULL);
if (name == NULL) if (name == NULL)
fatal("no matching mac found: client %s server %s", client, server); fatal("no matching mac found: client %s server %s",
client, server);
if (mac_init(mac, name) < 0) if (mac_init(mac, name) < 0)
fatal("unsupported mac %s", name); fatal("unsupported mac %s", name);
/* truncate the key */ /* truncate the key */
@ -308,7 +312,7 @@ choose_kex(Kex *k, char *client, char *server)
{ {
k->name = match_list(client, server, NULL); k->name = match_list(client, server, NULL);
if (k->name == NULL) if (k->name == NULL)
fatal("no kex alg"); fatal("Unable to negotiate a key exchange method");
if (strcmp(k->name, KEX_DH1) == 0) { if (strcmp(k->name, KEX_DH1) == 0) {
k->kex_type = KEX_DH_GRP1_SHA1; k->kex_type = KEX_DH_GRP1_SHA1;
k->evp_md = EVP_sha1(); k->evp_md = EVP_sha1();
@ -388,7 +392,8 @@ kex_choose_conf(Kex *kex)
for (mode = 0; mode < MODE_MAX; mode++) { for (mode = 0; mode < MODE_MAX; mode++) {
newkeys = xcalloc(1, sizeof(*newkeys)); newkeys = xcalloc(1, sizeof(*newkeys));
kex->newkeys[mode] = newkeys; kex->newkeys[mode] = newkeys;
ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); ctos = (!kex->server && mode == MODE_OUT) ||
(kex->server && mode == MODE_IN);
nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC; nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC;
nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC; nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC;
ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC; ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC;