diff options
author | David Shaw <[email protected]> | 2002-11-25 04:24:41 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2002-11-25 04:24:41 +0000 |
commit | 0819797911d6d7c75a6a60e4fc331892ca4ced87 (patch) | |
tree | c47c601b680edc4905c6c35e35776e815246ecd7 /g10/encode.c | |
parent | * mainproc.c (proc_encrypted): Use --s2k-digest-algo for passphrase (diff) | |
download | gnupg-0819797911d6d7c75a6a60e4fc331892ca4ced87.tar.gz gnupg-0819797911d6d7c75a6a60e4fc331892ca4ced87.zip |
* 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.
Diffstat (limited to '')
-rw-r--r-- | g10/encode.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/g10/encode.c b/g10/encode.c index a2ca43fb1..5550af4a7 100644 --- a/g10/encode.c +++ b/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, |