Skip to content

Commit

Permalink
Skip temporary variable for SHA1DC_ALLOW_UNALIGNED_ACCESS
Browse files Browse the repository at this point in the history
This is the feedback I left on pull request #30[1] turned into a
patch.

1. #30
  • Loading branch information
avar authored and cr-marcstevens committed May 20, 2017
1 parent 56e9ea3 commit cc46554
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit cc46554

Please sign in to comment.