diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/md5.c | 22 | ||||
| -rw-r--r-- | lib/md5.h | 7 | 
2 files changed, 15 insertions, 14 deletions
| @@ -25,7 +25,7 @@  #include <string.h>		/* for memcpy() */  #include "md5.h" -static void md5_transform(u_int32_t buf[4], u_int32_t const in[16]); +static void md5_transform(uint32_t buf[4], uint32_t const in[16]);  /*   * Wrapper function for all-in-one MD5 @@ -52,12 +52,12 @@ void md5_init(struct MD5Context *ctx)  void md5_append(struct MD5Context *ctx, const md5_byte_t *buf,  		unsigned int len)  { -	u_int32_t t; +	uint32_t t;  	/* Update bitcount */  	t = ctx->bits[0]; -	if ((ctx->bits[0] = t + ((u_int32_t) 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; @@ -74,7 +74,7 @@ void md5_append(struct MD5Context *ctx, const md5_byte_t *buf,  			return;  		}  		memcpy(p, buf, t); -		md5_transform(ctx->buf, (u_int32_t *) ctx->in); +		md5_transform(ctx->buf, (uint32_t *) ctx->in);  		buf += t;  		len -= t;  	} @@ -82,7 +82,7 @@ void md5_append(struct MD5Context *ctx, const md5_byte_t *buf,  	while (len >= 64) {  		memcpy(ctx->in, buf, 64); -		md5_transform(ctx->buf, (u_int32_t *) ctx->in); +		md5_transform(ctx->buf, (uint32_t *) ctx->in);  		buf += 64;  		len -= 64;  	} @@ -116,7 +116,7 @@ void md5_finish(struct MD5Context *ctx, md5_byte_t digest[16])  	if (count < 8) {  		/* Two lots of padding:  Pad the first block to 64 bytes */  		memset(p, 0, count); -		md5_transform(ctx->buf, (u_int32_t *) ctx->in); +		md5_transform(ctx->buf, (uint32_t *) ctx->in);  		/* Now fill the next block with 56 bytes */  		memset(ctx->in, 0, 56); @@ -126,10 +126,10 @@ void md5_finish(struct MD5Context *ctx, md5_byte_t digest[16])  	}  	/* Append length in bits and transform */ -	((u_int32_t *) ctx->in)[14] = ctx->bits[0]; -	((u_int32_t *) ctx->in)[15] = ctx->bits[1]; +	((uint32_t *) ctx->in)[14] = ctx->bits[0]; +	((uint32_t *) ctx->in)[15] = ctx->bits[1]; -	md5_transform(ctx->buf, (u_int32_t *) ctx->in); +	md5_transform(ctx->buf, (uint32_t *) ctx->in);  	memcpy(digest, ctx->buf, 16);  	memset(ctx, 0, sizeof(ctx));	/* In case it's sensitive */  } @@ -151,9 +151,9 @@ void md5_finish(struct MD5Context *ctx, md5_byte_t digest[16])   * reflect the addition of 16 longwords of new data.  MD5Update blocks   * the data and converts bytes into longwords for this routine.   */ -static void md5_transform(u_int32_t buf[4], u_int32_t const in[16]) +static void md5_transform(uint32_t buf[4], uint32_t const in[16])  { -	register u_int32_t a, b, c, d; +	register uint32_t a, b, c, d;  	a = buf[0];  	b = buf[1]; @@ -26,11 +26,12 @@  #include <sys/types.h>  #include <gmodule.h> +#include <stdint.h> -typedef u_int8_t md5_byte_t; +typedef uint8_t md5_byte_t;  typedef struct MD5Context { -	u_int32_t buf[4]; -	u_int32_t bits[2]; +	uint32_t buf[4]; +	uint32_t bits[2];  	unsigned char in[64];  } md5_state_t; | 
