aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog7
-rw-r--r--g10/mainproc.c7
-rw-r--r--g10/seckey-cert.c6
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 ) {