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
25
g10/misc.c
25
g10/misc.c
|
@ -565,3 +565,28 @@ check_compress_algo(int algo)
|
|||
|
||||
return G10ERR_COMPR_ALGO;
|
||||
}
|
||||
|
||||
int
|
||||
default_cipher_algo(void)
|
||||
{
|
||||
if(opt.def_cipher_algo)
|
||||
return opt.def_cipher_algo;
|
||||
else if(opt.personal_cipher_prefs)
|
||||
return opt.personal_cipher_prefs[0].value;
|
||||
else
|
||||
return opt.s2k_cipher_algo;
|
||||
}
|
||||
|
||||
/* There is no default_digest_algo function, but see
|
||||
sign.c:hash_for */
|
||||
|
||||
int
|
||||
default_compress_algo(void)
|
||||
{
|
||||
if(opt.def_compress_algo!=-1)
|
||||
return opt.def_compress_algo;
|
||||
else if(opt.personal_compress_prefs)
|
||||
return opt.personal_compress_prefs[0].value;
|
||||
else
|
||||
return DEFAULT_COMPRESS_ALGO;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue