15c15
< * $FreeBSD: head/crypto/openssh/sshd.c 60663 2000-05-17 08:06:20Z kris $
---
> * $FreeBSD: head/crypto/openssh/sshd.c 61212 2000-06-03 09:58:15Z kris $
19c19
< RCSID("$OpenBSD: sshd.c,v 1.115 2000/05/03 10:21:49 markus Exp $");
---
> RCSID("$OpenBSD: sshd.c,v 1.118 2000/05/25 20:45:20 markus Exp $");
295,309d294
< char *
< chop(char *s)
< {
< char *t = s;
< while (*t) {
< if(*t == '\n' || *t == '\r') {
< *t = '\0';
< return s;
< }
< t++;
< }
< return s;
<
< }
<
437,439c422,427
< RSA_free(public_key);
< RSA_free(sensitive_data.private_key);
< RSA_free(sensitive_data.host_key);
---
> if (public_key)
> RSA_free(public_key);
> if (sensitive_data.private_key)
> RSA_free(sensitive_data.private_key);
> if (sensitive_data.host_key)
> RSA_free(sensitive_data.host_key);
1242d1229
< char *ptr;
1254d1240
< char *sprop[PROPOSAL_MAX];
1262,1280c1248
<
< debug("Sending KEX init.");
<
< for (i = 0; i < PROPOSAL_MAX; i++)
< sprop[i] = xstrdup(myproposal[i]);
< server_kexinit = kex_init(sprop);
< packet_start(SSH2_MSG_KEXINIT);
< packet_put_raw(buffer_ptr(server_kexinit), buffer_len(server_kexinit));
< packet_send();
< packet_write_wait();
<
< debug("done");
<
< packet_read_expect(&payload_len, SSH2_MSG_KEXINIT);
<
< /*
< * save raw KEXINIT payload in buffer. this is used during
< * computation of the session_id and the session keys.
< */
---
> server_kexinit = kex_init(myproposal);
1283,1284d1250
< ptr = packet_get_raw(&payload_len);
< buffer_append(client_kexinit, ptr, payload_len);
1286,1293c1252,1256
< /* skip cookie */
< for (i = 0; i < 16; i++)
< (void) packet_get_char();
< /* save kex init proposal strings */
< for (i = 0; i < PROPOSAL_MAX; i++) {
< cprop[i] = packet_get_string(NULL);
< debug("got kexinit string: %s", cprop[i]);
< }
---
> /* algorithm negotiation */
> kex_exchange_kexinit(server_kexinit, client_kexinit, cprop);
> kex = kex_choose_conf(cprop, myproposal, 1);
> for (i = 0; i < PROPOSAL_MAX; i++)
> xfree(cprop[i]);
1295,1302d1257
< i = (int) packet_get_char();
< debug("first kex follow == %d", i);
< i = packet_get_int();
< debug("reserved == %d", i);
<
< debug("done read kexinit");
< kex = kex_choose_conf(cprop, sprop, 1);
<
< * $FreeBSD: head/crypto/openssh/sshd.c 60663 2000-05-17 08:06:20Z kris $
---
> * $FreeBSD: head/crypto/openssh/sshd.c 61212 2000-06-03 09:58:15Z kris $
19c19
< RCSID("$OpenBSD: sshd.c,v 1.115 2000/05/03 10:21:49 markus Exp $");
---
> RCSID("$OpenBSD: sshd.c,v 1.118 2000/05/25 20:45:20 markus Exp $");
295,309d294
< char *
< chop(char *s)
< {
< char *t = s;
< while (*t) {
< if(*t == '\n' || *t == '\r') {
< *t = '\0';
< return s;
< }
< t++;
< }
< return s;
<
< }
<
437,439c422,427
< RSA_free(public_key);
< RSA_free(sensitive_data.private_key);
< RSA_free(sensitive_data.host_key);
---
> if (public_key)
> RSA_free(public_key);
> if (sensitive_data.private_key)
> RSA_free(sensitive_data.private_key);
> if (sensitive_data.host_key)
> RSA_free(sensitive_data.host_key);
1242d1229
< char *ptr;
1254d1240
< char *sprop[PROPOSAL_MAX];
1262,1280c1248
<
< debug("Sending KEX init.");
<
< for (i = 0; i < PROPOSAL_MAX; i++)
< sprop[i] = xstrdup(myproposal[i]);
< server_kexinit = kex_init(sprop);
< packet_start(SSH2_MSG_KEXINIT);
< packet_put_raw(buffer_ptr(server_kexinit), buffer_len(server_kexinit));
< packet_send();
< packet_write_wait();
<
< debug("done");
<
< packet_read_expect(&payload_len, SSH2_MSG_KEXINIT);
<
< /*
< * save raw KEXINIT payload in buffer. this is used during
< * computation of the session_id and the session keys.
< */
---
> server_kexinit = kex_init(myproposal);
1283,1284d1250
< ptr = packet_get_raw(&payload_len);
< buffer_append(client_kexinit, ptr, payload_len);
1286,1293c1252,1256
< /* skip cookie */
< for (i = 0; i < 16; i++)
< (void) packet_get_char();
< /* save kex init proposal strings */
< for (i = 0; i < PROPOSAL_MAX; i++) {
< cprop[i] = packet_get_string(NULL);
< debug("got kexinit string: %s", cprop[i]);
< }
---
> /* algorithm negotiation */
> kex_exchange_kexinit(server_kexinit, client_kexinit, cprop);
> kex = kex_choose_conf(cprop, myproposal, 1);
> for (i = 0; i < PROPOSAL_MAX; i++)
> xfree(cprop[i]);
1295,1302d1257
< i = (int) packet_get_char();
< debug("first kex follow == %d", i);
< i = packet_get_int();
< debug("reserved == %d", i);
<
< debug("done read kexinit");
< kex = kex_choose_conf(cprop, sprop, 1);
<