From f5074772da2aef840cb8539ff67abea365d1436b Mon Sep 17 00:00:00 2001 From: jordan Date: Tue, 15 Oct 2024 12:41:09 -0500 Subject: [PATCH] infer: fix more uninitialized value errors. --- tests/api.c | 6 +++--- wolfcrypt/src/asn.c | 6 +++--- wolfcrypt/test/test.c | 12 ++++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/api.c b/tests/api.c index 6d4dd9236..19919a8b7 100644 --- a/tests/api.c +++ b/tests/api.c @@ -21014,7 +21014,7 @@ static int test_RsaDecryptBoundsCheck(void) WC_RNG rng; RsaKey key; byte flatC[256]; - word32 flatCSz; + word32 flatCSz = 0; byte out[256]; word32 outSz = sizeof(out); @@ -23432,7 +23432,7 @@ static int test_wc_DsaSignVerify(void) byte hash[WC_SHA_DIGEST_SIZE]; word32 idx = 0; word32 bytes; - int answer; + int answer = 0; #ifdef USE_CERT_BUFFERS_1024 byte tmp[ONEK_BUF]; @@ -25778,7 +25778,7 @@ static int test_wc_ecc_params(void) #if !defined(NO_ECC256) && !defined(NO_ECC_SECP) /* Test for SECP256R1 curve */ int curve_id = ECC_SECP256R1; - int curve_idx; + int curve_idx = 0; ExpectIntNE(curve_idx = wc_ecc_get_curve_idx(curve_id), ECC_CURVE_INVALID); ExpectNotNull(ecc_set = wc_ecc_get_curve_params(curve_idx)); diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 11a7226f0..5ee4c8f20 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -25402,9 +25402,9 @@ int PemToDer(const unsigned char* buff, long longSz, int type, { const char* header = NULL; const char* footer = NULL; - const char* headerEnd; - const char* footerEnd; - const char* consumedEnd; + const char* headerEnd = NULL; + const char* footerEnd = NULL; + const char* consumedEnd = NULL; const char* bufferEnd = (const char*)(buff + longSz); long neededSz; int ret = 0; diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 66e81cbe3..df7b53af9 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -15005,8 +15005,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aesgcm_test(void) byte resultC[sizeof(p) + AES_BLOCK_SIZE]; wc_test_ret_t ret = 0; - int alen; - int plen; + int alen = 0; + int plen = 0; #if defined(WOLFSSL_XILINX_CRYPT_VERSAL) byte buf[sizeof(p) + AES_BLOCK_SIZE]; byte bufA[sizeof(a) + 1]; @@ -21482,7 +21482,7 @@ exit_rsa: WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void) { wc_test_ret_t ret; - size_t bytes; + size_t bytes = 0; WC_RNG rng; #if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) byte* tmp = NULL; @@ -22781,7 +22781,11 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dh_test(void) { wc_test_ret_t ret; word32 bytes; - word32 idx = 0, privSz, pubSz, privSz2, pubSz2; + word32 idx = 0; + word32 privSz = 0; + word32 pubSz = 0; + word32 privSz2 = 0; + word32 pubSz2 = 0; #ifndef WC_NO_RNG WC_RNG rng; int rngInit = 0;