aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-08-03 19:56:43 +0300
committerLasse Collin <lasse.collin@tukaani.org>2014-08-03 19:56:43 +0300
commitbc7650d87bf27f85f1a2a806dc2db1780e09e6a5 (patch)
tree47a81fc580cadab5e7c6b9ea2f8686161936b369 /src
parentliblzma: Use lzma_memcmplen() in normal mode of LZMA. (diff)
downloadxz-bc7650d87bf27f85f1a2a806dc2db1780e09e6a5.tar.xz
liblzma: SHA-256: Do the byteswapping without a temporary buffer.
Diffstat (limited to '')
-rw-r--r--src/liblzma/check/sha256.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/liblzma/check/sha256.c b/src/liblzma/check/sha256.c
index a8470d56..0d3bc9e7 100644
--- a/src/liblzma/check/sha256.c
+++ b/src/liblzma/check/sha256.c
@@ -31,7 +31,7 @@
// At least on x86, GCC is able to optimize this to a rotate instruction.
#define rotr_32(num, amount) ((num) >> (amount) | (num) << (32 - (amount)))
-#define blk0(i) (W[i] = data[i])
+#define blk0(i) (W[i] = conv32be(data[i]))
#define blk2(i) (W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \
+ s0(W[(i - 15) & 15]))
@@ -111,18 +111,7 @@ transform(uint32_t state[8], const uint32_t data[16])
static void
process(lzma_check_state *check)
{
-#ifdef WORDS_BIGENDIAN
transform(check->state.sha256.state, check->buffer.u32);
-
-#else
- uint32_t data[16];
-
- for (size_t i = 0; i < 16; ++i)
- data[i] = bswap32(check->buffer.u32[i]);
-
- transform(check->state.sha256.state, data);
-#endif
-
return;
}