summaryrefslogtreecommitdiffstats
path: root/g10/encode.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2002-08-30 18:34:13 +0200
committerWerner Koch <wk@gnupg.org>2002-08-30 18:34:13 +0200
commit5dfd5a6dac4d1e5fa5857f68f79dfea7f77bf526 (patch)
tree63791e9a52eddbadff543c0bb6704e5e09b51cf7 /g10/encode.c
parent* random.c: Automagically detect the entrop gatherer when (diff)
downloadgnupg2-5dfd5a6dac4d1e5fa5857f68f79dfea7f77bf526.tar.xz
gnupg2-5dfd5a6dac4d1e5fa5857f68f79dfea7f77bf526.zip
* pkclist.c (do_we_trust_pre): Changed the wording of a warning.
* encode.c (encode_simple,encode_crypt): Use new style CTB for compressssed packets when using MDC. We need to do this so that concatenated messages are properly decrypted. Old style compression assumes that it is the last packet; given that we can't determine the length in advance, the uncompressor does not know where to start. Actually we should use the new CTB always but this would break PGP 2 compatibility. * parse-packet.c (parse): Special treatment for new style CTB compressed packets. * build-packet.c (do_mdc): Removed. Was not used. (do_encrypted_mdc): Count the version number and the MDC packet.
Diffstat (limited to 'g10/encode.c')
-rw-r--r--g10/encode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/g10/encode.c b/g10/encode.c
index 4811e4e88..14192bd16 100644
--- a/g10/encode.c
+++ b/g10/encode.c
@@ -319,6 +319,8 @@ encode_simple( const char *filename, int mode, int compat )
/* register the compress filter */
if( do_compress )
{
+ if (cfx.dek && cfx.dek->use_mdc)
+ zfx.new_ctb = 1;
zfx.algo=opt.def_compress_algo;
if(zfx.algo==-1)
zfx.algo=DEFAULT_COMPRESS_ALGO;
@@ -554,6 +556,8 @@ encode_crypt( const char *filename, STRLIST remusr )
/* algo 0 means no compression */
if( compr_algo )
{
+ if (cfx.dek && cfx.dek->use_mdc)
+ zfx.new_ctb = 1;
zfx.algo = compr_algo;
iobuf_push_filter( out, compress_filter, &zfx );
}
@@ -565,13 +569,15 @@ encode_crypt( const char *filename, STRLIST remusr )
log_error("build_packet failed: %s\n", g10_errstr(rc) );
}
else {
- /* user requested not to create a literal packet, so we copy the plain data */
+ /* user requested not to create a literal packet, so we copy
+ the plain data */
byte copy_buffer[4096];
int bytes_copied;
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
rc = G10ERR_WRITE_FILE;
- log_error("copying input to output failed: %s\n", g10_errstr(rc) );
+ log_error("copying input to output failed: %s\n",
+ g10_errstr(rc) );
break;
}
memset(copy_buffer, 0, 4096); /* burn buffer */