65 lines
3.2 KiB
Diff
65 lines
3.2 KiB
Diff
diff -up coreutils-6.11/lib/sha256.c.sparc coreutils-6.11/lib/sha256.c
|
|
--- coreutils-6.11/lib/sha256.c.sparc 2008-04-19 16:34:23.000000000 -0500
|
|
+++ coreutils-6.11/lib/sha256.c 2008-05-29 18:48:56.000000000 -0500
|
|
@@ -134,9 +134,13 @@ sha256_conclude_ctx (struct sha256_ctx *
|
|
if (ctx->total[0] < bytes)
|
|
++ctx->total[1];
|
|
|
|
- /* Put the 64-bit file length in *bits* at the end of the buffer. */
|
|
- ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
|
|
- ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
|
|
+ /* Put the 64-bit file length in *bits* at the end of the buffer.
|
|
+ Use set_uint32 rather than a simple assignment, to avoid risk of
|
|
+ unaligned access. */
|
|
+ set_uint32 ((char *) &ctx->buffer[size - 2],
|
|
+ SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)));
|
|
+ set_uint32 ((char *) &ctx->buffer[size - 1],
|
|
+ SWAP (ctx->total[0] << 3));
|
|
|
|
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
|
|
|
|
diff -up coreutils-6.11/lib/sha512.c.sparc coreutils-6.11/lib/sha512.c
|
|
--- coreutils-6.11/lib/sha512.c.sparc 2008-04-19 16:34:23.000000000 -0500
|
|
+++ coreutils-6.11/lib/sha512.c 2008-05-29 18:40:36.000000000 -0500
|
|
@@ -141,10 +141,14 @@ sha512_conclude_ctx (struct sha512_ctx *
|
|
if (u64lt (ctx->total[0], u64lo (bytes)))
|
|
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
|
|
|
|
- /* Put the 64-bit file length in *bits* at the end of the buffer. */
|
|
- ctx->buffer[size - 2] = SWAP (u64or (u64shl (ctx->total[1], 3),
|
|
- u64shr (ctx->total[0], 61)));
|
|
- ctx->buffer[size - 1] = SWAP (u64shl (ctx->total[0], 3));
|
|
+ /* Put the 128-bit file length in *bits* at the end of the buffer.
|
|
+ Use set_uint64 rather than a simple assignment, to avoid risk of
|
|
+ unaligned access. */
|
|
+ set_uint64 ((char *) &ctx->buffer[size - 2],
|
|
+ SWAP (u64or (u64shl (ctx->total[1], 3),
|
|
+ u64shr (ctx->total[0], 61))));
|
|
+ set_uint64 ((char *) &ctx->buffer[size - 1],
|
|
+ SWAP (u64shl (ctx->total[0], 3)));
|
|
|
|
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 8 - bytes);
|
|
|
|
diff -up coreutils-6.11/src/Makefile.am.sparc coreutils-6.11/src/Makefile.am
|
|
--- coreutils-6.11/src/Makefile.am.sparc 2008-04-19 16:34:23.000000000 -0500
|
|
+++ coreutils-6.11/src/Makefile.am 2008-05-29 18:40:36.000000000 -0500
|
|
@@ -101,6 +101,7 @@ shred_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
|
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
|
tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
|
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
|
|
+tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
|
|
|
## If necessary, add -lm to resolve use of pow in lib/strtod.c.
|
|
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
|
|
diff -up coreutils-6.11/src/Makefile.in.sparc coreutils-6.11/src/Makefile.in
|
|
--- coreutils-6.11/src/Makefile.in.sparc 2008-04-19 16:50:10.000000000 -0500
|
|
+++ coreutils-6.11/src/Makefile.in 2008-05-29 18:40:36.000000000 -0500
|
|
@@ -1251,6 +1251,7 @@ shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
|
|
tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
|
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_ACL)
|
|
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
|
|
+tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
|
|
|
# for get_date and gettime
|
|
date_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|