mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* main.h, misc.c (default_cipher_algo, default_compress_algo): New.
Return the default algorithm by trying --cipher-algo/--compress-algo, then the first item in the pref list, then s2k-cipher-algo or ZIP. * sign.c (sign_file, sign_symencrypt_file), encode.c (encode_simple, encode_crypt): Call default_cipher_algo and default_compress_algo to get algorithms. * g10.c (main): Allow pref selection for compress algo with --openpgp.
This commit is contained in:
parent
bd23076c5e
commit
0819797911
6 changed files with 50 additions and 23 deletions
13
g10/encode.c
13
g10/encode.c
|
@ -194,8 +194,7 @@ encode_simple( const char *filename, int mode, int compat )
|
|||
s2k->mode = opt.rfc1991? 0:opt.s2k_mode;
|
||||
s2k->hash_algo = opt.s2k_digest_algo;
|
||||
cfx.dek = passphrase_to_dek( NULL, 0,
|
||||
opt.def_cipher_algo ? opt.def_cipher_algo
|
||||
: opt.s2k_cipher_algo , s2k, 2, NULL );
|
||||
default_cipher_algo(), s2k, 2, NULL );
|
||||
if( !cfx.dek || !cfx.dek->keylen ) {
|
||||
rc = G10ERR_PASSPHRASE;
|
||||
m_free(cfx.dek);
|
||||
|
@ -211,9 +210,7 @@ encode_simple( const char *filename, int mode, int compat )
|
|||
}
|
||||
|
||||
if ( !compat ) {
|
||||
seskeylen = cipher_get_keylen( opt.def_cipher_algo ?
|
||||
opt.def_cipher_algo:
|
||||
opt.s2k_cipher_algo ) / 8;
|
||||
seskeylen = cipher_get_keylen( default_cipher_algo() ) / 8;
|
||||
encode_sesskey( cfx.dek, &dek, enckey );
|
||||
m_free( cfx.dek ); cfx.dek = dek;
|
||||
}
|
||||
|
@ -332,9 +329,7 @@ encode_simple( const char *filename, int mode, int compat )
|
|||
{
|
||||
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;
|
||||
zfx.algo=default_compress_algo();
|
||||
iobuf_push_filter( out, compress_filter, &zfx );
|
||||
}
|
||||
|
||||
|
@ -564,6 +559,8 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||
if((compr_algo=
|
||||
select_algo_from_prefs(pk_list,PREFTYPE_ZIP,-1,NULL))==-1)
|
||||
compr_algo=DEFAULT_COMPRESS_ALGO;
|
||||
/* Theoretically impossible to get here since uncompressed
|
||||
is implicit. */
|
||||
}
|
||||
else if(!opt.expert &&
|
||||
select_algo_from_prefs(pk_list,PREFTYPE_ZIP,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue