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

Commit b584d78

Browse files
author
hackermnementh
authored
Merge pull request #25 from ramakrishnapallala/coverity
Thanks!
2 parents 7c7e5c6 + 72ed9c8 commit b584d78

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

lib/source/hmac.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ int tc_hmac_init(TCHmacState_t ctx)
9797
{
9898

9999
/* input sanity check: */
100-
if (ctx == (TCHmacState_t) 0 ||
101-
ctx->key == (uint8_t *) 0) {
100+
if (ctx == (TCHmacState_t) 0) {
102101
return TC_CRYPTO_FAIL;
103102
}
104103

@@ -114,8 +113,7 @@ int tc_hmac_update(TCHmacState_t ctx,
114113
{
115114

116115
/* input sanity check: */
117-
if (ctx == (TCHmacState_t) 0 ||
118-
ctx->key == (uint8_t *) 0) {
116+
if (ctx == (TCHmacState_t) 0) {
119117
return TC_CRYPTO_FAIL;
120118
}
121119

@@ -130,8 +128,7 @@ int tc_hmac_final(uint8_t *tag, unsigned int taglen, TCHmacState_t ctx)
130128
/* input sanity check: */
131129
if (tag == (uint8_t *) 0 ||
132130
taglen != TC_SHA256_DIGEST_SIZE ||
133-
ctx == (TCHmacState_t) 0 ||
134-
ctx->key == (uint8_t *) 0) {
131+
ctx == (TCHmacState_t) 0) {
135132
return TC_CRYPTO_FAIL;
136133
}
137134

lib/source/sha256.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ int 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 == (unsigned int *) 0 ||
7069
data == (void *) 0) {
7170
return TC_CRYPTO_FAIL;
7271
} else if (datalen == 0) {
@@ -91,8 +90,7 @@ int 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 == (unsigned int *) 0) {
93+
s == (TCSha256State_t) 0) {
9694
return TC_CRYPTO_FAIL;
9795
}
9896

0 commit comments

Comments
 (0)