summaryrefslogtreecommitdiff
path: root/md5.c
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2013-05-11 01:43:50 +0200
committerTimo Weingärtner <timo@tiwe.de>2013-05-12 18:44:18 +0200
commitbe53f76279d158aa3e5fb2960f9ae4da52201857 (patch)
tree3141fc41a434875f3c833dafc9f3d641a45f5a0f /md5.c
parentce9367b3202477b3cc914cabfe0cb2a856f3a51d (diff)
downloadlibpam-pwdfile-be53f76279d158aa3e5fb2960f9ae4da52201857.tar.gz
replace self-defined uint32 with uint32_t from stdint.h
unsigned int is not guaranteed to have 32 bits
Diffstat (limited to 'md5.c')
-rw-r--r--md5.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/md5.c b/md5.c
index 94f1e2a..2bc558e 100644
--- a/md5.c
+++ b/md5.c
@@ -27,7 +27,7 @@
#else
static void byteReverse(unsigned char *buf, unsigned longs) {
for (; longs; --longs, buf +=4)
- *((uint32 *) buf) = bswap_32(*((uint32 *) buf));
+ *((uint32_t *) buf) = bswap_32(*((uint32_t *) buf));
}
#endif
@@ -52,12 +52,12 @@ void MD5Name(MD5Init)(struct MD5Context *ctx)
*/
void MD5Name(MD5Update)(struct MD5Context *ctx, unsigned const char *buf, unsigned len)
{
- uint32 t;
+ uint32_t t;
/* Update bitcount */
t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
+ if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
@@ -75,7 +75,7 @@ void MD5Name(MD5Update)(struct MD5Context *ctx, unsigned const char *buf, unsign
}
memcpy(p, buf, t);
byteReverse(ctx->in, 16);
- MD5Name(MD5Transform)(ctx->buf, (uint32 *) ctx->in);
+ MD5Name(MD5Transform)(ctx->buf, (uint32_t *) ctx->in);
buf += t;
len -= t;
}
@@ -84,7 +84,7 @@ void MD5Name(MD5Update)(struct MD5Context *ctx, unsigned const char *buf, unsign
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
- MD5Name(MD5Transform)(ctx->buf, (uint32 *) ctx->in);
+ MD5Name(MD5Transform)(ctx->buf, (uint32_t *) ctx->in);
buf += 64;
len -= 64;
}
@@ -119,7 +119,7 @@ void MD5Name(MD5Final)(unsigned char digest[16], struct MD5Context *ctx)
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
- MD5Name(MD5Transform)(ctx->buf, (uint32 *) ctx->in);
+ MD5Name(MD5Transform)(ctx->buf, (uint32_t *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
@@ -130,10 +130,10 @@ void MD5Name(MD5Final)(unsigned char digest[16], struct MD5Context *ctx)
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
+ ((uint32_t *) ctx->in)[14] = ctx->bits[0];
+ ((uint32_t *) ctx->in)[15] = ctx->bits[1];
- MD5Name(MD5Transform)(ctx->buf, (uint32 *) ctx->in);
+ MD5Name(MD5Transform)(ctx->buf, (uint32_t *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
@@ -156,9 +156,9 @@ void MD5Name(MD5Final)(unsigned char digest[16], struct MD5Context *ctx)
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
-void MD5Name(MD5Transform)(uint32 buf[4], uint32 const in[16])
+void MD5Name(MD5Transform)(uint32_t buf[4], uint32_t const in[16])
{
- register uint32 a, b, c, d;
+ register uint32_t a, b, c, d;
a = buf[0];
b = buf[1];