Browse Source

Updating code to PuTTY 80f2f6e7

Source commit: 32884a7340e6fdbb5133b98e6eadc152d318b551
Martin Prikryl 6 năm trước cách đây
mục cha
commit
c2cb9ee96d
5 tập tin đã thay đổi với 15 bổ sung3 xóa
  1. 3 0
      source/Putty.cbproj
  2. 2 0
      source/putty/ecc.c
  3. 2 0
      source/putty/mpint.c
  4. 1 1
      source/putty/sshccp.c
  5. 7 2
      source/putty/sshrsa.c

+ 3 - 0
source/Putty.cbproj

@@ -319,6 +319,9 @@
 			<BuildOrder>92</BuildOrder>
 			<BuildOrder>14</BuildOrder>
 		</CppCompile>
+		<CppCompile Include="putty\WINDOWS\winmiscs.c">
+			<BuildOrder>76</BuildOrder>
+		</CppCompile>
 		<CppCompile Include="putty\windows\winnet.c">
 			<BuildOrder>95</BuildOrder>
 			<BuildOrder>17</BuildOrder>

+ 2 - 0
source/putty/ecc.c

@@ -157,6 +157,7 @@ WeierstrassPoint *ecc_weierstrass_point_new_from_x(
     mp_free(x2_plus_a);
     mp_free(x3_plus_ax);
 
+    { // WINSCP
     mp_int *y = monty_modsqrt(wc->sc, rhs, &success);
     mp_free(rhs);
 
@@ -184,6 +185,7 @@ WeierstrassPoint *ecc_weierstrass_point_new_from_x(
     } // WINSCP
 
     return ecc_weierstrass_point_new_imported(wc, x, y);
+    } // WINSCP
 }
 
 static void ecc_weierstrass_cond_overwrite(

+ 2 - 0
source/putty/mpint.c

@@ -2200,12 +2200,14 @@ mp_int *mp_modsub(mp_int *x, mp_int *y, mp_int *modulus)
     /* If we've just negated the residue, then it will be < 0 and need
      * the modulus adding to it to make it positive - *except* if the
      * residue was zero when we negated it. */
+    { // WINSCP
     unsigned make_positive = negate & ~mp_eq_integer(residue, 0);
     mp_cond_add_into(residue, residue, modulus, make_positive);
     mp_free(diff);
     return residue;
     } // WINSCP
     } // WINSCP
+    } // WINSCP
 }
 
 static mp_int *mp_modadd_in_range(mp_int *x, mp_int *y, mp_int *modulus)

+ 1 - 1
source/putty/sshccp.c

@@ -774,7 +774,7 @@ static void poly1305_init(struct poly1305 *ctx)
 
 static void poly1305_key(struct poly1305 *ctx, ptrlen key)
 {
-    assert(key.len == 32);             /* Takes a 256 bit key */
+    pinitassert(key.len == 32);             /* Takes a 256 bit key */
 
     unsigned char key_copy[16];
     memcpy(key_copy, key.ptr, 16);

+ 7 - 2
source/putty/sshrsa.c

@@ -255,10 +255,13 @@ char *rsa_ssh1_fingerprint(RSAKey *key)
      */
 
     MD5Init(&md5c);
-    for (size_t i = (mp_get_nbits(key->modulus) + 7) / 8; i-- > 0 ;)
+    { // WINSCP
+    size_t i; // WINSCP
+    for (i = (mp_get_nbits(key->modulus) + 7) / 8; i-- > 0 ;)
         put_byte(&md5c, mp_get_byte(key->modulus, i));
-    for (size_t i = (mp_get_nbits(key->exponent) + 7) / 8; i-- > 0 ;)
+    for (i = (mp_get_nbits(key->exponent) + 7) / 8; i-- > 0 ;)
         put_byte(&md5c, mp_get_byte(key->exponent, i));
+    } // WINSCP
     MD5Final(digest, &md5c);
 
     out = strbuf_new();
@@ -817,6 +820,7 @@ strbuf *ssh_rsakex_encrypt(RSAKey *rsa, const ssh_hashalg *h, ptrlen in)
     assert(in.len > 0 && in.len <= k - 2*HLEN - 2);
 
     /* The length of the output data wants to be precisely k. */
+    { // WINSCP
     strbuf *toret = strbuf_new();
     int outlen = k;
     unsigned char *out = strbuf_append(toret, outlen);
@@ -869,6 +873,7 @@ strbuf *ssh_rsakex_encrypt(RSAKey *rsa, const ssh_hashalg *h, ptrlen in)
      * And we're done.
      */
     return toret;
+    } // WINSCP
 }
 
 mp_int *ssh_rsakex_decrypt(