]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - lib/md5.c
- use memcpy and memset in md5.c instead of MD5_memcpy and MD5_memset
[thirdparty/squid.git] / lib / md5.c
index 243521404384d59042ee2592d8198e08b2e32f30..27f43318c5cb83e8b56f5a381bf5edd9539ae57c 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
  * and by the SNMP routines.
  */
 
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include "md5.h"
 
 /*
 static void MD5Transform(u_num32[4], unsigned char[64]);
 static void Encode(unsigned char *, u_num32 *, unsigned int);
 static void Decode(u_num32 *, unsigned char *, unsigned int);
+
+#if HAVE_MEMCPY
+#define MD5_memcpy(to,from,count) memcpy(to,from,count)
+#else
 static void MD5_memcpy(unsigned char *, unsigned char *, unsigned int);
+#endif
+
+#if HAVE_MEMSET
+#define MD5_memset(buf,chr,count) memset(buf,chr,count)
+#else
 static void MD5_memset(char *, int, unsigned int);
+#endif
 
 static unsigned char PADDING[64] =
 {
@@ -319,6 +333,7 @@ Decode(u_num32 * output, unsigned char *input, unsigned int len)
            (((u_num32) input[j + 2]) << 16) | (((u_num32) input[j + 3]) << 24);
 }
 
+#if !HAVE_MEMCPY
 /*
  * Note: Replace "for loop" with standard memcpy if possible.
  */
@@ -330,7 +345,9 @@ MD5_memcpy(unsigned char *output, unsigned char *input, unsigned int len)
     for (i = 0; i < len; i++)
        output[i] = input[i];
 }
+#endif
 
+#if !HAVE_MEMSET
 /*
  * Note: Replace "for loop" with standard memset if possible.
  */
@@ -341,3 +358,4 @@ MD5_memset(char *output, int value, unsigned int len)
     for (i = 0; i < len; i++)
        output[i] = (char) value;
 }
+#endif