diff options
author | Flavio Santes <flavio.santes@intel.com> | 2016-11-18 17:21:08 -0600 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2016-11-22 19:33:31 -0500 |
commit | 979aedc2d370cedfbacaaf12ea2f4c5bb3d25c51 (patch) | |
tree | 8656cb08dd981f5ca8af42e0fa6de878706ff109 | |
parent | 850877b95dc81d3578ba0c37c2007a1b82e96474 (diff) |
tinycrypt/hmac: Array compared to NULL has no effect
This commit fixes the issue reported by Coverity: an array compared
against NULL is always false.
Coverity-CID: 143687
Coverity-CID: 143737
Coverity-CID: 143740
Change-Id: Id94a144c47b3377876695e86da8c0c33a989ec99
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
-rw-r--r-- | ext/lib/crypto/tinycrypt/source/hmac.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/lib/crypto/tinycrypt/source/hmac.c b/ext/lib/crypto/tinycrypt/source/hmac.c index 442af547a..e256846ed 100644 --- a/ext/lib/crypto/tinycrypt/source/hmac.c +++ b/ext/lib/crypto/tinycrypt/source/hmac.c @@ -96,8 +96,7 @@ int32_t tc_hmac_set_key(TCHmacState_t ctx, int32_t 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; } @@ -114,7 +113,7 @@ int32_t tc_hmac_update(TCHmacState_t ctx, uint32_t data_length) { /* input sanity check: */ - if (ctx == (TCHmacState_t) 0 || ctx->key == (uint8_t *) 0) { + if (ctx == (TCHmacState_t) 0) { return TC_CRYPTO_FAIL; } @@ -128,8 +127,7 @@ int32_t tc_hmac_final(uint8_t *tag, uint32_t 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; } |