mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
rename index to idx in sha3 to avoid collision with index function in strings.h
This commit is contained in:
parent
f60cd681f6
commit
23590c05c6
8
sha3.c
8
sha3.c
@ -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)
|
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;
|
size_t block_size = (size_t)ctx->block_size;
|
||||||
|
|
||||||
if (ctx->rest & SHA3_FINALIZED) return; /* too late for additional input */
|
if (ctx->rest & SHA3_FINALIZED) return; /* too late for additional input */
|
||||||
ctx->rest = (unsigned)((ctx->rest + size) % block_size);
|
ctx->rest = (unsigned)((ctx->rest + size) % block_size);
|
||||||
|
|
||||||
/* fill partial block */
|
/* fill partial block */
|
||||||
if (index) {
|
if (idx) {
|
||||||
size_t left = block_size - index;
|
size_t left = block_size - idx;
|
||||||
memcpy((char*)ctx->message + index, msg, (size < left ? size : left));
|
memcpy((char*)ctx->message + idx, msg, (size < left ? size : left));
|
||||||
if (size < left) return;
|
if (size < left) return;
|
||||||
|
|
||||||
/* process partial block */
|
/* process partial block */
|
||||||
|
Loading…
Reference in New Issue
Block a user