[U-Boot] [PATCH 2/3] md5: Fix gcc-4.7 build problem in md5

Simon Glass sjg at chromium.org
Sat Nov 3 22:45:20 CET 2012


From: Han Shen <shenhan at google.com>

Fixed by replacing pointer casting with memcpy.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 lib/md5.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/md5.c b/lib/md5.c
index 2ae4a06..9791e59 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -153,8 +153,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
 	byteReverse(ctx->in, 14);
 
 	/* Append length in bits and transform */
-	ctx->in32[14] = ctx->bits[0];
-	ctx->in32[15] = ctx->bits[1];
+	memcpy(ctx->in + 14 * sizeof(__u32), ctx->bits, 2 * sizeof(__u32));
 
 	MD5Transform(ctx->buf, (__u32 *) ctx->in);
 	byteReverse((unsigned char *) ctx->buf, 4);
-- 
1.7.7.3



More information about the U-Boot mailing list