Release bumped to "gts4".
[tac_plus.git] / md5.c
diff --git a/md5.c b/md5.c
index 06225b0..32ca404 100644 (file)
--- a/md5.c
+++ b/md5.c
@@ -1,4 +1,4 @@
-/* 
+/*
    Copyright (c) 1995-1998 by Cisco systems, Inc.
 
    Permission to use, copy, modify, and distribute this software for
  * to contain all the information that RFC 1321's global.h contains.
  */
 
+
+#include "tac_plus.h"
+
 #include "md5.h"
 
+
+static void MD5Transform TAC_ARGS((UINT4 *state, unsigned char *block));
+static void Encode TAC_ARGS((unsigned char *output, UINT4 *input, unsigned int len));
+static void Decode TAC_ARGS((UINT4 *output, unsigned char *input, unsigned int len));
+
+
 /* Constants for MD5Transform routine.
  */
 
-
 #define S11 7
 #define S12 12
 #define S13 17
 #define S43 15
 #define S44 21
 
-static void MD5Transform PROTO_LIST((UINT4[4], unsigned char[64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, unsigned char *, unsigned int));
-
-#if !defined(MD5_NEED_MEM_FUNCS)
-
-#define MD5_memcpy(out,in,len) memcpy(out, in, len)
-#define MD5_memset(ptr,val,len) memset(ptr, val, len)
-
-#else                          /* !defined(MD5_NEED_MEM_FUNCS) */
-
-static void MD5_memcpy PROTO_LIST((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST((POINTER, int, unsigned int));
-
-#endif                         /* !defined(MD5_NEED_MEM_FUNCS) */
-
 static unsigned char PADDING[64] = {
     0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -129,6 +119,8 @@ Rotation is separate from addition to prevent recomputation.
  (a) += (b); \
   }
 
+void MD5Init TAC_ARGS((MD5_CTX *context));
+
 /* MD5 initialization. Begins an MD5 operation, writing a new context.
  */
 void
@@ -143,6 +135,8 @@ MD5_CTX *context;           /* context */
     context->state[3] = 0x10325476;
 }
 
+void MD5Update TAC_ARGS((MD5_CTX *context, unsigned char *input, unsigned int inputLen));
+
 /* MD5 block update operation. Continues an MD5 message-digest
    operation, processing another message block, and updating the
    context.
@@ -168,8 +162,7 @@ unsigned int inputLen;              /* length of input block */
 
     /* Transform as many times as possible. */
     if (inputLen >= partLen) {
-       MD5_memcpy
-           ((POINTER) & context->buffer[index], (POINTER) input, partLen);
+       memcpy((POINTER) & context->buffer[index], (POINTER) input, partLen);
        MD5Transform(context->state, context->buffer);
 
        for (i = partLen; i + 63 < inputLen; i += 64)
@@ -180,11 +173,12 @@ unsigned int inputLen;            /* length of input block */
        i = 0;
 
     /* Buffer remaining input */
-    MD5_memcpy
-       ((POINTER) & context->buffer[index], (POINTER) & input[i],
-        inputLen - i);
+    memcpy((POINTER) & context->buffer[index], (POINTER) & input[i],
+       inputLen - i);
 }
 
+void MD5Final TAC_ARGS((unsigned char *digest, MD5_CTX *context));
+
 /* MD5 finalization. Ends an MD5 message-digest operation, writing the
    the message digest and zeroizing the context.
    */
@@ -211,9 +205,11 @@ MD5_CTX *context;          /* context */
     Encode(digest, context->state, 16);
 
     /* Zeroize sensitive information. */
-    MD5_memset((POINTER) context, 0, sizeof(*context));
+    memset((POINTER) context, 0, sizeof(*context));
 }
 
+static void MD5Transform TAC_ARGS((UINT4 *state, unsigned char *block));
+
 /* MD5 basic transformation. Transforms state based on block.
  */
 static void
@@ -303,9 +299,11 @@ unsigned char block[64];
     state[3] += d;
 
     /* Zeroize sensitive information. */
-    MD5_memset((POINTER) x, 0, sizeof(x));
+    memset((POINTER) x, 0, sizeof(x));
 }
 
+static void Encode TAC_ARGS((unsigned char *output, UINT4 *input, unsigned int len));
+
 /* Encodes input (UINT4) into output (unsigned char). Assumes len is
    a multiple of 4.
    */
@@ -325,6 +323,8 @@ unsigned int len;
     }
 }
 
+static void Decode TAC_ARGS((UINT4 *output, unsigned char *input, unsigned int len));
+
 /* Decodes input (unsigned char) into output (UINT4). Assumes len is
    a multiple of 4.
    */
@@ -340,36 +340,3 @@ unsigned int len;
        output[i] = ((UINT4) input[j]) | (((UINT4) input[j + 1]) << 8) |
            (((UINT4) input[j + 2]) << 16) | (((UINT4) input[j + 3]) << 24);
 }
-
-#if defined(MD5_NEED_MEM_FUNC)
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-static void
-MD5_memcpy(output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
-    unsigned int i;
-
-    for (i = 0; i < len; i++)
-       output[i] = input[i];
-}
-
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void
-MD5_memset(output, value, len)
-POINTER output;
-int value;
-unsigned int len;
-{
-    unsigned int i;
-
-    for (i = 0; i < len; i++)
-       ((char *) output)[i] = (char) value;
-}
-
-#endif                         /* defined(MD5_NEED_MEM_FUNC) */