Sync with trunk (r48008)
[reactos.git] / dll / win32 / advapi32 / crypt / crypt_md4.c
index 204d596..bbf23a7 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 /*
@@ -61,7 +61,7 @@
 /*
  * The core of the MD4 algorithm
  */
-static VOID MD4Transform(unsigned int buf[4], const unsigned int in[16])
+static void MD4Transform( unsigned int buf[4], const unsigned int in[16] )
 {
     register unsigned int a, b, c, d;
 
@@ -131,7 +131,7 @@ static VOID MD4Transform(unsigned int buf[4], const unsigned int in[16])
  * Start MD4 accumulation.  Set bit count to 0 and buffer to mysterious
  * initialization constants.
  */
-VOID WINAPI MD4Init(MD4_CTX *ctx)
+VOID WINAPI MD4Init( MD4_CTX *ctx )
 {
     ctx->buf[0] = 0x67452301;
     ctx->buf[1] = 0xefcdab89;
@@ -145,14 +145,14 @@ VOID WINAPI MD4Init(MD4_CTX *ctx)
  * Update context to reflect the concatenation of another buffer full
  * of bytes.
  */
-VOID WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len)
+VOID WINAPI MD4Update( MD4_CTX *ctx, const unsigned char *buf, unsigned int len )
 {
     register unsigned int t;
 
     /* Update bitcount */
     t = ctx->i[0];
 
-    if ((ctx->i[0] = t + ((unsigned int)len << 3)) < t)
+    if ((ctx->i[0] = t + (len << 3)) < t)
         ctx->i[1]++;        /* Carry from low to high */
 
     ctx->i[1] += len >> 29;
@@ -166,14 +166,14 @@ VOID WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len)
 
         if (len < t)
         {
-            memcpy(p, buf, len);
+            memcpy( p, buf, len );
             return;
         }
 
-        memcpy(p, buf, t);
-        byteReverse(ctx->in, 16);
+        memcpy( p, buf, t );
+        byteReverse( ctx->in, 16 );
 
-        MD4Transform(ctx->buf, (unsigned int *)ctx->in);
+        MD4Transform( ctx->buf, (unsigned int *)ctx->in );
 
         buf += t;
         len -= t;
@@ -182,24 +182,24 @@ VOID WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len)
     /* Process data in 64-byte chunks */
     while (len >= 64)
     {
-        memcpy(ctx->in, buf, 64);
-        byteReverse(ctx->in, 16);
+        memcpy( ctx->in, buf, 64 );
+        byteReverse( ctx->in, 16 );
 
-        MD4Transform(ctx->buf, (unsigned int *)ctx->in);
+        MD4Transform( ctx->buf, (unsigned int *)ctx->in );
 
         buf += 64;
         len -= 64;
     }
 
     /* Handle any remaining bytes of data. */
-    memcpy(ctx->in, buf, len);
+    memcpy( ctx->in, buf, len );
 }
 
 /*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * Final wrapup - pad to 64-byte boundary with the bit pattern 
  * 1 0* (64-bit count of bits processed, MSB-first)
  */
-VOID WINAPI MD4Final(MD4_CTX *ctx)
+VOID WINAPI MD4Final( MD4_CTX *ctx )
 {
     unsigned int count;
     unsigned char *p;
@@ -220,19 +220,19 @@ VOID WINAPI MD4Final(MD4_CTX *ctx)
     {
         /* Two lots of padding:  Pad the first block to 64 bytes */
         memset( p, 0, count );
-        byteReverse(ctx->in, 16);
-        MD4Transform(ctx->buf, (unsigned int *)ctx->in);
+        byteReverse( ctx->in, 16 );
+        MD4Transform( ctx->buf, (unsigned int *)ctx->in );
 
         /* Now fill the next block with 56 bytes */
-        memset(ctx->in, 0, 56);
+        memset( ctx->in, 0, 56 );
     }
     else
     {
         /* Pad block to 56 bytes */
-        memset(p, 0, count - 8);
+        memset( p, 0, count - 8 );
     }
 
-    byteReverse(ctx->in, 14);
+    byteReverse( ctx->in, 14 );
 
     /* Append length in bits and transform */
     ((unsigned int *)ctx->in)[14] = ctx->i[0];
@@ -240,5 +240,5 @@ VOID WINAPI MD4Final(MD4_CTX *ctx)
 
     MD4Transform( ctx->buf, (unsigned int *)ctx->in );
     byteReverse( (unsigned char *)ctx->buf, 4 );
-    memcpy(ctx->digest, ctx->buf, 16);
+    memcpy( ctx->digest, ctx->buf, 16 );
 }