1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

* sign.c (hash_for, sign_file): When encrypting and signing at the same

time, consult the various hash prefs to pick a hash algorithm to use.
Pass in a 160-bit hint if any of the signing keys are DSA.

* keydb.h, pkclist.c (select_algo_from_prefs, algo_available): Pass a
"hints" opaque pointer in to let the caller give hints as to what
algorithms would be acceptable.  The only current hint is for
PREFTYPE_HASH to require a 160-bit hash for DSA.  Change all callers in
encode.c (encode_crypt, encrypt_filter) and sign.c (sign_file).  If we
settle on MD5 as the best algorithm based solely on recepient keys and
SHA1 is also a possibility, use SHA1 unless the user intentionally chose
MD5.  This is as per 2440:13.

* exec.c (make_tempdir): Fix duplicated filename problem.
This commit is contained in:
David Shaw 2002-06-04 23:18:37 +00:00
parent ae02cf4630
commit fd08b13528
6 changed files with 115 additions and 20 deletions

View file

@ -336,7 +336,7 @@ encode_crypt( const char *filename, STRLIST remusr )
/* create a session key */
cfx.dek = m_alloc_secure_clear (sizeof *cfx.dek);
if( !opt.def_cipher_algo ) { /* try to get it from the prefs */
cfx.dek->algo = select_algo_from_prefs( pk_list, PREFTYPE_SYM );
cfx.dek->algo = select_algo_from_prefs( pk_list, PREFTYPE_SYM, NULL );
/* The only way select_algo_from_prefs can fail here is when
mixing v3 and v4 keys, as v4 keys have an implicit
preference entry for 3DES, and the pk_list cannot be empty.
@ -415,7 +415,8 @@ encode_crypt( const char *filename, STRLIST remusr )
if(compr_algo==-1)
{
if((compr_algo=select_algo_from_prefs( pk_list, PREFTYPE_ZIP))==-1)
if((compr_algo=
select_algo_from_prefs(pk_list,PREFTYPE_ZIP,NULL))==-1)
compr_algo=DEFAULT_COMPRESS_ALGO;
}
@ -485,7 +486,7 @@ encrypt_filter( void *opaque, int control,
if( !opt.def_cipher_algo ) { /* try to get it from the prefs */
efx->cfx.dek->algo =
select_algo_from_prefs( efx->pk_list, PREFTYPE_SYM );
select_algo_from_prefs( efx->pk_list, PREFTYPE_SYM, NULL );
if( efx->cfx.dek->algo == -1 ) {
/* because 3DES is implicitly in the prefs, this can only
* happen if we do not have any public keys in the list */