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

Commit 351636e

Browse files
tinycrypt/sha256: Array compared to NULL has no effect
This commit fixes the issue reported by Coverity/Zephyr: an array compared against NULL is always false. Coverity-CID: 143715 Coverity-CID: 143730 Change-Id: Ia502736f605774b71c1a41a850b84663c78fc7d0 Signed-off-by: Flavio Santes <[email protected]>
1 parent 23e7727 commit 351636e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/source/sha256.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ int32_t tc_sha256_update(TCSha256State_t s, const uint8_t *data, size_t datalen)
6666
{
6767
/* input sanity check: */
6868
if (s == (TCSha256State_t) 0 ||
69-
s->iv == (uint32_t *) 0 ||
7069
data == (void *) 0) {
7170
return TC_CRYPTO_FAIL;
7271
} else if (datalen == 0) {
@@ -91,8 +90,7 @@ int32_t tc_sha256_final(uint8_t *digest, TCSha256State_t s)
9190

9291
/* input sanity check: */
9392
if (digest == (uint8_t *) 0 ||
94-
s == (TCSha256State_t) 0 ||
95-
s->iv == (uint32_t *) 0) {
93+
s == (TCSha256State_t) 0) {
9694
return TC_CRYPTO_FAIL;
9795
}
9896

0 commit comments

Comments
 (0)