Buffer *server_kexinit; Buffer *client_kexinit; int payload_len; int i;
do_ssh2_kex(void){	Buffer *server_kexinit;	Buffer *client_kexinit;	int payload_len;	int i;	Kex *kex;	char *cprop[PROPOSAL_MAX];/* KEXINIT */	if (options.ciphers != NULL) {		myproposal[PROPOSAL_ENC_ALGS_CTOS] =		myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;	}	myproposal[PROPOSAL_ENC_ALGS_CTOS] =	    compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_CTOS]);	myproposal[PROPOSAL_ENC_ALGS_STOC] =	    compat_cipher_proposal(myproposal[PROPOSAL_ENC_ALGS_STOC]);	if (options.macs != NULL) {		myproposal[PROPOSAL_MAC_ALGS_CTOS] =		myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs;	}	myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = list_hostkey_types();	server_kexinit = kex_init(myproposal);	client_kexinit = xmalloc(sizeof(*client_kexinit));	buffer_init(client_kexinit);	/* 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]);	switch (kex->kex_type) {	case DH_GRP1_SHA1:		ssh_dh1_server(kex, client_kexinit, server_kexinit);		break;	case DH_GEX_SHA1:		ssh_dhgex_server(kex, client_kexinit, server_kexinit);		break;	default:		fatal("Unsupported key exchange %d", kex->kex_type);	}	debug("send SSH2_MSG_NEWKEYS.");	packet_start(SSH2_MSG_NEWKEYS);	packet_send();	packet_write_wait();	debug("done: send SSH2_MSG_NEWKEYS.");	debug("Wait SSH2_MSG_NEWKEYS.");	packet_read_expect(&payload_len, SSH2_MSG_NEWKEYS);	debug("GOT SSH2_MSG_NEWKEYS.");#ifdef DEBUG_KEXDH	/* send 1st encrypted/maced/compressed message */	packet_start(SSH2_MSG_IGNORE);	packet_put_cstring("markus");	packet_send();	packet_write_wait();#endif	debug("done: KEX2.");}