forked from wolfSSL/wolfssl
tests/api.c:test_Sha512_Family_Final(): fix unreachable null pointer deref reported by clang-tidy in FIPS/Async configs.
This commit is contained in:
@@ -15007,6 +15007,11 @@ static int test_Sha512_Family_Final(int type, int isRaw)
|
|||||||
hash_test[2] = hash3;
|
hash_test[2] = hash3;
|
||||||
times = sizeof(hash_test) / sizeof(byte *);
|
times = sizeof(hash_test) / sizeof(byte *);
|
||||||
|
|
||||||
|
#if defined(HAVE_FIPS) || defined(HAVE_SELFTEST) || \
|
||||||
|
defined(WOLFSSL_NO_HASH_RAW)
|
||||||
|
if (finalFp != NULL)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
/* Good test args. */
|
/* Good test args. */
|
||||||
for (i = 0; i < times; i++) {
|
for (i = 0; i < times; i++) {
|
||||||
ExpectIntEQ(finalFp(&sha512, hash_test[i]), 0);
|
ExpectIntEQ(finalFp(&sha512, hash_test[i]), 0);
|
||||||
@@ -15015,6 +15020,7 @@ static int test_Sha512_Family_Final(int type, int isRaw)
|
|||||||
ExpectIntEQ(finalFp(NULL, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
ExpectIntEQ(finalFp(NULL, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||||
ExpectIntEQ(finalFp(NULL, hash1), 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));
|
ExpectIntEQ(finalFp(&sha512, NULL), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||||
|
}
|
||||||
|
|
||||||
freeFp(&sha512);
|
freeFp(&sha512);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user