aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2012-04-28 12:28:40 +0000
committerJohn Rigby <john.rigby@linaro.org>2012-05-02 19:44:13 -0600
commiteb64555ff3e23b1d88d2fbac3ee64f562c343053 (patch)
treecbd256e64432f2a41372ee386f6f51d56de9f9cc
parentf9f227a41e43648deb835093a2c5688f8f69f1d2 (diff)
downloadu-boot-linaro-stable-eb64555ff3e23b1d88d2fbac3ee64f562c343053.tar.gz
GCC47: Fix warning in md5.c
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 <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--include/u-boot/md5.h5
-rw-r--r--lib/md5.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/include/u-boot/md5.h b/include/u-boot/md5.h
index 08924cce3..e09c16a6e 100644
--- a/include/u-boot/md5.h
+++ b/include/u-boot/md5.h
@@ -11,7 +11,10 @@
struct MD5Context {
__u32 buf[4];
__u32 bits[2];
- unsigned char in[64];
+ union {
+ unsigned char in[64];
+ __u32 in32[16];
+ };
};
/*
diff --git a/lib/md5.c b/lib/md5.c
index 81a09e3f9..2ae4a0631 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -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);