Skip to content

Commit

Permalink
lib: Remove some unneeded zeroizing of memory.
Browse files Browse the repository at this point in the history
  • Loading branch information
besser82 committed Jun 6, 2023
1 parent a507b62 commit d4d95a6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
9 changes: 0 additions & 9 deletions lib/alg-gost3411-2012-hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@ void
gost_hash256 (const uint8_t *t, size_t n, uint8_t *out32,
GOST34112012Context *ctx)
{
/* Clear the context state. */
explicit_bzero (ctx, sizeof (GOST34112012Context));

GOST34112012Init (ctx, GOSTR3411_2012_BITS);
GOST34112012Update (ctx, t, n);
GOST34112012Final (ctx, out32);

/* Clear the context state. */
explicit_bzero (ctx, sizeof (GOST34112012Context));
}

/* HMAC_GOSTR3411_2012_256 */
Expand All @@ -47,9 +41,6 @@ gost_hmac256 (const uint8_t *k, size_t n, const uint8_t *t, size_t len,
{
size_t i;

/* Clear the context state. */
explicit_bzero (gostbuf, sizeof (gost_hmac_256_t));

/* R 50.1.113-2016 only allowed N to be in range 256..512 bits */
assert (n >= GOSTR3411_2012_L && n <= GOSTR3411_2012_B);

Expand Down
5 changes: 0 additions & 5 deletions lib/alg-hmac-sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ hmac_sha1_process_data (const uint8_t *text, size_t text_len,
sha1_process_bytes (key, &tctx, key_len);
sha1_finish_ctx(&tctx, &tk);

/* Clean the stack. */
explicit_bzero (&tctx, sizeof (struct sha1_ctx));

key = tk;
key_len = HASH_LENGTH;
}
Expand Down Expand Up @@ -124,7 +121,6 @@ hmac_sha1_process_data (const uint8_t *text, size_t text_len,
sha1_finish_ctx(&ctx, resbuf);

/* Clean the stack. */
explicit_bzero (&ctx, sizeof (struct sha1_ctx));
explicit_bzero (k_ipad, HMAC_BLOCKSZ);

/*
Expand All @@ -138,7 +134,6 @@ hmac_sha1_process_data (const uint8_t *text, size_t text_len,
sha1_finish_ctx(&ctx, resbuf);

/* Clean the stack. */
explicit_bzero (&ctx, sizeof (struct sha1_ctx));
explicit_bzero (k_opad, HMAC_BLOCKSZ);
}

Expand Down

0 comments on commit d4d95a6

Please sign in to comment.