diff options
author | David Shaw <[email protected]> | 2004-06-27 18:26:49 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-06-27 18:26:49 +0000 |
commit | eb5045d97229806be11184d2ef85fa6ca212bdca (patch) | |
tree | b2325fff6a032a0442bc4a04e14590a7be0d119a | |
parent | * keyedit.c (sign_uids): Properly handle remaking a self-sig on revoked or (diff) | |
download | gnupg-eb5045d97229806be11184d2ef85fa6ca212bdca.tar.gz gnupg-eb5045d97229806be11184d2ef85fa6ca212bdca.zip |
* mainproc.c (proc_symkey_enc), seckey-cert.c (do_check): Check the S2K
hash algorithm before we try to generate a passphrase using it. This
prevents hitting BUG() when generating a passphrase using a hash that we
don't have.
-rw-r--r-- | g10/ChangeLog | 7 | ||||
-rw-r--r-- | g10/mainproc.c | 7 | ||||
-rw-r--r-- | g10/seckey-cert.c | 6 |
3 files changed, 20 insertions, 0 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 109ec874d..5e3e2bb81 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2004-06-27 David Shaw <[email protected]> + + * mainproc.c (proc_symkey_enc), seckey-cert.c (do_check): Check + the S2K hash algorithm before we try to generate a passphrase + using it. This prevents hitting BUG() when generating a + passphrase using a hash that we don't have. + 2004-06-23 David Shaw <[email protected]> * keyedit.c (sign_uids): Properly handle remaking a self-sig on diff --git a/g10/mainproc.c b/g10/mainproc.c index 674a376f1..9b7a4ddc3 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -304,6 +304,13 @@ proc_symkey_enc( CTX c, PACKET *pkt ) else log_error(_("encrypted with unknown algorithm %d\n"), algo ); + if(check_digest_algo(enc->s2k.hash_algo)) + { + log_error(_("passphrase generated with unknown digest" + " algorithm %d\n"),enc->s2k.hash_algo); + s=NULL; + } + c->last_was_session_key = 2; if(!s || opt.list_only) goto leave; diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c index 4a949b88e..8870ac3e3 100644 --- a/g10/seckey-cert.c +++ b/g10/seckey-cert.c @@ -65,6 +65,12 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int *canceled ) } return G10ERR_CIPHER_ALGO; } + if(check_digest_algo(sk->protect.s2k.hash_algo)) + { + log_info(_("protection digest %d is not supported\n"), + sk->protect.s2k.hash_algo); + return G10ERR_DIGEST_ALGO; + } keyid_from_sk( sk, keyid ); keyid[2] = keyid[3] = 0; if( !sk->is_primary ) { |