diff options
Diffstat (limited to 'g10/sign.c')
-rw-r--r-- | g10/sign.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/g10/sign.c b/g10/sign.c index 4793dd137..8d575a100 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -583,7 +583,7 @@ hash_for (PKT_public_key *pk) { return opt.def_digest_algo; } - else if (recipient_digest_algo) + else if (recipient_digest_algo && !is_weak_digest (recipient_digest_algo)) { return recipient_digest_algo; } @@ -1095,10 +1095,13 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr, single hash for all signatures. All this may well have to change as the cards add algorithms. */ - if (!smartcard || (smartcard && hint.digest_length==20)) - if ( (algo= - select_algo_from_prefs(pk_list,PREFTYPE_HASH,-1,&hint)) > 0) - recipient_digest_algo=algo; + if (!smartcard || (smartcard && hint.digest_length==20) + && (algo = select_algo_from_prefs(pk_list,PREFTYPE_HASH, + -1,&hint)) > 0) + { + /* Note that we later check that the algo is not weak. */ + recipient_digest_algo = algo; + } } } |