Fix some stupid warnings in md5-related code

"PROTOTYPES should be set to one if and only if the compiler
supports function argument prototyping. [...]".

Hello time-traveller, welcome to the previous century. I heard
that in your modern times, compilers are supporting
_function arguments prototypiing_, is that true?
This commit is contained in:
jvoisin 2015-01-13 02:49:28 +01:00
parent 0c103cf923
commit e3dbefc898
5 changed files with 11 additions and 8 deletions

View file

@ -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 *));

View file

@ -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) |

View file

@ -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;
}

View file

@ -9,6 +9,8 @@ extern "C" {
R_LIB_VERSION_HEADER (r_hash);
#define MD5_CTX R_MD5_CTX
/* hashing */
typedef struct {
ut32 state[4];

View file

@ -17,6 +17,7 @@
#include <r_lib.h>
#include <r_socket.h>
#include <r_util.h>
#include <transport.h>
#if __WINDOWS__
#warning WinDBG support not yet ready for Windows