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

Commit 67f96b5

Browse files
author
hackermnementh
authored
Merge pull request #8 from flavio-santes/bugs
Bugs
2 parents 23e7727 + 1d9047f commit 67f96b5

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/source/hmac.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ int32_t tc_hmac_set_key(TCHmacState_t ctx,
9696
int32_t tc_hmac_init(TCHmacState_t ctx)
9797
{
9898
/* input sanity check: */
99-
if (ctx == (TCHmacState_t) 0 ||
100-
ctx->key == (uint8_t *) 0) {
99+
if (ctx == (TCHmacState_t) 0) {
101100
return TC_CRYPTO_FAIL;
102101
}
103102

@@ -114,7 +113,7 @@ int32_t tc_hmac_update(TCHmacState_t ctx,
114113
uint32_t data_length)
115114
{
116115
/* input sanity check: */
117-
if (ctx == (TCHmacState_t) 0 || ctx->key == (uint8_t *) 0) {
116+
if (ctx == (TCHmacState_t) 0) {
118117
return TC_CRYPTO_FAIL;
119118
}
120119

@@ -128,8 +127,7 @@ int32_t tc_hmac_final(uint8_t *tag, uint32_t taglen, TCHmacState_t ctx)
128127
/* input sanity check: */
129128
if (tag == (uint8_t *) 0 ||
130129
taglen != TC_SHA256_DIGEST_SIZE ||
131-
ctx == (TCHmacState_t) 0 ||
132-
ctx->key == (uint8_t *) 0) {
130+
ctx == (TCHmacState_t) 0) {
133131
return TC_CRYPTO_FAIL;
134132
}
135133

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)