]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Merge branch 'pre-0.64'
authorSimon Tatham <anakin@pobox.com>
Sat, 28 Feb 2015 07:57:58 +0000 (07:57 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 28 Feb 2015 07:57:58 +0000 (07:57 +0000)
Buildscr
LATEST.VER
doc/plink.but
doc/pscp.but
ssh.c
ssh.h
sshdh.c
sshpubk.c
windows/putty.iss

index cce7ba319b14b5f2febc9f588e3d8dac1d7e33d7..bfb7fc4015b8f25afef2e12e5573f68f7818f3b5 100644 (file)
--- a/Buildscr
+++ b/Buildscr
@@ -35,7 +35,7 @@ module putty
 ifeq "$(RELEASE)" "" set Ndate $(!builddate)
 ifneq "$(Ndate)" "" in . do echo $(Ndate) | perl -pe 's/(....)(..)(..)/$$1-$$2-$$3/' > date
 ifneq "$(Ndate)" "" read Date date
-set Epoch 6000 # update this at every release
+set Epoch 15493 # update this at every release
 ifneq "$(Ndate)" "" in . do echo $(Ndate) | perl -ne 'use Time::Local; /(....)(..)(..)/ and print timegm(0,0,0,$$3,$$2-1,$$1) / 86400 - $(Epoch)' > days
 ifneq "$(Ndate)" "" read Days days
 
index 21b86bac26056dcb65e318e2904e9d93247a3600..8be42893fe3beee7457737d24bb2a3b1c1f7437c 100644 (file)
@@ -1 +1 @@
-0.63
+0.64
index b09cd1928b069cb494b21d659944282a469b3929..1ae042265b77b4d7bf0cd73edc73fa69b7a2645f 100644 (file)
@@ -41,7 +41,7 @@ use Plink:
 
 \c Z:\sysosd>plink
 \c Plink: command-line connection utility
-\c Release 0.XX
+\c Release 0.64
 \c Usage: plink [options] [user@]host [command]
 \c        ("host" can also be a PuTTY saved session name)
 \c Options:
index 41fa124ef7358cfeaff7d6696c62b7cfa4a5b694..c4a0b8b8c1ee867db10daace4458eb8f996efbe3 100644 (file)
@@ -39,7 +39,7 @@ use PSCP:
 
 \c Z:\owendadmin>pscp
 \c PuTTY Secure Copy client
-\c Release 0.XX
+\c Release 0.64
 \c Usage: pscp [options] [user@]host:source target
 \c        pscp [options] source [source...] [user@]host:target
 \c        pscp [options] -ls [user@]host:filespec
diff --git a/ssh.c b/ssh.c
index c4c4fb9054e2aa7f2f3dbbbd0aa226e4cb7fa9d8..d8a873005c71119b5f0b13b93c4cd5cbb5e15aba 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -6648,6 +6648,13 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen,
         }
         ssh_pkt_getstring(pktin, &s->sigdata, &s->siglen);
 
