Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
rename index to idx in sha3 to avoid collision with index function in…
Browse files Browse the repository at this point in the history
… strings.h
  • Loading branch information
prusnak committed May 16, 2016
1 parent f60cd68 commit 23590c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@ static void sha3_process_block(uint64_t hash[25], const uint64_t *block, size_t
*/
void sha3_Update(SHA3_CTX *ctx, const unsigned char *msg, size_t size)
{
size_t index = (size_t)ctx->rest;
size_t idx = (size_t)ctx->rest;
size_t block_size = (size_t)ctx->block_size;

if (ctx->rest & SHA3_FINALIZED) return; /* too late for additional input */
ctx->rest = (unsigned)((ctx->rest + size) % block_size);

/* fill partial block */
if (index) {
size_t left = block_size - index;
memcpy((char*)ctx->message + index, msg, (size < left ? size : left));
if (idx) {
size_t left = block_size - idx;
memcpy((char*)ctx->message + idx, msg, (size < left ? size : left));
if (size < left) return;

/* process partial block */
Expand Down

0 comments on commit 23590c0

Please sign in to comment.