summaryrefslogtreecommitdiff
path: root/libbb/hash_md5_sha.c
diff options
context:
space:
mode:
authorDenys Vlasenko2013-06-27 01:03:19 +0200
committerDenys Vlasenko2013-06-27 01:03:19 +0200
commit1f5e81f8f83087082108cf9449068ec4c2a3125e (patch)
treea3bb9d33dc2da4d68f109aeb18699f5adced15fa /libbb/hash_md5_sha.c
parentf6205c6ab786f14e3515dfc0bfdb958ada8ed0e9 (diff)
downloadbusybox-1f5e81f8f83087082108cf9449068ec4c2a3125e.zip
busybox-1f5e81f8f83087082108cf9449068ec4c2a3125e.tar.gz
md5/sha512: a better fix for strict aliasing warnings
The locations *are* well-aligned for direct stores on any architecture. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/hash_md5_sha.c')
-rw-r--r--libbb/hash_md5_sha.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
index e10cb39..3f743ac 100644
--- a/libbb/hash_md5_sha.c
+++ b/libbb/hash_md5_sha.c
@@ -84,7 +84,7 @@ static void FAST_FUNC common64_end(md5_ctx_t *ctx, int swap_needed)
if (swap_needed)
t = bb_bswap_64(t);
/* wbuffer is suitably aligned for this */
- memcpy(&ctx->wbuffer[64 - 8], &t, sizeof(t));
+ *(bb__aliased_uint64_t *) (&ctx->wbuffer[64 - 8]) = t;
}
ctx->process_block(ctx);
if (remaining >= 8)
@@ -883,10 +883,10 @@ void FAST_FUNC sha512_end(sha512_ctx_t *ctx, void *resbuf)
uint64_t t;
t = ctx->total64[0] << 3;
t = SWAP_BE64(t);
- memcpy(&ctx->wbuffer[128 - 8], &t, sizeof(t));
+ *(bb__aliased_uint64_t *) (&ctx->wbuffer[128 - 8]) = t;
t = (ctx->total64[1] << 3) | (ctx->total64[0] >> 61);
t = SWAP_BE64(t);
- memcpy(&ctx->wbuffer[128 - 16], &t, sizeof(t));
+ *(bb__aliased_uint64_t *) (&ctx->wbuffer[128 - 16]) = t;
}
sha512_process_block128(ctx);
if (remaining >= 16)