+        {
+            const char *err = dh_validate_f(ssh->kex_ctx, s->f);
+            if (err) {
+                bombout(("key exchange reply failed validation: %s", err));
+                crStopV;
+            }
+        }
         s->K = dh_find_K(ssh->kex_ctx, s->f);
 
         /* We assume everything from now on will be quick, and it might
diff --git a/ssh.h b/ssh.h
index 2f4dd61c900198f0adedc2e6fad7460f0badd1ac..1b7d1f35d07c2de8a0be028bea625d1864e3e29b 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -596,6 +596,7 @@ void *dh_setup_group(const struct ssh_kex *kex);
 void *dh_setup_gex(Bignum pval, Bignum gval);
 void dh_cleanup(void *);
 Bignum dh_create_e(void *, int nbits);
+const char *dh_validate_f(void *handle, Bignum f);
 Bignum dh_find_K(void *, Bignum f);
 
 int loadrsakey(const Filename *filename, struct RSAKey *key,
diff --git a/sshdh.c b/sshdh.c
index c733b61f7e77fe8f3f0f5ea4f5f7a3364274382d..8f8ab2d26aa6ef9ad7e5fe74710edca473272245 100644 (file)
--- a/sshdh.c
+++ b/sshdh.c
@@ -218,6 +218,29 @@ Bignum dh_create_e(void *handle, int nbits)
     return ctx->e;
 }
 
+/*
+ * DH stage 2-epsilon: given a number f, validate it to ensure it's in
+ * range. (RFC 4253 section 8: "Values of 'e' or 'f' that are not in
+ * the range [1, p-1] MUST NOT be sent or accepted by either side."
+ * Also, we rule out 1 and p-1 too, since that's easy to do and since
+ * they lead to obviously weak keys that even a passive eavesdropper
+ * can figure out.)
+ */
+const char *dh_validate_f(void *handle, Bignum f)
+{
+    struct dh_ctx *ctx = (struct dh_ctx *)handle;
+    if (bignum_cmp(f, One) <= 0) {
+        return "f value received is too small";
+    } else {
+        Bignum pm1 = bigsub(ctx->p, One);
+        int cmp = bignum_cmp(f, pm1);
+        freebn(pm1);
+        if (cmp >= 0)
+            return "f value received is too large";
+    }
+    return NULL;
+}
+
 /*
  * DH stage 2: given a number f, compute K = f^x mod p.
  */
index cd35afd5ad2a15265324b03fa22bdedfeb4779f5..11182283f53f7a84db0cfe22d331982ed3a86f37 100644 (file)
--- a/sshpubk.c
+++ b/sshpubk.c
@@ -67,7 +67,7 @@ static int loadrsakey_main(FILE * fp, struct RSAKey *key, int pub_only,
     i += 4;
 
     /* Now the serious stuff. An ordinary SSH-1 public key. */
-    j = makekey(buf + i, len, key, NULL, 1);
+    j = makekey(buf + i, len - i, key, NULL, 1);
     if (j < 0)
        goto end;                      /* overran */
     i += j;
@@ -802,6 +802,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
        goto error;
     }
     sfree(public_blob);
+    smemclr(private_blob, private_blob_len);
     sfree(private_blob);
     sfree(encryption);
     if (errorstr)
@@ -822,8 +823,10 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
        sfree(mac);
     if (public_blob)
        sfree(public_blob);
-    if (private_blob)
-       sfree(private_blob);
+    if (private_blob) {
+        smemclr(private_blob, private_blob_len);
+        sfree(private_blob);
+    }
     if (errorstr)
        *errorstr = error;
     return ret;
@@ -1112,8 +1115,14 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
     }
 
     fp = f_open(filename, "w", TRUE);
-    if (!fp)
-       return 0;
+    if (!fp) {
+        sfree(pub_blob);
+        smemclr(priv_blob, priv_blob_len);
+        sfree(priv_blob);
+        smemclr(priv_blob_encrypted, priv_blob_len);
+        sfree(priv_blob_encrypted);
+        return 0;
+    }
     fprintf(fp, "PuTTY-User-Key-File-2: %s\n", key->alg->name);
     fprintf(fp, "Encryption: %s\n", cipherstr);
     fprintf(fp, "Comment: %s\n", key->comment);
@@ -1130,6 +1139,7 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
     sfree(pub_blob);
     smemclr(priv_blob, priv_blob_len);
     sfree(priv_blob);
+    smemclr(priv_blob_encrypted, priv_blob_len);
     sfree(priv_blob_encrypted);
     return 1;
 }
index d66f99cec38d79c60d9007546512c1c6c670d199..627887fef9aff8a25c7d82253f8bf3b8807cb704 100644 (file)
 \r
 [Setup]\r
 AppName=PuTTY\r
-AppVerName=PuTTY version 0.63\r
-VersionInfoTextVersion=Release 0.63\r
-AppVersion=0.63\r
-VersionInfoVersion=0.63.0.0\r
+AppVerName=PuTTY version 0.64\r
+VersionInfoTextVersion=Release 0.64\r
+AppVersion=0.64\r
+VersionInfoVersion=0.64.0.0\r
 AppPublisher=Simon Tatham\r
 AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/putty/\r
 AppReadmeFile={app}\README.txt\r