Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
tinycrypt/hmac: Array compared to NULL has no effect
Browse files Browse the repository at this point in the history
This commit fixes the issue reported by Coverity: an array compared
against NULL is always false.

Signed-off-by: Ramakrishna Pallala <[email protected]>
  • Loading branch information
Ramakrishna Pallala committed Aug 29, 2017
1 parent 7c7e5c6 commit 3e4e536
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/source/hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ int tc_hmac_init(TCHmacState_t ctx)
{

/* input sanity check: */
if (ctx == (TCHmacState_t) 0 ||
ctx->key == (uint8_t *) 0) {
if (ctx == (TCHmacState_t) 0) {
return TC_CRYPTO_FAIL;
}

Expand All @@ -114,8 +113,7 @@ int tc_hmac_update(TCHmacState_t ctx,
{

/* input sanity check: */
if (ctx == (TCHmacState_t) 0 ||
ctx->key == (uint8_t *) 0) {
if (ctx == (TCHmacState_t) 0) {
return TC_CRYPTO_FAIL;
}

Expand All @@ -130,8 +128,7 @@ int tc_hmac_final(uint8_t *tag, unsigned int taglen, TCHmacState_t ctx)
/* input sanity check: */
if (tag == (uint8_t *) 0 ||
taglen != TC_SHA256_DIGEST_SIZE ||
ctx == (TCHmacState_t) 0 ||
ctx->key == (uint8_t *) 0) {
ctx == (TCHmacState_t) 0) {
return TC_CRYPTO_FAIL;
}

Expand Down

0 comments on commit 3e4e536

Please sign in to comment.