Skip to content

Commit

Permalink
tests/api.c:test_Sha512_Family_Final(): fix unreachable null pointer …
Browse files Browse the repository at this point in the history
…deref reported by clang-tidy in FIPS/Async configs.
  • Loading branch information
douzzer committed Sep 18, 2024
1 parent 072c531 commit 263cb5b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -15007,14 +15007,20 @@ static int test_Sha512_Family_Final(int type, int isRaw)
hash_test[2] = hash3;
times = sizeof(hash_test) / sizeof(byte *);

/* Good test args. */
for (i = 0; i < times; i++) {
ExpectIntEQ(finalFp(&sha512, hash_test[i]), 0);
#if defined(HAVE_FIPS) || defined(HAVE_SELFTEST) || \
defined(WOLFSSL_NO_HASH_RAW)
if (finalFp != NULL)
#endif
{
/* Good test args. */
for (i = 0; i < times; i++) {
ExpectIntEQ(finalFp(&sha512, hash_test[i]), 0);
}
/* Test bad args. */
ExpectIntEQ(finalFp(NULL, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
ExpectIntEQ(finalFp(NULL, hash1), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
ExpectIntEQ(finalFp(&sha512, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
}
/* Test bad args. */
ExpectIntEQ(finalFp(NULL, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
ExpectIntEQ(finalFp(NULL, hash1), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
ExpectIntEQ(finalFp(&sha512, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));

freeFp(&sha512);

Expand Down

0 comments on commit 263cb5b

Please sign in to comment.