Diff

Differences From Artifact [c62c051963]:

To Artifact [9e12df6d31]:


4975
4976
4977
4978
4979
4980
4981


4982
4983
4984
4985
4986
4987
4988
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990







+
+







static int do_ssh2_transport(Ssh ssh, void *vin, int inlen,
			     struct Packet *pktin)
{
    unsigned char *in = (unsigned char *)vin;
    struct do_ssh2_transport_state {
	int nbits, pbits, warn_kex, warn_cscipher, warn_sccipher;
	Bignum p, g, e, f, K;
	void *our_kexinit;
	int our_kexinitlen;
	int kex_init_value, kex_reply_value;
	const struct ssh_mac **maclist;
	int nmacs;
	const struct ssh2_cipher *cscipher_tobe;
	const struct ssh2_cipher *sccipher_tobe;
	const struct ssh_mac *csmac_tobe;
	const struct ssh_mac *scmac_tobe;
5198
5199
5200
5201
5202
5203
5204
5205
5206


5207
5208

5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5200
5201
5202
5203
5204
5205
5206


5207
5208


5209
5210
5211
5212
5213
5214


5215
5216
5217
5218
5219
5220
5221







-
-
+
+
-
-
+





-
-







	ssh2_pkt_addstring_start(s->pktout);
	/* First KEX packet does _not_ follow, because we're not that brave. */
	ssh2_pkt_addbool(s->pktout, FALSE);
	/* Reserved. */
	ssh2_pkt_adduint32(s->pktout, 0);
    }

    SHA_Init(&ssh->exhash);
    sha_string(&ssh->exhash, ssh->v_c, strlen(ssh->v_c));
    s->our_kexinitlen = s->pktout->length - 5;
    s->our_kexinit = snewn(s->our_kexinitlen, unsigned char);
    sha_string(&ssh->exhash, ssh->v_s, strlen(ssh->v_s));
    sha_string(&ssh->exhash, s->pktout->data + 5, s->pktout->length - 5);
    memcpy(s->our_kexinit, s->pktout->data + 5, s->our_kexinitlen); 

    ssh2_pkt_send_noqueue(ssh, s->pktout);

    if (!pktin)
	crWaitUntil(pktin);
    if (pktin->length > 5)
	sha_string(&ssh->exhash, pktin->data + 5, pktin->length - 5);

    /*
     * Now examine the other side's KEXINIT to see what we're up
     * to.
     */
    {
	char *str, *preferred;
5421
5422
5423
5424
5425
5426
5427









5428
5429
5430
5431
5432
5433
5434
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442







+
+
+
+
+
+
+
+
+







	    ssh_set_frozen(ssh, 0);
	    if (s->dlgret == 0) {
		ssh_disconnect(ssh, "User aborted at cipher warning", NULL,
			       0, TRUE);
		crStop(0);
	    }
	}

	SHA_Init(&ssh->exhash);
	sha_string(&ssh->exhash, ssh->v_c, strlen(ssh->v_c));
	sha_string(&ssh->exhash, ssh->v_s, strlen(ssh->v_s));
	sha_string(&ssh->exhash, s->our_kexinit, s->our_kexinitlen);
	sfree(s->our_kexinit);
	if (pktin->length > 5)
	    sha_string(&ssh->exhash, pktin->data + 5, pktin->length - 5);


	if (s->ignorepkt) /* first_kex_packet_follows */
	    crWaitUntil(pktin);                /* Ignore packet */
    }

    /*
     * Work out the number of bits of key we will need from the key