diff options
author | Guy Harris <guy@alum.mit.edu> | 2007-04-23 20:47:07 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2007-04-23 20:47:07 +0000 |
commit | 0acc6bc5b8d0d1973b33adf17e14d3a8ccf2809d (patch) | |
tree | a32f49b383ba132e708f124792fd25c705ac6fb7 /epan/crypt | |
parent | cd66fcfe163512631222943602ef66bb40f6aeb8 (diff) |
The "in" array in an MD5 context is expected to be aligned on a 4-byte
boundary; make it an array of 16 guint32's rather than 64 guint8's, to
ensure that, and add now-necessary casts and remove now-unnecessary
casts.
svn path=/trunk/; revision=21540
Diffstat (limited to 'epan/crypt')
-rw-r--r-- | epan/crypt/crypt-md5.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/epan/crypt/crypt-md5.c b/epan/crypt/crypt-md5.c index 2b1aafb7ef..9504102aeb 100644 --- a/epan/crypt/crypt-md5.c +++ b/epan/crypt/crypt-md5.c @@ -115,8 +115,8 @@ void md5_append( md5_state_t *ctx, unsigned char const *buf, unsigned len) return; } memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (guint32 *) ctx->in); + byteReverse((unsigned char *) ctx->in, 16); + MD5Transform(ctx->buf, ctx->in); buf += t; len -= t; } @@ -124,8 +124,8 @@ void md5_append( md5_state_t *ctx, unsigned char const *buf, unsigned len) while (len >= 64) { memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (guint32 *) ctx->in); + byteReverse((unsigned char *) ctx->in, 16); + MD5Transform(ctx->buf, ctx->in); buf += 64; len -= 64; } @@ -149,7 +149,7 @@ void md5_finish(md5_state_t *ctx, unsigned char digest[16]) /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ - p = ctx->in + count; + p = (unsigned char *) ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ @@ -159,8 +159,8 @@ void md5_finish(md5_state_t *ctx, unsigned char digest[16]) if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (guint32 *) ctx->in); + byteReverse((unsigned char *) ctx->in, 16); + MD5Transform(ctx->buf, ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); @@ -168,13 +168,13 @@ void md5_finish(md5_state_t *ctx, unsigned char digest[16]) /* Pad block to 56 bytes */ memset(p, 0, count - 8); } - byteReverse(ctx->in, 14); + byteReverse((unsigned char *) ctx->in, 14); /* Append length in bits and transform */ - ((guint32 *) ctx->in)[14] = ctx->bits[0]; - ((guint32 *) ctx->in)[15] = ctx->bits[1]; + ctx->in[14] = ctx->bits[0]; + ctx->in[15] = ctx->bits[1]; - MD5Transform(ctx->buf, (guint32 *) ctx->in); + MD5Transform(ctx->buf, ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ |