aboutsummaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/passphrase.c')
-rw-r--r--g10/passphrase.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index c626e9adc..c6c7cb27d 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -513,16 +513,14 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo,
STRING2KEY help_s2k;
if( !s2k ) {
- int def_algo;
+ /* This is used for the old rfc1991 mode
+ * Note: This must match the code in encode.c with opt.rfc1991 set */
+ int algo = opt.def_digest_algo ? opt.def_digest_algo
+ : opt.s2k_digest_algo;
s2k = &help_s2k;
s2k->mode = 0;
- /* 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;
+ s2k->hash_algo = algo;
}
if( !next_pw && is_status_enabled() ) {
@@ -632,7 +630,7 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo,
if( !pw || !*pw )
write_status( STATUS_MISSING_PASSPHRASE );
- dek = m_alloc_secure( sizeof *dek );
+ dek = m_alloc_secure_clear ( sizeof *dek );
dek->algo = cipher_algo;
if( !*pw && mode == 2 )
dek->keylen = 0;