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

Commit

Permalink
tinycrypt/sha256: 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 3e4e536 commit 72ed9c8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/source/sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ int tc_sha256_update(TCSha256State_t s, const uint8_t *data, size_t datalen)
{
/* input sanity check: */
if (s == (TCSha256State_t) 0 ||
s->iv == (unsigned int *) 0 ||
data == (void *) 0) {
return TC_CRYPTO_FAIL;
} else if (datalen == 0) {
Expand All @@ -91,8 +90,7 @@ int tc_sha256_final(uint8_t *digest, TCSha256State_t s)

/* input sanity check: */
if (digest == (uint8_t *) 0 ||
s == (TCSha256State_t) 0 ||
s->iv == (unsigned int *) 0) {
s == (TCSha256State_t) 0) {
return TC_CRYPTO_FAIL;
}

Expand Down

0 comments on commit 72ed9c8

Please sign in to comment.