Skip to content

Commit

Permalink
bzero -> memset
Browse files Browse the repository at this point in the history
  • Loading branch information
antmak authored and igrr committed Nov 21, 2023
1 parent 9c87a9b commit 440d035
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crypto/hmac256-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void hmac_sha256_final(struct hmac_sha256_ctx *ctx, uint8_t *mac,
// we need to pad the "ctx_inside" state because `sha256_compress` expects a padded input
uint64_t bit_len = __builtin_bswap64(SHA256_DIGEST_SIZE * 8 + 512);
block[SHA256_DIGEST_SIZE] = 0x80;
bzero(block + SHA256_DIGEST_SIZE + 1, SHA256_BLOCK_SIZE - SHA256_DIGEST_SIZE - 1);
memset(block + SHA256_DIGEST_SIZE + 1, 0, SHA256_BLOCK_SIZE - SHA256_DIGEST_SIZE - 1);
memcpy(block + SHA256_BLOCK_SIZE - sizeof(bit_len), &bit_len, sizeof(bit_len));

sha256_compress(&ctx->ctx_outside, block);
Expand Down
2 changes: 1 addition & 1 deletion hw/misc/esp32c3_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static void write_and_padd(uint8_t *block, const uint8_t *data, uint16_t data_le
memcpy(block, data, data_len);
// Apply a one bit, followed by zero bits (refer to the TRM of respective target).
block[data_len] = 0x80;
bzero(block + data_len + 1, SHA256_BLOCK_SIZE - data_len - 1);
memset(block + data_len + 1, 0, SHA256_BLOCK_SIZE - data_len - 1);
}


Expand Down

0 comments on commit 440d035

Please sign in to comment.