Skip to content

Commit 2db5fbb

Browse files
authored
Merge pull request #9933 from rlm2002/coverity
20260309 Coverity changes for Sunday build
2 parents bfe0b21 + 66caf5a commit 2db5fbb

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12536,7 +12536,7 @@ static wc_test_ret_t EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
1253612536
ret = EVP_test(wolfSSL_EVP_aes_128_cfb8(), key1, iv, msg1, sizeof(msg1),
1253712537
cipher1, sizeof(cipher1));
1253812538
if (ret != 0) {
12539-
return ret;
12539+
ERROR_OUT(ret, out);
1254012540
}
1254112541
#endif
1254212542
ret = wc_AesSetKey(enc, key1, WC_AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
@@ -12583,7 +12583,7 @@ static wc_test_ret_t EVP_test(const WOLFSSL_EVP_CIPHER* type, const byte* key,
1258312583
ret = EVP_test(wolfSSL_EVP_aes_192_cfb8(), key2, iv2, msg2, sizeof(msg2),
1258412584
cipher2, sizeof(msg2));
1258512585
if (ret != 0) {
12586-
return ret;
12586+
ERROR_OUT(ret, out);
1258712587
}
1258812588
#endif
1258912589

@@ -25744,6 +25744,18 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
2574425744

2574525745
exit_rsa:
2574625746

25747+
(void)res;
25748+
(void)bytes;
25749+
(void)idx;
25750+
(void)in;
25751+
(void)out;
25752+
(void)plain;
25753+
(void)idx;
25754+
(void)inStr;
25755+
(void)inLen;
25756+
(void)outSz;
25757+
(void)plainSz;
25758+
2574725759
#if !defined(WOLFSSL_NO_MALLOC)
2574825760
XFREE(der, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
2574925761
#if defined(WOLFSSL_CERT_REQ)
@@ -25772,18 +25784,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
2577225784
WC_FREE_VAR(out, HEAP_HINT);
2577325785
WC_FREE_VAR(plain, HEAP_HINT);
2577425786

25775-
(void)res;
25776-
(void)bytes;
25777-
(void)idx;
25778-
(void)in;
25779-
(void)out;
25780-
(void)plain;
25781-
(void)idx;
25782-
(void)inStr;
25783-
(void)inLen;
25784-
(void)outSz;
25785-
(void)plainSz;
25786-
2578725787
/* ret can be greater then 0 with certgen but all negative values should
2578825788
* be returned and treated as an error */
2578925789
if (ret >= 0) {
@@ -28266,8 +28266,11 @@ static wc_test_ret_t openssl_aes_test(void)
2826628266
int num = 0;
2826728267

2826828268
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
28269-
if ((enc == NULL) || (dec == NULL))
28269+
if ((enc == NULL) || (dec == NULL)) {
28270+
XFREE(enc, HEAP_HINT, DYNAMIC_TYPE_AES);
28271+
XFREE(dec, HEAP_HINT, DYNAMIC_TYPE_AES);
2827028272
return MEMORY_E;
28273+
}
2827128274
#endif
2827228275

2827328276
XMEMCPY(iv, setIv, sizeof(setIv));
@@ -37600,7 +37603,7 @@ static wc_test_ret_t ecc_ctx_kdf_salt_test(WC_RNG* rng, ecc_key* a, ecc_key* b)
3760037603
}
3760137604

3760237605
XMEMSET(plaintext, 0, MAX_ECIES_TEST_SZ);
37603-
XSTRLCPY((char *)plaintext, message, sizeof plaintext);
37606+
XSTRLCPY((char *)plaintext, message, MAX_ECIES_TEST_SZ);
3760437607
plaintextLen = (((word32)XSTRLEN(message) + WC_AES_BLOCK_SIZE - 1) /
3760537608
WC_AES_BLOCK_SIZE) * WC_AES_BLOCK_SIZE;
3760637609

0 commit comments

Comments
 (0)