]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Gracefully degrade in the absence of CryptProtectMemory.
authorSimon Tatham <anakin@pobox.com>
Mon, 18 Nov 2013 19:07:58 +0000 (19:07 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 18 Nov 2013 19:07:58 +0000 (19:07 +0000)
XP doesn't have it, and I think having connection sharing work without
its privacy enhancement is better than having it not work at all.

git-svn-id: http://svn.tartarus.org/sgt/putty@10087 cda61777-01e9-0310-a592-d414129be87e

windows/winshare.c

index ad1cea4d6e06f9aa55f8a7b397cded236e6f74c9..1ad20ba1148150afbaffb81083106cb42092206c 100644 (file)
@@ -56,11 +56,17 @@ static char *obfuscate_name(const char *realname)
      * key every time since its API permits returning more data than
      * was input, so calling _that_ and hashing the output would not
      * be stable.)
+     *
+     * We don't worry too much if this doesn't work for some reason.
+     * Omitting this step still has _some_ privacy value (in that
+     * another user can test-hash things to confirm guesses as to
+     * where you might be connecting to, but cannot invert SHA-256 in
+     * the absence of any plausible guess). So we don't abort if we
+     * can't call CryptProtectMemory at all, or if it fails.
      */
-    if (!p_CryptProtectMemory(cryptdata, cryptlen,
-                              CRYPTPROTECTMEMORY_CROSS_PROCESS)) {
-        return NULL;
-    }
+    if (got_crypt())
+        p_CryptProtectMemory(cryptdata, cryptlen,
+                             CRYPTPROTECTMEMORY_CROSS_PROCESS);
 
     /*
      * We don't want to give away the length of the hostname either,
@@ -111,11 +117,6 @@ int platform_ssh_share(const char *pi_name, Conf *conf,
     PACL acl;
     PSID networksid;
 
-    if (!got_crypt()) {
-        *logtext = dupprintf("Unable to load crypt32.dll");
-        return SHARE_NONE;
-    }
-
     /*
      * Transform the platform-independent version of the connection
      * identifier into the obfuscated version we'll use for our