Skip to content

Commit

Permalink
GCC47: Fix warning in md5.c
Browse files Browse the repository at this point in the history
md5.c: In function ‘MD5Final’:
md5.c:156:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
md5.c:157:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Marek Vasut <[email protected]>
Cc: Wolfgang Denk <[email protected]>
Acked-by: Mike Frysinger <[email protected]>
  • Loading branch information
Marek Vasut authored and wdenx committed Apr 29, 2012
1 parent f624dd1 commit b68d63c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion include/u-boot/md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
struct MD5Context {
__u32 buf[4];
__u32 bits[2];
unsigned char in[64];
union {
unsigned char in[64];
__u32 in32[16];
};
};

/*
Expand Down
4 changes: 2 additions & 2 deletions lib/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
byteReverse(ctx->in, 14);

/* Append length in bits and transform */
((__u32 *) ctx->in)[14] = ctx->bits[0];
((__u32 *) ctx->in)[15] = ctx->bits[1];
ctx->in32[14] = ctx->bits[0];
ctx->in32[15] = ctx->bits[1];

MD5Transform(ctx->buf, (__u32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
Expand Down

0 comments on commit b68d63c

Please sign in to comment.