]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
When loading SSH-2 key, ignore passphrase argument if key is unencrypted.
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Tue, 2 Sep 2003 19:00:17 +0000 (19:00 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Tue, 2 Sep 2003 19:00:17 +0000 (19:00 +0000)
This should get rid of a problem that three or four people reported where
PuTTY intermittently reports "Unable to load private key" (MAC failed).

(ssh.c:do_ssh2_authconn() should also initialise its passphrase so it's not
passing garbage passphrases around, of course, but I haven't yet worked out
where the best place in the auth loop to do that would be.)

[originally from svn r3439]

sshpubk.c

index 1659aceca8cf5f82cfe639a8766be049b3adfaa2..3975e0fe636937f3cd9ffaa2823c3ced9c3c8d12 100644 (file)
--- a/sshpubk.c
+++ b/sshpubk.c
@@ -784,7 +784,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
 
            SHA_Init(&s);
            SHA_Bytes(&s, header, sizeof(header)-1);
-           if (passphrase)
+           if (cipher && passphrase)
                SHA_Bytes(&s, passphrase, passlen);
            SHA_Final(&s, mackey);