diff options
author | David Shaw <[email protected]> | 2002-11-13 17:43:27 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2002-11-13 17:43:27 +0000 |
commit | fbffa8209b79a2a1815c4c692b2bec709c0f24c7 (patch) | |
tree | 8ed3a1cb26cbc91bd176beb7a20bdb66232f5b26 /g10/encode.c | |
parent | * exec.c [__CYGWIN32__]: Keep cygwin separate from Mingw32; we don't need (diff) | |
download | gnupg-fbffa8209b79a2a1815c4c692b2bec709c0f24c7.tar.gz gnupg-fbffa8209b79a2a1815c4c692b2bec709c0f24c7.zip |
* encode.c (encode_simple): Make sure that files larger than about 4G use
partial length encoding. This is required because OpenPGP allows only for
32 bit length fields. From Werner on stable branch.
* getkey.c (get_pubkey_direct): Renamed to... (get_pubkey_fast): this and
made extern. (get_pubkey_byfprint_fast): New. From Werner on stable
branch.
* keydb.h, import.c (import_one): Use get_pubkey_fast instead of
get_pubkey. We don't need a merged key and actually this might lead to
recursions. (revocation_present): Likewise for search by fingerprint.
From Werner on stable branch.
* g10.c (main): Try to create the trustdb even for non-colon-mode list-key
operations. This is required because getkey needs to know whether a a key
is ultimately trusted. From Werner on stable branch.
Diffstat (limited to '')
-rw-r--r-- | g10/encode.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/g10/encode.c b/g10/encode.c index b635ce0b4..a814544e9 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -292,13 +292,18 @@ encode_simple( const char *filename, int mode, int compat ) messages. */ if( filename && !opt.textmode ) { - if( !(filesize = iobuf_get_filelength(inp)) ) - log_info(_("%s: WARNING: empty file\n"), filename ); - /* we can't yet encode the length of very large files, - * so we switch to partial lengthn encoding in this case */ - if ( filesize >= IOBUF_FILELENGTH_LIMIT ) - filesize = 0; - + off_t tmpsize; + + if ( !(tmpsize = iobuf_get_filelength(inp)) ) + log_info(_("%s: WARNING: empty file\n"), filename ); + /* We can't encode the length of very large files because + OpenPGP uses only 32 bit for file sizes. So if the the + size of a file is larger than 2^32 minus some bytes for + packet headers, we switch to partial length encoding. */ + if ( tmpsize < (IOBUF_FILELENGTH_LIMIT - 65536) ) + filesize = tmpsize; + else + filesize = 0; } else filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */ @@ -519,12 +524,18 @@ encode_crypt( const char *filename, STRLIST remusr ) } if( filename && !opt.textmode ) { - if( !(filesize = iobuf_get_filelength(inp)) ) - log_info(_("%s: WARNING: empty file\n"), filename ); - /* we can't yet encode the length of very large files, - * so we switch to partial length encoding in this case */ - if ( filesize >= IOBUF_FILELENGTH_LIMIT ) - filesize = 0; + off_t tmpsize; + + if ( !(tmpsize = iobuf_get_filelength(inp)) ) + log_info(_("%s: WARNING: empty file\n"), filename ); + /* We can't encode the length of very large files because + OpenPGP uses only 32 bit for file sizes. So if the the + size of a file is larger than 2^32 minus some bytes for + packet headers, we switch to partial length encoding. */ + if ( tmpsize < (IOBUF_FILELENGTH_LIMIT - 65536) ) + filesize = tmpsize; + else + filesize = 0; } else filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */ |