diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 6 | ||||
-rw-r--r-- | g10/mainproc.c | 6 | ||||
-rw-r--r-- | g10/passphrase.c | 14 |
3 files changed, 18 insertions, 8 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index e1c3c4a24..a060710bc 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,9 @@ +2001-01-12 Werner Koch <[email protected]> + + * passphrase.c (passphrase_to_dek): Use MD5 when IDEA is installed + and we have no S2K. + * mainproc.c (proc_encrypted): Likewise + 2001-01-11 Werner Koch <[email protected]> * sig-check.c (do_check): Print the signature key expire message diff --git a/g10/mainproc.c b/g10/mainproc.c index 1e780de4a..bb990a032 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -408,9 +408,11 @@ proc_encrypted( CTX c, PACKET *pkt ) if( opt.list_only ) result = -1; else if( !c->dek && !c->last_was_session_key ) { + int def_algo; /* assume this is old conventional encrypted data - * Actually we should use IDEA and MD5 in this case, but because - * IDEA is patented we can't do so */ + * We use IDEA here if it is installed */ + def_algo = check_cipher_algo (CIPHER_ALGO_IDEA)? + DEFAULT_CIPHER_ALGO : CIPHER_ALGO_IDEA; c->dek = passphrase_to_dek( NULL, 0, opt.def_cipher_algo ? opt.def_cipher_algo : DEFAULT_CIPHER_ALGO, NULL, 0 ); diff --git a/g10/passphrase.c b/g10/passphrase.c index 67db368e4..395703c03 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -509,14 +509,16 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo, STRING2KEY help_s2k; if( !s2k ) { + int def_algo; + s2k = &help_s2k; s2k->mode = 0; - /* this should be MD5 if cipher is IDEA, but because we do - * not have IDEA, we use the default one, the user - * can select it from the commandline - */ - s2k->hash_algo = opt.def_digest_algo?opt.def_digest_algo - :DEFAULT_DIGEST_ALGO; + /* If we have IDEA installed we use MD5 otherwise the default + * hash algorithm. This can always be overriden from the + * commandline */ + def_algo = check_cipher_algo (CIPHER_ALGO_IDEA)? + DEFAULT_DIGEST_ALGO : DIGEST_ALGO_MD5; + s2k->hash_algo = opt.def_digest_algo? opt.def_digest_algo : def_algo; } if( !next_pw && is_status_enabled() ) { |