[ros-diffs] [cwittich] 38373: sync rsaenh to wine 1.1.11

cwittich at svn.reactos.org cwittich at svn.reactos.org
Sat Dec 27 11:11:34 CET 2008


Author: cwittich
Date: Sat Dec 27 04:11:34 2008
New Revision: 38373

URL: http://svn.reactos.org/svn/reactos?rev=38373&view=rev
Log:
sync rsaenh to wine 1.1.11

Modified:
    trunk/reactos/dll/win32/rsaenh/md2.c
    trunk/reactos/dll/win32/rsaenh/mpi.c
    trunk/reactos/dll/win32/rsaenh/rc2.c
    trunk/reactos/dll/win32/rsaenh/rsaenh.c
    trunk/reactos/dll/win32/rsaenh/tomcrypt.h

Modified: trunk/reactos/dll/win32/rsaenh/md2.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/md2.c?rev=38373&r1=38372&r2=38373&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rsaenh/md2.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rsaenh/md2.c [iso-8859-1] Sat Dec 27 04:11:34 2008
@@ -77,7 +77,7 @@
        md2->X[32+j] = md2->X[j] ^ md2->X[16+j];
    }
 
-   t = (unsigned char)0;
+   t = 0;
 
    /* do 18 rounds */
    for (j = 0; j < 18; j++) {

Modified: trunk/reactos/dll/win32/rsaenh/mpi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/mpi.c?rev=38373&r1=38372&r2=38373&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rsaenh/mpi.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rsaenh/mpi.c [iso-8859-1] Sat Dec 27 04:11:34 2008
@@ -39,13 +39,26 @@
 static const int KARATSUBA_MUL_CUTOFF = 88,  /* Min. number of digits before Karatsuba multiplication is used. */
                  KARATSUBA_SQR_CUTOFF = 128; /* Min. number of digits before Karatsuba squaring is used. */
 
+static void bn_reverse(unsigned char *s, int len);
+static int s_mp_add(mp_int *a, mp_int *b, mp_int *c);
+static int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y);
+#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
+static int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
+static int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
+static int s_mp_sqr(const mp_int *a, mp_int *b);
+static int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c);
+static int mp_exptmod_fast(const mp_int *G, const mp_int *X, mp_int *P, mp_int *Y, int mode);
+static int mp_invmod_slow (const mp_int * a, mp_int * b, mp_int * c);
+static int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
+static int mp_karatsuba_sqr(const mp_int *a, mp_int *b);
+
 /* computes the modular inverse via binary extended euclidean algorithm, 
  * that is c = 1/a mod b 
  *
  * Based on slow invmod except this is optimized for the case where b is 
  * odd as per HAC Note 14.64 on pp. 610
  */
