From fe5dc78f8e01be536f040a4a0132528467766771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 18 May 2017 21:48:41 +0000 Subject: [PATCH] Skip temporary variable for SHA1DC_ALLOW_UNALIGNED_ACCESS This is the feedback I left on pull request #30[1] turned into a patch. 1. https://github.com/cr-marcstevens/sha1collisiondetection/pull/30 --- sha1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sha1.c b/sha1.c index 587158c..3dff80a 100644 --- a/sha1.c +++ b/sha1.c @@ -1748,7 +1748,6 @@ void SHA1DCSetCallback(SHA1_CTX* ctx, collision_block_callback callback) void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, size_t len) { unsigned left, fill; - const uint32_t* buffer_to_hash = NULL; if (len == 0) return; @@ -1770,12 +1769,11 @@ void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, size_t len) ctx->total += 64; #if defined(SHA1DC_ALLOW_UNALIGNED_ACCESS) - buffer_to_hash = (const uint32_t*)buf; + sha1_process(ctx, (uint32_t*)(buf)); #else - buffer_to_hash = (const uint32_t*)ctx->buffer; memcpy(ctx->buffer, buf, 64); + sha1_process(ctx, (uint32_t*)(ctx->buffer)); #endif /* defined(SHA1DC_ALLOW_UNALIGNED_ACCESS) */ - sha1_process(ctx, buffer_to_hash); buf += 64; len -= 64; }