diff options
author | Werner Koch <[email protected]> | 1997-12-12 12:03:58 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1997-12-12 12:03:58 +0000 |
commit | 68ea0f43533096d5c46bad4aee6e5d5864307f4a (patch) | |
tree | f5d3601897a3bdfbce113d5e1ed8b4336c83744a /g10/compress.c | |
parent | fingerprints and self signatures added (diff) | |
download | gnupg-68ea0f43533096d5c46bad4aee6e5d5864307f4a.tar.gz gnupg-68ea0f43533096d5c46bad4aee6e5d5864307f4a.zip |
added option file handling
Diffstat (limited to 'g10/compress.c')
-rw-r--r-- | g10/compress.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/g10/compress.c b/g10/compress.c index d0e2bc539..2b10c983b 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -106,7 +106,13 @@ init_uncompress( compress_filter_context_t *zfx, z_stream *zs ) int level; - if( (rc = inflateInit( zs )) != Z_OK ) { + /**************** + * PGP uses a windowsize of 13 bits. Using a negative value for + * it forces zlib not to expect a zlib header. This is a + * undocumented feature, Peter Gutmann told me about. + */ + if( (rc = zfx->pgpmode? inflateInit2( zs, -13) + : inflateInit( zs )) != Z_OK ) { log_fatal("zlib problem: %s\n", zs->msg? zs->msg : rc == Z_MEM_ERROR ? "out of core" : rc == Z_VERSION_ERROR ? "invalid lib version" : @@ -265,7 +271,9 @@ handle_compressed( PKT_compressed *cd ) compress_filter_context_t cfx; memset( &cfx, 0, sizeof cfx ); - if( cd->algorithm != 2 ) + if( cd->algorithm == 1 ) + cfx.pgpmode = 1; + else if( cd->algorithm != 2 ) return G10ERR_COMPR_ALGO; iobuf_push_filter( cd->buf, compress_filter, &cfx ); |