From 8b7923f6bc11107d441a8edb6a08c81ab66c3cd6 Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 5 May 1999 13:25:25 +0000 Subject: [PATCH] add rpm prefix to MD5 routines to avoid name conflict on solaris. CVS patchset: 3049 CVS date: 1999/05/05 13:25:25 --- CHANGES | 1 + lib/md5.c | 22 +++++++++++----------- lib/md5.h | 8 ++++---- lib/md5sum.c | 6 +++--- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index c820854..d9bc2c2 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ - fix: %doc wrongly inherits lang from last entry in %files. - resurrect toplevel tar target. - spec file removal separate from source removal (Shing-Gene Yung). + - add rpm prefix to MD5 routines to avoid name conflict on solaris. 2.94 -> 2.95 - fix: last update transaction set segfault bug in installer. diff --git a/lib/md5.c b/lib/md5.c index 0b8f283..abacabf 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -10,8 +10,8 @@ * with every copy. * * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which + * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as + * needed on buffers full of bytes, and then call rpmMD5Final, which * will fill a supplied 16-byte array with the digest. */ @@ -44,7 +44,7 @@ void byteReverse(unsigned char *buf, unsigned longs) * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ -void MD5Init(struct MD5Context *ctx, int brokenEndian) +void rpmMD5Init(struct MD5Context *ctx, int brokenEndian) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; @@ -69,7 +69,7 @@ void MD5Init(struct MD5Context *ctx, int brokenEndian) * Update context to reflect the concatenation of another buffer full * of bytes. */ -void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) +void rpmMD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) { uint32 t; @@ -95,7 +95,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) memcpy(p, buf, t); if (ctx->doByteReverse) byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); + rpmMD5Transform(ctx->buf, (uint32 *) ctx->in); buf += t; len -= t; } @@ -105,7 +105,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) memcpy(ctx->in, buf, 64); if (ctx->doByteReverse) byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); + rpmMD5Transform(ctx->buf, (uint32 *) ctx->in); buf += 64; len -= 64; } @@ -119,7 +119,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ -void MD5Final(unsigned char digest[16], struct MD5Context *ctx) +void rpmMD5Final(unsigned char digest[16], struct MD5Context *ctx) { unsigned count; unsigned char *p; @@ -141,7 +141,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) memset(p, 0, count); if (ctx->doByteReverse) byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32 *) ctx->in); + rpmMD5Transform(ctx->buf, (uint32 *) ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); @@ -156,7 +156,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) ((uint32 *) ctx->in)[14] = ctx->bits[0]; ((uint32 *) ctx->in)[15] = ctx->bits[1]; - MD5Transform(ctx->buf, (uint32 *) ctx->in); + rpmMD5Transform(ctx->buf, (uint32 *) ctx->in); if (ctx->doByteReverse) byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); @@ -177,10 +177,10 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. MD5Update blocks + * reflect the addition of 16 longwords of new data. rpmMD5Update blocks * the data and converts bytes into longwords for this routine. */ -void MD5Transform(uint32 buf[4], uint32 const in[16]) +void rpmMD5Transform(uint32 buf[4], uint32 const in[16]) { register uint32 a, b, c, d; diff --git a/lib/md5.h b/lib/md5.h index 203c1f5..cebc073 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -14,11 +14,11 @@ struct MD5Context { int doByteReverse; }; -void MD5Init(struct MD5Context *context, int brokenEndian); -void MD5Update(struct MD5Context *context, unsigned char const *buf, +void rpmMD5Init(struct MD5Context *context, int brokenEndian); +void rpmMD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); -void MD5Final(unsigned char digest[16], struct MD5Context *context); -void MD5Transform(uint32 buf[4], uint32 const in[16]); +void rpmMD5Final(unsigned char digest[16], struct MD5Context *context); +void rpmMD5Transform(uint32 buf[4], uint32 const in[16]); int mdfile(const char *fn, unsigned char *digest); int mdbinfile(const char *fn, unsigned char *bindigest); diff --git a/lib/md5sum.c b/lib/md5sum.c index df07fb5..bdd1e06 100644 --- a/lib/md5sum.c +++ b/lib/md5sum.c @@ -27,10 +27,10 @@ static int domd5(const char * fn, unsigned char * digest, int asAscii, return 1; } - MD5Init(&ctx, brokenEndian); + rpmMD5Init(&ctx, brokenEndian); while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) - MD5Update(&ctx, buf, n); - MD5Final(bindigest, &ctx); + rpmMD5Update(&ctx, buf, n); + rpmMD5Final(bindigest, &ctx); if (ferror(fp)) { fclose(fp); return 1; -- 2.7.4