Subject: [libssh2] #200: Compression not enabled correctly

[libssh2] #200: Compression not enabled correctly

From: libssh2 Trac <>
Date: Mon, 29 Nov 2010 23:38:11 -0000

#200: Compression not enabled correctly
  Reporter: riordanmr | Owner:
      Type: defect | Status: new
  Priority: normal | Milestone: 1.2.8
 Component: protocol | Version: 1.2.7
  Keywords: | Blocks:
Blocked By: |
 In the current libssh2 in git (2010-11-29), compression does not work.
 I get a "decompression unitilized" error in comp_method_zlib_decomp.
 The "abstract" parameter is NULL.
 The problem seems to be that compression has not been initialized -
 similar to ticket 180.

 The error occurs during a call to _libssh2_packet_require in
 diffie_hellman_sha1 in kex.c.
 The initialization of compression doesn't occur until later in that same

 Here's a traceback:

         mwsftp.exe!comp_method_zlib_decomp(_LIBSSH2_SESSION *
 session=0x00ff5f98, unsigned char * * dest=0x019ed620, unsigned int *
 dest_len=0x019ed614, unsigned int payload_limit=40000, const unsigned char
 * src=0x010057c0, unsigned int src_len=818, void * * abstract=0x00ff603c)
 Line 234 C
         mwsftp.exe!fullpacket(_LIBSSH2_SESSION * session=0x00ff5f98, int
 encrypted=0) Line 209 + 0x3e bytes C
         mwsftp.exe!_libssh2_transport_read(_LIBSSH2_SESSION *
 session=0x00ff5f98) Line 545 + 0x10 bytes C
         mwsftp.exe!_libssh2_packet_require(_LIBSSH2_SESSION *
 session=0x00ff5f98, unsigned char packet_type='', unsigned char * *
 data=0x01002b38, unsigned int * data_len=0x01002b5c, int match_ofs=0,
 const unsigned char * match_buf=0x00000000, unsigned int match_len=0,
 packet_require_state_t * state=0x01002ba8) Line 1093 + 0x9 bytes C
         mwsftp.exe!diffie_hellman_sha1(_LIBSSH2_SESSION *
 session=0x00ff5f98, bignum_st * g=0x00feb5f8, bignum_st * p=0x00feb5a8,
 int group_order=256, unsigned char packet_type_init='', unsigned char
 packet_type_reply='', unsigned char * midhash=0x00000000, unsigned long
 midhash_len=0, kmdhgGPsha1kex_state_t * exchange_state=0x01002b30) Line
 190 + 0x29 bytes C
 * session=0x00ff5f98, key_exchange_state_low_t * key_state=0x01002b18)
 Line 796 + 0x31 bytes C
         mwsftp.exe!_libssh2_kex_exchange(_LIBSSH2_SESSION *
 session=0x00ff5f98, int reexchange=0, key_exchange_state_t *
 key_state=0x01002b00) Line 1757 + 0x18 bytes C
         mwsftp.exe!session_startup(_LIBSSH2_SESSION * session=0x00ff5f98,
 unsigned int sock=3460) Line 672 + 0x14 bytes C
         mwsftp.exe!libssh2_session_handshake(_LIBSSH2_SESSION *
 session=0x00ff5f98, unsigned int sock=3460) Line 750 + 0xd bytes C
         mwsftp.exe!libssh2_session_startup(_LIBSSH2_SESSION *
 session=0x00ff5f98, int sock=3460) Line 769 + 0xd bytes C

 (Note: in order to enable standard zlib compression under Ubuntu, I had to
 add "Compression yes" to my sshd_config.)

 I'm attaching full tracing output.

 I tested against OpenSSH (on Ubuntu 10.04), Solaris, and WS_FTP SSH
 They all were unable to exchange keys with compression enabled, but they
 all worked with compression disabled.

Ticket URL: <>
libssh2 <>
C library for writing portable SSH2 clients
Received on 2010-11-30