-int
+static int
 fast_mp_invmod (const mp_int * a, mp_int * b, mp_int * c)
 {
   mp_int  x, y, u, v, B, D;
@@ -175,7 +188,7 @@
  *
  * Based on Algorithm 14.32 on pp.601 of HAC.
 */
-int
+static int
 fast_mp_montgomery_reduce (mp_int * x, const mp_int * n, mp_digit rho)
 {
   int     ix, res, olduse;
@@ -335,7 +348,7 @@
  * Based on Algorithm 14.12 on pp.595 of HAC.
  *
  */
-int
+static int
 fast_s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
 {
   int     olduse, res, pa, ix, iz;
@@ -414,7 +427,7 @@
  *
  * Based on Algorithm 14.12 on pp.595 of HAC.
  */
-int
+static int
 fast_s_mp_mul_high_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
 {
   int     olduse, res, pa, ix, iz;
@@ -512,7 +525,7 @@
 
 */
 
-int fast_s_mp_sqr (const mp_int * a, mp_int * b)
+static int fast_s_mp_sqr (const mp_int * a, mp_int * b)
 {
   int       olduse, res, pa, ix, iz;
   mp_digit   W[MP_WARRAY], *tmpx;
@@ -996,7 +1009,7 @@
   
   /* take the last digit and count the bits in it */
   q = a->dp[a->used - 1];
-  while (q > ((mp_digit) 0)) {
+  while (q > 0) {
     ++r;
     q >>= ((mp_digit) 1);
   }
@@ -3847,7 +3860,7 @@
 }
 
 /* reverse an array, used for radix code */
-void
+static void
 bn_reverse (unsigned char *s, int len)
 {
   int     ix, iy;
@@ -3865,7 +3878,7 @@
 }
 
 /* low level addition, based on HAC pp.594, Algorithm 14.7 */
-int
+static int
 s_mp_add (mp_int * a, mp_int * b, mp_int * c)
 {
   mp_int *x;
@@ -3952,7 +3965,7 @@
   return MP_OKAY;
 }
 
-int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y)
+static int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y)
 {
   mp_int  M[256], res, mu;
   mp_digit buf;
@@ -4163,7 +4176,7 @@
  * HAC pp. 595, Algorithm 14.12  Modified so you can control how 
  * many digits of output are created.
  */
-int
+static int
 s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
 {
   mp_int  t;
@@ -4232,7 +4245,7 @@
 /* multiplies |a| * |b| and does not compute the lower digs digits
  * [meant to get the higher part of the product]
  */
-int
+static int
 s_mp_mul_high_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
 {
   mp_int  t;
@@ -4288,7 +4301,7 @@
 }
 
 /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */
-int
+static int
 s_mp_sqr (const mp_int * a, mp_int * b)
 {
   mp_int  t;
@@ -4338,7 +4351,7 @@
       u       = (mp_digit)(r >> ((mp_word) DIGIT_BIT));
     }
     /* propagate upwards */
-    while (u != ((mp_digit) 0)) {
+    while (u != 0) {
       r       = ((mp_word) *tmpt) + ((mp_word) u);
       *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK));
       u       = (mp_digit)(r >> ((mp_word) DIGIT_BIT));

Modified: trunk/reactos/dll/win32/rsaenh/rc2.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/rc2.c?rev=38373&r1=38372&r2=38373&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rsaenh/rc2.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rsaenh/rc2.c [iso-8859-1] Sat Dec 27 04:11:34 2008
@@ -70,7 +70,7 @@
      * key schedule.  One which is normal, and anther which has a hook to
      * use a reduced key length.
      * BSAFE uses the 'retarded' version.  What I previously shipped is
-     * the same as specifying 1024 for the 'bits' parameter.  Bsafe uses
+     * the same as specifying 1024 for the 'bits' parameter.  BSAFE uses
      * a version where the bits parameter is the same as len*8 */
     /* Seems like MS uses the 'retarded' version, too.
      * Adjust effective keylen bits */

Modified: trunk/reactos/dll/win32/rsaenh/rsaenh.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/rsaenh.c?rev=38373&r1=38372&r2=38373&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rsaenh/rsaenh.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rsaenh/rsaenh.c [iso-8859-1] Sat Dec 27 04:11:34 2008
@@ -657,7 +657,7 @@
             pbTemp = HeapAlloc(GetProcessHeap(), 0, dwDataLen);
             if (!pbTemp) return;
             memcpy(pbTemp, pbData, dwDataLen);
-            RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, (HCRYPTHASH)NULL, FALSE, 0, 
+            RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, 0, FALSE, 0,
                              pbTemp, &dwDataLen, dwDataLen);
             HeapFree(GetProcessHeap(), 0, pbTemp);
             break;
@@ -701,7 +701,7 @@
 
         case CALG_MAC:
             dwDataLen = 0;
-            RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, (HCRYPTHASH)NULL, TRUE, 0, 
+            RSAENH_CPEncrypt(pCryptHash->hProv, pCryptHash->hKey, 0, TRUE, 0,
                              pCryptHash->abHashValue, &dwDataLen, pCryptHash->dwHashSize);
             break;
 
@@ -1259,7 +1259,7 @@
                           0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 } },
         { CALG_SHA, 15, { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 
                           0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 } },
-        { 0,        0,  {} }
+        { 0,        0,  { 0 } }
     };
     DWORD dwIdxOID, i, j;
 
@@ -1677,7 +1677,7 @@
     pCryptHash->hKey = hKey;
     pCryptHash->hProv = hProv;
     pCryptHash->dwState = RSAENH_HASHSTATE_HASHING;
-    pCryptHash->pHMACInfo = (PHMAC_INFO)NULL;
+    pCryptHash->pHMACInfo = NULL;
     pCryptHash->dwHashSize = peaAlgidInfo->dwDefaultLen >> 3;
     init_data_blob(&pCryptHash->tpPRFParams.blobLabel);
     init_data_blob(&pCryptHash->tpPRFParams.blobSeed);
@@ -2826,10 +2826,10 @@
         {
             CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)pbData;
 
-            /* salt length can't be greater than 128 bits = 16 bytes */
-            if (blob->cbData > 16)
+            /* salt length can't be greater than 184 bits = 24 bytes */
+            if (blob->cbData > 24)
             {
-                SetLastError(ERROR_INVALID_PARAMETER);
+                SetLastError(NTE_BAD_DATA);
                 return FALSE;
             }
             memcpy(pCryptKey->abKeyValue + pCryptKey->dwKeyLen, blob->pbData,
@@ -3557,7 +3557,7 @@
 {
     CRYPTHASH *pCryptHash;
     CRYPTKEY *pCryptKey;
-    int i;
+    DWORD i;
 
     TRACE("(hProv=%08lx, hHash=%08lx, dwParam=%08x, pbData=%p, dwFlags=%08x)\n",
            hProv, hHash, dwParam, pbData, dwFlags);

Modified: trunk/reactos/dll/win32/rsaenh/tomcrypt.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/tomcrypt.h?rev=38373&r1=38372&r2=38373&view=diff
==============================================================================
--- trunk/reactos/dll/win32/rsaenh/tomcrypt.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rsaenh/tomcrypt.h [iso-8859-1] Sat Dec 27 04:11:34 2008
@@ -574,27 +574,6 @@
 #define mp_todecimal(M, S) mp_toradix((M), (S), 10)
 #define mp_tohex(M, S)     mp_toradix((M), (S), 16)
 
-/* lowlevel functions, do not call! */
-int s_mp_add(mp_int *a, mp_int *b, mp_int *c);
-int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c);
-#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
-int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
-int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
-int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
-int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs);
-int fast_s_mp_sqr(const mp_int *a, mp_int *b);
-int s_mp_sqr(const mp_int *a, mp_int *b);
-int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
-int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c);
-int mp_karatsuba_sqr(const mp_int *a, mp_int *b);
-int mp_toom_sqr(mp_int *a, mp_int *b);
-int fast_mp_invmod(const mp_int *a, mp_int *b, mp_int *c);
-int mp_invmod_slow (const mp_int * a, mp_int * b, mp_int * c);
-int fast_mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp);
-int mp_exptmod_fast(const mp_int *G, const mp_int *X, mp_int *P, mp_int *Y, int mode);
-int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y);
-void bn_reverse(unsigned char *s, int len);
-
 extern const char *mp_s_rmap;
 
 #define PK_PRIVATE            0        /* PK private keys */



More information about the Ros-diffs mailing list