]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/md4.c
pppd: Fix setting flags of IPv6 peer address
[ppp.git] / pppd / md4.c
index cda9f943d0f25fa40d4597c19401e2ee027e8fc4..42a9b2e75d6ee09764e83e6fc99dc5f161e86ea5 100644 (file)
@@ -87,8 +87,7 @@
 ** This is a user-callable routine.
 */
 void
-MD4Print(MDp)
-MD4_CTX *MDp;
+MD4Print(MD4_CTX *MDp)
 {
   int i,j;
   for (i=0;i<4;i++)
@@ -101,8 +100,7 @@ MD4_CTX *MDp;
 ** This is a user-callable routine.
 */
 void
-MD4Init(MDp)
-MD4_CTX *MDp;
+MD4Init(MD4_CTX *MDp)
 {
   int i;
   MDp->buffer[0] = I0;
@@ -120,9 +118,7 @@ MD4_CTX *MDp;
 ** This routine is not user-callable.
 */
 static void
-MDblock(MDp,Xb)
-MD4_CTX *MDp;
-unsigned char *Xb;
+MDblock(MD4_CTX *MDp, unsigned char *Xb)
 {
   register unsigned int tmp, A, B, C, D;
   unsigned int X[16];
@@ -206,10 +202,7 @@ unsigned char *Xb;
 ** if desired.
 */
 void
-MD4Update(MDp,X,count)
-MD4_CTX *MDp;
-unsigned char *X;
-unsigned int count;
+MD4Update(MD4_CTX *MDp, unsigned char *X, unsigned int count)
 {
   unsigned int i, tmp, bit, byte, mask;
   unsigned char XX[64];
@@ -249,7 +242,8 @@ unsigned int count;
     byte = count >> 3;
     bit =  count & 7;
     /* Copy X into XX since we need to modify it */
-    for (i=0;i<=byte;i++)   XX[i] = X[i];
+    if (count)
+      for (i=0;i<=byte;i++) XX[i] = X[i];
     for (i=byte+1;i<64;i++) XX[i] = 0;
     /* Add padding '1' bit and low-order zeros in last byte */
     mask = 1 << (7 - bit);
@@ -276,9 +270,7 @@ unsigned int count;
 ** Finish up MD4 computation and return message digest.
 */
 void
-MD4Final(buf, MD)
-unsigned char *buf;
-MD4_CTX *MD;
+MD4Final(unsigned char *buf, MD4_CTX *MD)
 {
   int i, j;
   unsigned int w;