X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=md5.c;h=69158911eff29cf3540bcae36951e17736d27c27;hp=71fb4f1272c9ad95cdf7a2e3c33b454597396bfe;hb=6c5889e68832bfd96fdd1de7e6df4309e7017372;hpb=fe5e9cc422cd72526ccfceffbc7e5af8ac83b407 diff --git a/md5.c b/md5.c index 71fb4f1..6915891 100644 --- a/md5.c +++ b/md5.c @@ -26,7 +26,7 @@ #ifdef WORDS_BIGENDIAN static void -byteSwap(uint32_t *buf, unsigned words) +byteSwap(uint32_t *buf, int words) { md5byte *p = (md5byte *)buf; @@ -129,7 +129,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof *ctx); /* In case it's sensitive */ } #ifndef ASM_MD5 @@ -241,13 +241,13 @@ static void *md5_init(void) { struct MD5Context *ctx; - ctx=safe_malloc(sizeof(*ctx),"md5_init"); + NEW(ctx); MD5Init(ctx); return ctx; } -static void md5_update(void *sst, uint8_t const *buf, uint32_t len) +static void md5_update(void *sst, const void *buf, int32_t len) { struct MD5Context *ctx=sst; @@ -267,7 +267,6 @@ struct md5 { struct hash_if ops; }; -init_module md5_module; void md5_module(dict_t *dict) { struct md5 *st; @@ -279,7 +278,7 @@ void md5_module(dict_t *dict) uint8_t digest[16]; int i; - st=safe_malloc(sizeof(*st),"md5_module"); + NEW(st); st->cl.description="md5"; st->cl.type=CL_HASH; st->cl.apply=NULL;