diff options
Diffstat (limited to 'agent')
-rw-r--r-- | agent/ChangeLog | 5 | ||||
-rw-r--r-- | agent/minip12.c | 27 | ||||
-rw-r--r-- | agent/protect-tool.c | 2 |
3 files changed, 28 insertions, 6 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog index 22846f3bd..f72bd50c9 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,8 @@ +2004-09-29 Werner Koch <[email protected]> + + * minip12.c (parse_bag_encrypted_data): Print error if a bad + passphrase has been given. + 2004-09-28 Werner Koch <[email protected]> * protect.c (agent_unprotect): Fixed wiping of CLEARTEXT. Thanks diff --git a/agent/minip12.c b/agent/minip12.c index e32a40de2..fc9b26dd1 100644 --- a/agent/minip12.c +++ b/agent/minip12.c @@ -379,7 +379,6 @@ crypt_block (unsigned char *buffer, size_t length, char *salt, int iter, - static int parse_bag_encrypted_data (const unsigned char *buffer, size_t length, int startoffset, const char *pw, @@ -393,8 +392,8 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length, char salt[8]; unsigned int iter; unsigned char *plain = NULL; - - + int bad_pass = 0; + where = "start"; if (parse_tag (&p, &n, &ti)) goto bailout; @@ -495,12 +494,21 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length, where = "outer.outer.seq"; if (parse_tag (&p, &n, &ti)) - goto bailout; + { + bad_pass = 1; + goto bailout; + } if (ti.class || ti.tag != TAG_SEQUENCE) - goto bailout; + { + bad_pass = 1; + goto bailout; + } if (parse_tag (&p, &n, &ti)) - goto bailout; + { + bad_pass = 1; + goto bailout; + } /* Loop over all certificates inside the bab. */ while (n) @@ -611,6 +619,13 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length, gcry_free (plain); log_error ("encryptedData error at \"%s\", offset %u\n", where, (p - buffer)+startoffset); + if (bad_pass) + { + /* Note, that the following string might be used by other programs + to check for a bad passphrase; it should therefore not be + translated or changed. */ + log_error ("possibly bad passphrase given\n"); + } return -1; } diff --git a/agent/protect-tool.c b/agent/protect-tool.c index 7cfb760b8..286adde54 100644 --- a/agent/protect-tool.c +++ b/agent/protect-tool.c @@ -882,6 +882,8 @@ export_p12_file (const char *fname) release_passphrase (pw); if (rc) { + if (opt_status_msg && gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE ) + log_info ("[PROTECT-TOOL:] bad-passphrase\n"); log_error ("unprotecting key `%s' failed: %s\n", fname, gpg_strerror (rc)); xfree (key); |