Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cr-marcstevens/sha1collisiondetection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcr-marcstevens <github@marc-stevens.nl>2017-05-15 17:28:25 +0300
committercr-marcstevens <github@marc-stevens.nl>2017-05-15 17:28:25 +0300
commit33a694a9ee1b79c24be45f9eab5ac0e1aeeaf271 (patch)
treec025bc7873cc798a6d22a40450537894ec3443f7
parent5ee29e5e3e57015800f2eb6ced4cd28dd639e6dd (diff)
Fix issues with a big endian platform
-rw-r--r--lib/sha1.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sha1.c b/lib/sha1.c
index 6b454eb..19aab16 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -28,7 +28,7 @@
#if (!defined SHA1DC_FORCE_LITTLEENDIAN) && \
((defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) || \
- defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
+ defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(SHA1DC_FORCE_BIGENDIAN))
#define SHA1DC_BIGENDIAN
@@ -1744,7 +1744,8 @@ void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, size_t len)
while (len >= 64)
{
ctx->total += 64;
- sha1_process(ctx, (uint32_t*)(buf));
+ memcpy(ctx->buffer, buf, 64);
+ sha1_process(ctx, (uint32_t*)(ctx->buffer));
buf += 64;
len -= 64;
}