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

Commit

Permalink
Merge pull request #25 from ramakrishnapallala/coverity
Browse files Browse the repository at this point in the history
Thanks!
  • Loading branch information
hackermnementh authored Aug 29, 2017
2 parents 7c7e5c6 + 72ed9c8 commit b584d78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 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
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 b584d78

Please sign in to comment.