diff --git a/libr/hash/md5.h b/libr/hash/md5.h index 901b84afe8..9331c0461e 100644 --- a/libr/hash/md5.h +++ b/libr/hash/md5.h @@ -9,7 +9,7 @@ */ #ifndef PROTOTYPES -#define PROTOTYPES 0 +#define PROTOTYPES 1 #endif /* POINTER defines a generic pointer type */ @@ -74,6 +74,6 @@ typedef struct { void MD5Init PROTO_LIST ((MD5_CTX *)); void MD5Update PROTO_LIST - ((MD5_CTX *, unsigned char *, unsigned int)); + ((MD5_CTX *, const unsigned char *, unsigned int)); void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); diff --git a/libr/hash/md5c.c b/libr/hash/md5c.c index 4fcda4bee7..101ec0803e 100644 --- a/libr/hash/md5c.c +++ b/libr/hash/md5c.c @@ -45,11 +45,11 @@ documentation and/or software. #define S43 15 #define S44 21 -static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); +static void MD5Transform PROTO_LIST ((UINT4 [4], const unsigned char [64])); static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int)); static void Decode PROTO_LIST - ((UINT4 *, unsigned char *, unsigned int)); + ((UINT4 *, const unsigned char *, unsigned int)); static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); @@ -108,7 +108,7 @@ void MD5Init (R_MD5_CTX *context) { operation, processing another message block, and updating the context. */ -void MD5Update (R_MD5_CTX *context, ut8 *input, unsigned int inputLen) { +void MD5Update (R_MD5_CTX *context, const ut8 *input, unsigned int inputLen) { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ @@ -166,7 +166,7 @@ void MD5Final (ut8 digest[16], R_MD5_CTX *context) { } /* MD5 basic transformation. Transforms state based on block */ -static void MD5Transform (ut32 state[4], ut8 block[64]) { +static void MD5Transform (ut32 state[4], const ut8 block[64]) { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); @@ -265,7 +265,7 @@ static void Encode (ut8 *output, ut32 *input, unsigned int len) { } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4 */ -static void Decode (ut32 *output, ut8 *input, unsigned int len) { +static void Decode (ut32 *output, const ut8 *input, unsigned int len) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | diff --git a/libr/hash/state.c b/libr/hash/state.c index 3c8fb82a94..1bdd1e5d53 100644 --- a/libr/hash/state.c +++ b/libr/hash/state.c @@ -48,7 +48,7 @@ R_API ut8 *r_hash_do_md5(RHash *ctx, const ut8 *input, int len) { if (len>0) MD5Update (&ctx->md5, input, len); if (ctx->rst || len == 0) - MD5Final (&ctx->digest, &ctx->md5); + MD5Final (ctx->digest, &ctx->md5); return ctx->digest; } diff --git a/libr/include/r_hash.h b/libr/include/r_hash.h index 3722a7bc8a..a5550f97b1 100644 --- a/libr/include/r_hash.h +++ b/libr/include/r_hash.h @@ -9,6 +9,8 @@ extern "C" { R_LIB_VERSION_HEADER (r_hash); +#define MD5_CTX R_MD5_CTX + /* hashing */ typedef struct { ut32 state[4]; diff --git a/libr/io/p/io_windbg.c b/libr/io/p/io_windbg.c index fb2615f20a..61b9a5d5d9 100644 --- a/libr/io/p/io_windbg.c +++ b/libr/io/p/io_windbg.c @@ -17,6 +17,7 @@ #include #include #include +#include #if __WINDOWS__ #warning WinDBG support not yet ready for Windows