diff options
author | Matt Johnston <matt@ucc.asn.au> | 2008-09-29 02:23:04 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2008-09-29 02:23:04 +0000 |
commit | 049fcf1ac572e1a13dc1281c26bbf3512c533fb7 (patch) | |
tree | 62b2290f5f6e4c0c8e0a3c0263eaa991357abb24 /packet.c | |
parent | 90f8c1fd51ac6af033d455a775dc5a1455d7d7cb (diff) |
Add support for zlib@openssh.com delayed compression.
Are still advertising 'zlib' for the server, need to allow
delayed-only as an option
--HG--
extra : convert_revision : 319df675cc3c9b35a10b7d8357c94f33fdab1a46
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -290,10 +290,9 @@ void decrypt_packet() { buf_setpos(ses.decryptreadbuf, PACKET_PAYLOAD_OFF); #ifndef DISABLE_ZLIB - if (ses.keys->recv_algo_comp == DROPBEAR_COMP_ZLIB) { + if (is_compress_recv()) { /* decompress */ ses.payload = buf_decompress(ses.decryptreadbuf, len); - } else #endif { @@ -469,6 +468,7 @@ void encrypt_packet() { buffer * writebuf; /* the packet which will go on the wire */ buffer * clearwritebuf; /* unencrypted, possibly compressed */ unsigned char type; + unsigned int clear_len; type = ses.writepayload->data[0]; TRACE(("enter encrypt_packet()")) @@ -488,11 +488,12 @@ void encrypt_packet() { /* Encrypted packet len is payload+5, then worst case is if we are 3 away * from a blocksize multiple. In which case we need to pad to the * multiple, then add another blocksize (or MIN_PACKET_LEN) */ - clearwritebuf = buf_new((ses.writepayload->len+4+1) + MIN_PACKET_LEN + 3 + clear_len = (ses.writepayload->len+4+1) + MIN_PACKET_LEN + 3; + #ifndef DISABLE_ZLIB - + ZLIB_COMPRESS_INCR /* bit of a kludge, but we can't know len*/ + clear_len += ZLIB_COMPRESS_INCR; /* bit of a kludge, but we can't know len*/ #endif - ); + clearwritebuf = buf_new(clear_len); buf_setlen(clearwritebuf, PACKET_PAYLOAD_OFF); buf_setpos(clearwritebuf, PACKET_PAYLOAD_OFF); @@ -500,7 +501,7 @@ void encrypt_packet() { #ifndef DISABLE_ZLIB /* compression */ - if (ses.keys->trans_algo_comp == DROPBEAR_COMP_ZLIB) { + if (is_compress_trans()) { buf_compress(clearwritebuf, ses.writepayload, ses.writepayload->len); } else #endif |