mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-12 22:11:29 +02:00
* getkey.c (merge_selfsigs_main): Make sure the revocation key list starts
clean as this function may be called more than once (e.g. from functions in --edit). * g10.c, encode.c (encode_crypt), sign.c (sign_file, sign_symencrypt_file): Make --compress-algo work like the documentation says. It should be like --cipher-algo and --digest-algo in that it can override the preferences calculation and impose the setting the user wants. No --compress-algo setting allows the usual preferences calculation to take place. * main.h, compress.c (compress_filter): use new DEFAULT_COMPRESS_ALGO define, and add a sanity check for compress algo value.
This commit is contained in:
parent
4cb36096ec
commit
0c3ac11549
@ -1,3 +1,20 @@
|
|||||||
|
2002-05-09 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* getkey.c (merge_selfsigs_main): Make sure the revocation key
|
||||||
|
list starts clean as this function may be called more than once
|
||||||
|
(e.g. from functions in --edit).
|
||||||
|
|
||||||
|
* g10.c, encode.c (encode_crypt), sign.c (sign_file,
|
||||||
|
sign_symencrypt_file): Make --compress-algo work like the
|
||||||
|
documentation says. It should be like --cipher-algo and
|
||||||
|
--digest-algo in that it can override the preferences calculation
|
||||||
|
and impose the setting the user wants. No --compress-algo setting
|
||||||
|
allows the usual preferences calculation to take place.
|
||||||
|
|
||||||
|
* main.h, compress.c (compress_filter): use new
|
||||||
|
DEFAULT_COMPRESS_ALGO define, and add a sanity check for compress
|
||||||
|
algo value.
|
||||||
|
|
||||||
2002-05-08 David Shaw <dshaw@jabberwocky.com>
|
2002-05-08 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* pkclist.c (select_algo_from_prefs): There is an assumed
|
* pkclist.c (select_algo_from_prefs): There is an assumed
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
#include "main.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
|
||||||
@ -224,7 +225,9 @@ compress_filter( void *opaque, int control,
|
|||||||
PKT_compressed cd;
|
PKT_compressed cd;
|
||||||
|
|
||||||
if( !zfx->algo )
|
if( !zfx->algo )
|
||||||
zfx->algo = opt.def_compress_algo;
|
zfx->algo = DEFAULT_COMPRESS_ALGO;
|
||||||
|
if( zfx->algo != 1 && zfx->algo != 2 )
|
||||||
|
BUG();
|
||||||
memset( &cd, 0, sizeof cd );
|
memset( &cd, 0, sizeof cd );
|
||||||
cd.len = 0;
|
cd.len = 0;
|
||||||
cd.algorithm = zfx->algo;
|
cd.algorithm = zfx->algo;
|
||||||
|
24
g10/encode.c
24
g10/encode.c
@ -407,18 +407,20 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||||||
|
|
||||||
/* register the compress filter */
|
/* register the compress filter */
|
||||||
if( do_compress ) {
|
if( do_compress ) {
|
||||||
int compr_algo = select_algo_from_prefs( pk_list, PREFTYPE_ZIP );
|
int compr_algo = opt.def_compress_algo;
|
||||||
if( !compr_algo )
|
|
||||||
; /* don't use compression */
|
if(compr_algo==-1)
|
||||||
else {
|
{
|
||||||
if( compr_algo == 1 )
|
if((compr_algo=select_algo_from_prefs( pk_list, PREFTYPE_ZIP))==-1)
|
||||||
zfx.algo = 1;
|
compr_algo=DEFAULT_COMPRESS_ALGO;
|
||||||
if( compr_algo == 2 )
|
}
|
||||||
zfx.algo = 2;
|
|
||||||
/* Any other compr_algo will fall back to
|
/* algo 0 means no compression */
|
||||||
opt.def_compress_algo in the compress_filter. */
|
if( compr_algo )
|
||||||
|
{
|
||||||
|
zfx.algo = compr_algo;
|
||||||
iobuf_push_filter( out, compress_filter, &zfx );
|
iobuf_push_filter( out, compress_filter, &zfx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do the work */
|
/* do the work */
|
||||||
|
@ -808,7 +808,7 @@ main( int argc, char **argv )
|
|||||||
/* note: if you change these lines, look at oOpenPGP */
|
/* note: if you change these lines, look at oOpenPGP */
|
||||||
opt.def_cipher_algo = 0;
|
opt.def_cipher_algo = 0;
|
||||||
opt.def_digest_algo = 0;
|
opt.def_digest_algo = 0;
|
||||||
opt.def_compress_algo = 1;
|
opt.def_compress_algo = -1;
|
||||||
opt.s2k_mode = 3; /* iterated+salted */
|
opt.s2k_mode = 3; /* iterated+salted */
|
||||||
opt.s2k_digest_algo = DIGEST_ALGO_SHA1;
|
opt.s2k_digest_algo = DIGEST_ALGO_SHA1;
|
||||||
opt.s2k_cipher_algo = CIPHER_ALGO_CAST5;
|
opt.s2k_cipher_algo = CIPHER_ALGO_CAST5;
|
||||||
@ -1510,7 +1510,7 @@ main( int argc, char **argv )
|
|||||||
if( check_digest_algo(opt.s2k_digest_algo) )
|
if( check_digest_algo(opt.s2k_digest_algo) )
|
||||||
log_error(_("selected digest algorithm is invalid\n"));
|
log_error(_("selected digest algorithm is invalid\n"));
|
||||||
}
|
}
|
||||||
if( opt.def_compress_algo < 0 || opt.def_compress_algo > 2 )
|
if( opt.def_compress_algo < -1 || opt.def_compress_algo > 2 )
|
||||||
log_error(_("compress algorithm must be in range %d..%d\n"), 0, 2);
|
log_error(_("compress algorithm must be in range %d..%d\n"), 0, 2);
|
||||||
if( opt.completes_needed < 1 )
|
if( opt.completes_needed < 1 )
|
||||||
log_error(_("completes-needed must be greater than 0\n"));
|
log_error(_("completes-needed must be greater than 0\n"));
|
||||||
|
@ -1192,6 +1192,12 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
|||||||
/* first pass: find the latest direct key self-signature.
|
/* first pass: find the latest direct key self-signature.
|
||||||
* We assume that the newest one overrides all others
|
* We assume that the newest one overrides all others
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* In case this key was already merged */
|
||||||
|
m_free(pk->revkey);
|
||||||
|
pk->revkey=NULL;
|
||||||
|
pk->numrevkeys=0;
|
||||||
|
|
||||||
signode = NULL;
|
signode = NULL;
|
||||||
sigdate = 0; /* helper to find the latest signature */
|
sigdate = 0; /* helper to find the latest signature */
|
||||||
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next ) {
|
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next ) {
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
#include "cipher.h"
|
#include "cipher.h"
|
||||||
#include "keydb.h"
|
#include "keydb.h"
|
||||||
|
|
||||||
#define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5
|
#define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5
|
||||||
#define DEFAULT_PUBKEY_ALGO PUBKEY_ALGO_ELGAMAL
|
#define DEFAULT_PUBKEY_ALGO PUBKEY_ALGO_ELGAMAL
|
||||||
#define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1
|
#define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1
|
||||||
|
#define DEFAULT_COMPRESS_ALGO 1
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int header_okay;
|
int header_okay;
|
||||||
|
65
g10/sign.c
65
g10/sign.c
@ -596,7 +596,6 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
SK_LIST sk_rover = NULL;
|
SK_LIST sk_rover = NULL;
|
||||||
int multifile = 0;
|
int multifile = 0;
|
||||||
int old_style = opt.rfc1991;
|
int old_style = opt.rfc1991;
|
||||||
int compr_algo = -1; /* unknown */
|
|
||||||
u32 timestamp=0,duration=0;
|
u32 timestamp=0,duration=0;
|
||||||
|
|
||||||
memset( &afx, 0, sizeof afx);
|
memset( &afx, 0, sizeof afx);
|
||||||
@ -633,12 +632,8 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
opt.pgp2=0;
|
opt.pgp2=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( encryptflag ) {
|
if(encryptflag && (rc=build_pk_list( remusr, &pk_list, PUBKEY_USAGE_ENC )))
|
||||||
if( (rc=build_pk_list( remusr, &pk_list, PUBKEY_USAGE_ENC )) )
|
goto leave;
|
||||||
goto leave;
|
|
||||||
if( !old_style )
|
|
||||||
compr_algo = select_algo_from_prefs( pk_list, PREFTYPE_ZIP );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* prepare iobufs */
|
/* prepare iobufs */
|
||||||
if( multifile ) /* have list of filenames */
|
if( multifile ) /* have list of filenames */
|
||||||
@ -687,17 +682,31 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
iobuf_push_filter( out, encrypt_filter, &efx );
|
iobuf_push_filter( out, encrypt_filter, &efx );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( opt.compress && !outfile && ( !detached || opt.compress_sigs) ) {
|
if( opt.compress && !outfile && ( !detached || opt.compress_sigs) )
|
||||||
if( !compr_algo )
|
{
|
||||||
; /* don't use compression */
|
int compr_algo=opt.def_compress_algo;
|
||||||
else {
|
|
||||||
if( old_style
|
/* If not forced by user */
|
||||||
|| compr_algo == 1
|
if(compr_algo==-1)
|
||||||
|| (compr_algo == -1 && !encryptflag) )
|
{
|
||||||
zfx.algo = 1; /* use the non optional algorithm */
|
/* If we're not encrypting, then select_algo_from_prefs
|
||||||
|
will fail and we'll end up with the default. If we are
|
||||||
|
encrypting, select_algo_from_prefs cannot fail since
|
||||||
|
there is an assumed preference for uncompressed data.
|
||||||
|
Still, if it did fail, we'll also end up with the
|
||||||
|
default. */
|
||||||
|
|
||||||
|
if((compr_algo=select_algo_from_prefs( pk_list, PREFTYPE_ZIP))==-1)
|
||||||
|
compr_algo=DEFAULT_COMPRESS_ALGO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* algo 0 means no compression */
|
||||||
|
if( compr_algo )
|
||||||
|
{
|
||||||
|
zfx.algo = compr_algo;
|
||||||
iobuf_push_filter( out, compress_filter, &zfx );
|
iobuf_push_filter( out, compress_filter, &zfx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the one-pass signature packets if needed */
|
/* Write the one-pass signature packets if needed */
|
||||||
if (!detached && !opt.rfc1991) {
|
if (!detached && !opt.rfc1991) {
|
||||||
@ -925,7 +934,6 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
SK_LIST sk_list = NULL;
|
SK_LIST sk_list = NULL;
|
||||||
SK_LIST sk_rover = NULL;
|
SK_LIST sk_rover = NULL;
|
||||||
int old_style = opt.rfc1991;
|
int old_style = opt.rfc1991;
|
||||||
int compr_algo = -1; /* unknown */
|
|
||||||
int algo;
|
int algo;
|
||||||
u32 timestamp=0,duration=0;
|
u32 timestamp=0,duration=0;
|
||||||
|
|
||||||
@ -1011,15 +1019,20 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
iobuf_push_filter( out, cipher_filter, &cfx );
|
iobuf_push_filter( out, cipher_filter, &cfx );
|
||||||
|
|
||||||
/* Push the Zip filter */
|
/* Push the Zip filter */
|
||||||
if (opt.compress) {
|
if (opt.compress)
|
||||||
if (!compr_algo)
|
{
|
||||||
; /* don't use compression */
|
int compr_algo=opt.def_compress_algo;
|
||||||
else {
|
|
||||||
if( old_style || compr_algo == 1 )
|
/* Default */
|
||||||
zfx.algo = 1; /* use the non optional algorithm */
|
if(compr_algo==-1)
|
||||||
|
compr_algo=DEFAULT_COMPRESS_ALGO;
|
||||||
|
|
||||||
|
if (compr_algo)
|
||||||
|
{
|
||||||
|
zfx.algo = compr_algo;
|
||||||
iobuf_push_filter( out, compress_filter, &zfx );
|
iobuf_push_filter( out, compress_filter, &zfx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the one-pass signature packets */
|
/* Write the one-pass signature packets */
|
||||||
/*(current filters: zip - encrypt - armor)*/
|
/*(current filters: zip - encrypt - armor)*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user