X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblutil%2Fmd5.c;h=9e14cc2a4ae807d06b668fad3ee62105bd09a497;hb=883196d34858126dedd6438328aa0b14c8fe6eb2;hp=e1d316a459e08193c63988c3ff3d419c5c9f967f;hpb=357101793b8722e2e59994189520f823601d5afd;p=openldap diff --git a/libraries/liblutil/md5.c b/libraries/liblutil/md5.c index e1d316a459..9e14cc2a4a 100644 --- a/libraries/liblutil/md5.c +++ b/libraries/liblutil/md5.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ /* @@ -110,10 +110,10 @@ lutil_MD5Update( t = 64-t; if (len < t) { - memcpy(p, buf, len); + AC_MEMCPY(p, buf, len); return; } - memcpy(p, buf, t); + AC_MEMCPY(p, buf, t); lutil_MD5Transform(ctx->buf, ctx->in); buf += t; len -= t; @@ -122,7 +122,7 @@ lutil_MD5Update( /* Process data in 64-byte chunks */ while (len >= 64) { - memcpy(ctx->in, buf, 64); + AC_MEMCPY(ctx->in, buf, 64); lutil_MD5Transform(ctx->buf, ctx->in); buf += 64; len -= 64; @@ -130,7 +130,7 @@ lutil_MD5Update( /* Handle any remaining bytes of data. */ - memcpy(ctx->in, buf, len); + AC_MEMCPY(ctx->in, buf, len); } /* @@ -157,14 +157,14 @@ lutil_MD5Final( unsigned char *digest, struct lutil_MD5Context *ctx ) /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); + memset(p, '\0', count); lutil_MD5Transform(ctx->buf, 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); } /* Append length in bits and transform */ @@ -176,7 +176,7 @@ lutil_MD5Final( unsigned char *digest, struct lutil_MD5Context *ctx ) putu32(ctx->buf[1], digest + 4); putu32(ctx->buf[2], digest + 8); putu32(ctx->buf[3], digest + 12); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, '\0', sizeof(ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 @@ -297,7 +297,7 @@ int main (int argc, char **argv ) { struct lutil_MD5Context context; - unsigned char checksum[16]; + unsigned char checksum[LUTIL_MD5_BYTES]; int i; int j; @@ -312,7 +312,7 @@ main (int argc, char **argv ) lutil_MD5Init (&context); lutil_MD5Update (&context, argv[j], strlen (argv[j])); lutil_MD5Final (checksum, &context); - for (i = 0; i < 16; i++) + for (i = 0; i < LUTIL_MD5_BYTES; i++) { printf ("%02x", (unsigned int) checksum[i]); }