diff --git a/md5.c b/md5.c index 184a876..b024e63 100644 --- a/md5.c +++ b/md5.c @@ -46,7 +46,7 @@ * doesn't work. */ #if defined(__i386__) || defined(__vax__) -# define SET(n) (*(MD5_u32plus *)&ptr[(n) * 4]) +# define SET(n) (*(const MD5_u32plus *)&ptr[(n) * 4]) # define GET(n) SET(n) #else # define SET(n) \ @@ -63,9 +63,9 @@ * This processes one or more 64-byte data blocks, but does NOT update * the bit counters. There're no alignment requirements. */ -static void *body(MD5_CTX *ctx, void *data, unsigned long size) +static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) { - unsigned char *ptr; + const unsigned char *ptr; MD5_u32plus a, b, c, d; MD5_u32plus saved_a, saved_b, saved_c, saved_d; @@ -181,7 +181,7 @@ void MD5_Init(MD5_CTX *ctx) ctx->hi = 0; } -void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) +void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) { MD5_u32plus saved_lo; unsigned long used, free; @@ -205,7 +205,7 @@ void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) } memcpy(&ctx->buffer[used], data, free); - data = (unsigned char *)data + free; + data = (const unsigned char *)data + free; size -= free; body(ctx, ctx->buffer, MD5_BLOCK_SZ); } diff --git a/md5.h b/md5.h index 25a59e0..971c3e6 100644 --- a/md5.h +++ b/md5.h @@ -23,7 +23,7 @@ typedef struct { } MD5_CTX; extern void MD5_Init(MD5_CTX *ctx); -extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); +extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); #endif /* __MD5_H__ */