Skip to content

Commit 1de7320

Browse files
author
gojimmypi
committed
Remove unreachable test code
1 parent b38ab8a commit 1de7320

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6336,7 +6336,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
63366336

63376337
/* Try valid hash algorithms. */
63386338
for (i = 0; i < (int)(sizeof(typesGood)/sizeof(*typesGood)); i++) {
6339-
exp_ret = 0; /* For valid had, we expect return result to be zero */
6339+
exp_ret = 0; /* For valid hash, we expect return result to be zero */
63406340

63416341
/* See if the current hash type is one of the known types that are
63426342
* not implemented or not compiled in (disabled): */
@@ -6378,8 +6378,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
63786378
wc_HashFree(hash, typesGood[i]);
63796379

63806380
digestSz = wc_HashGetDigestSize(typesGood[i]);
6381-
if (exp_ret < 0 && digestSz != exp_ret)
6382-
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
63836381
if (exp_ret == 0 && digestSz < 0)
63846382
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
63856383
if (exp_ret == 0) {
@@ -6395,16 +6393,13 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
63956393
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
63966394

63976395
ret = wc_HashGetBlockSize(typesGood[i]);
6398-
if (exp_ret < 0 && ret != exp_ret)
6399-
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
64006396
if (exp_ret == 0 && ret < 0)
64016397
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
64026398

64036399
#if !defined(NO_ASN) || !defined(NO_DH) || defined(HAVE_ECC)
64046400
ret = wc_HashGetOID(typesGood[i]);
6405-
if (ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG) ||
6406-
(exp_ret == 0 && ret == WC_NO_ERR_TRACE(HASH_TYPE_E)) ||
6407-
(exp_ret != 0 && ret != WC_NO_ERR_TRACE(HASH_TYPE_E))) {
6401+
if ( (ret == WC_NO_ERR_TRACE(HASH_TYPE_E) && (exp_ret == 0)) ||
6402+
(ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG)) ) {
64086403
ERROR_OUT(WC_TEST_RET_ENC_I(i), out);
64096404
}
64106405

0 commit comments

Comments
 (0)