Mercurial > dropbear
comparison common-kex.c @ 575:f9b5dc0cba61
- Disable compression for non-final multihops
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 11 Sep 2009 14:02:04 +0000 |
parents | daf52f813328 |
children | a98a2138364a |
comparison
equal
deleted
inserted
replaced
574:b6665c1eac43 | 575:f9b5dc0cba61 |
---|---|
31 #include "kex.h" | 31 #include "kex.h" |
32 #include "ssh.h" | 32 #include "ssh.h" |
33 #include "packet.h" | 33 #include "packet.h" |
34 #include "bignum.h" | 34 #include "bignum.h" |
35 #include "random.h" | 35 #include "random.h" |
36 #include "runopts.h" | |
36 | 37 |
37 /* diffie-hellman-group1-sha1 value for p */ | 38 /* diffie-hellman-group1-sha1 value for p */ |
38 static const unsigned char dh_p_val[] = { | 39 static const unsigned char dh_p_val[] = { |
39 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, | 40 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, |
40 0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, | 41 0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, |
89 | 90 |
90 /* mac_algorithms_server_to_client */ | 91 /* mac_algorithms_server_to_client */ |
91 buf_put_algolist(ses.writepayload, sshhashes); | 92 buf_put_algolist(ses.writepayload, sshhashes); |
92 | 93 |
93 /* compression_algorithms_client_to_server */ | 94 /* compression_algorithms_client_to_server */ |
94 buf_put_algolist(ses.writepayload, sshcompress); | 95 buf_put_algolist(ses.writepayload, ses.compress_algos); |
95 | 96 |
96 /* compression_algorithms_server_to_client */ | 97 /* compression_algorithms_server_to_client */ |
97 buf_put_algolist(ses.writepayload, sshcompress); | 98 buf_put_algolist(ses.writepayload, ses.compress_algos); |
98 | 99 |
99 /* languages_client_to_server */ | 100 /* languages_client_to_server */ |
100 buf_putstring(ses.writepayload, "", 0); | 101 buf_putstring(ses.writepayload, "", 0); |
101 | 102 |
102 /* languages_server_to_client */ | 103 /* languages_server_to_client */ |
178 } | 179 } |
179 | 180 |
180 | 181 |
181 /* Set up the kex for the first time */ | 182 /* Set up the kex for the first time */ |
182 void kexfirstinitialise() { | 183 void kexfirstinitialise() { |
183 | |
184 ses.kexstate.donefirstkex = 0; | 184 ses.kexstate.donefirstkex = 0; |
185 | |
186 #ifndef DISABLE_ZLIB | |
187 if (opts.enable_compress) { | |
188 ses.compress_algos = ssh_compress; | |
189 } else | |
190 #endif | |
191 { | |
192 ses.compress_algos = ssh_nocompress; | |
193 } | |
185 kexinitialise(); | 194 kexinitialise(); |
186 } | 195 } |
187 | 196 |
188 /* Reset the kex state, ready for a new negotiation */ | 197 /* Reset the kex state, ready for a new negotiation */ |
189 static void kexinitialise() { | 198 static void kexinitialise() { |
668 goto error; | 677 goto error; |
669 } | 678 } |
670 TRACE(("hash s2c is %s", s2c_hash_algo->name)) | 679 TRACE(("hash s2c is %s", s2c_hash_algo->name)) |
671 | 680 |
672 /* compression_algorithms_client_to_server */ | 681 /* compression_algorithms_client_to_server */ |
673 c2s_comp_algo = ses.buf_match_algo(ses.payload, sshcompress, &goodguess); | 682 c2s_comp_algo = ses.buf_match_algo(ses.payload, ses.compress_algos, &goodguess); |
674 if (c2s_comp_algo == NULL) { | 683 if (c2s_comp_algo == NULL) { |
675 erralgo = "comp c->s"; | 684 erralgo = "comp c->s"; |
676 goto error; | 685 goto error; |
677 } | 686 } |
678 TRACE(("hash c2s is %s", c2s_comp_algo->name)) | 687 TRACE(("hash c2s is %s", c2s_comp_algo->name)) |
679 | 688 |
680 /* compression_algorithms_server_to_client */ | 689 /* compression_algorithms_server_to_client */ |
681 s2c_comp_algo = ses.buf_match_algo(ses.payload, sshcompress, &goodguess); | 690 s2c_comp_algo = ses.buf_match_algo(ses.payload, ses.compress_algos, &goodguess); |
682 if (s2c_comp_algo == NULL) { | 691 if (s2c_comp_algo == NULL) { |
683 erralgo = "comp s->c"; | 692 erralgo = "comp s->c"; |
684 goto error; | 693 goto error; |
685 } | 694 } |
686 TRACE(("hash s2c is %s", s2c_comp_algo->name)) | 695 TRACE(("hash s2c is %s", s2c_comp_algo->name)) |