@@ -1577,11 +1577,12 @@ static int test_wolfSSL_CTX_new(void)
15771577{
15781578 EXPECT_DECLS;
15791579 WOLFSSL_CTX *ctx;
1580- WOLFSSL_METHOD* method;
1580+ WOLFSSL_METHOD* method = NULL ;
15811581
15821582 ExpectNull(ctx = wolfSSL_CTX_new(NULL));
15831583 ExpectNotNull(method = wolfSSLv23_server_method());
1584- ExpectNotNull(ctx = wolfSSL_CTX_new(method));
1584+ if (method != NULL)
1585+ ExpectNotNull(ctx = wolfSSL_CTX_new(method));
15851586
15861587 wolfSSL_CTX_free(ctx);
15871588
@@ -21281,7 +21282,7 @@ static int test_wc_RsaKeyToPublicDer(void)
2128121282 int bits = 2048;
2128221283 word32 derLen = 294;
2128321284#endif
21284- int ret;
21285+ int ret = 0 ;
2128521286
2128621287 XMEMSET(&rng, 0, sizeof(rng));
2128721288 XMEMSET(&key, 0, sizeof(key));
@@ -24489,7 +24490,7 @@ static int test_wc_curve25519_make_key(void)
2448924490#if defined(HAVE_CURVE25519)
2449024491 curve25519_key key;
2449124492 WC_RNG rng;
24492- int keysize;
24493+ int keysize = 0 ;
2449324494
2449424495 XMEMSET(&rng, 0, sizeof(WC_RNG));
2449524496
@@ -25193,7 +25194,7 @@ static int test_wc_curve448_make_key(void)
2519325194#if defined(HAVE_CURVE448)
2519425195 curve448_key key;
2519525196 WC_RNG rng;
25196- int keysize;
25197+ int keysize = 0 ;
2519725198
2519825199 XMEMSET(&rng, 0, sizeof(WC_RNG));
2519925200
@@ -25623,7 +25624,7 @@ static int test_wc_ecc_params(void)
2562325624 /* FIPS/CAVP self-test modules do not have `wc_ecc_get_curve_params`.
2562425625 It was added after certifications */
2562525626#if defined(HAVE_ECC) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
25626- const ecc_set_type* ecc_set;
25627+ const ecc_set_type* ecc_set = NULL ;
2562725628#if !defined(NO_ECC256) && !defined(NO_ECC_SECP)
2562825629 /* Test for SECP256R1 curve */
2562925630 int curve_id = ECC_SECP256R1;
@@ -53232,7 +53233,7 @@ static int test_wolfSSL_ASN1_TIME(void)
5323253233 EXPECT_DECLS;
5323353234#if defined(OPENSSL_EXTRA) && !defined(NO_ASN_TIME)
5323453235 WOLFSSL_ASN1_TIME* asn_time = NULL;
53235- unsigned char *data;
53236+ unsigned char *data = NULL ;
5323653237
5323753238 ExpectNotNull(asn_time = ASN1_TIME_new());
5323853239
@@ -54136,7 +54137,7 @@ static int test_wolfSSL_IMPLEMENT_ASN1_FUNCTIONS(void)
5413654137 ExpectIntEQ(ASN1_INTEGER_set(nested_asn1->asn1_obj->expNum, 22222), 1);
5413754138 /* nested_asn1->asn1_obj->strList */
5413854139 for (i = 10; i >= 0; i--) {
54139- ASN1_GENERALSTRING* genStr;
54140+ ASN1_GENERALSTRING* genStr = NULL ;
5414054141 char fmtStr[20];
5414154142
5414254143 ExpectIntGT(snprintf(fmtStr, sizeof(fmtStr), "Bonjour #%d", i), 0);
@@ -54177,7 +54178,7 @@ static int test_wolfSSL_IMPLEMENT_ASN1_FUNCTIONS(void)
5417754178
5417854179 ExpectNotNull(asn1_item = TEST_ASN1_ITEM_new());
5417954180 for (i = 0; i < 11; i++) {
54180- ASN1_INTEGER* asn1_num;
54181+ ASN1_INTEGER* asn1_num = NULL ;
5418154182
5418254183 ExpectNotNull(asn1_num = ASN1_INTEGER_new());
5418354184 ExpectIntEQ(ASN1_INTEGER_set(asn1_num, i), 1);
@@ -62069,7 +62070,7 @@ static int test_wolfSSL_PEM_read_bio(void)
6206962070 !defined(NO_FILESYSTEM) && !defined(NO_RSA)
6207062071 byte buff[6000];
6207162072 XFILE f = XBADFILE;
62072- int bytes;
62073+ int bytes = 0 ;
6207362074 X509* x509 = NULL;
6207462075 BIO* bio = NULL;
6207562076 BUF_MEM* buf = NULL;
@@ -64135,7 +64136,7 @@ static int test_wolfSSL_PKCS8_Compat(void)
6413564136 PKCS8_PRIV_KEY_INFO* pt = NULL;
6413664137 BIO* bio = NULL;
6413764138 XFILE f = XBADFILE;
64138- int bytes;
64139+ int bytes = 0 ;
6413964140 char pkcs8_buffer[512];
6414064141#if defined(OPENSSL_ALL) || defined(WOLFSSL_WPAS_SMALL)
6414164142 EVP_PKEY *pkey = NULL;
@@ -65156,7 +65157,7 @@ static int test_wolfSSL_SHA224(void)
6515665157 "\x50\xb0\xc6\x45\x5c\xb4\xf5\x8b\x19\x52\x52\x25\x25";
6515765158 size_t inLen;
6515865159 byte hash[WC_SHA224_DIGEST_SIZE];
65159- unsigned char* p;
65160+ unsigned char* p = NULL ;
6516065161
6516165162 inLen = XSTRLEN((char*)input);
6516265163
@@ -70176,7 +70177,7 @@ static int test_wolfSSL_GENERAL_NAME_print(void)
7017670177 GENERAL_NAME* gn = NULL;
7017770178 unsigned char buf[4096];
7017870179 const unsigned char* bufPt = NULL;
70179- int bytes;
70180+ int bytes = 0 ;
7018070181 XFILE f = XBADFILE;
7018170182 STACK_OF(GENERAL_NAME)* sk = NULL;
7018270183 BIO* out = NULL;
@@ -70532,7 +70533,7 @@ static int test_wolfSSL_verify_depth(void)
7053270533#if defined(OPENSSL_EXTRA) && !defined(NO_RSA) && !defined(NO_WOLFSSL_CLIENT)
7053370534 WOLFSSL* ssl = NULL;
7053470535 WOLFSSL_CTX* ctx = NULL;
70535- long depth;
70536+ long depth = 0 ;
7053670537
7053770538 ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_client_method()));
7053870539 ExpectIntGT((depth = SSL_CTX_get_verify_depth(ctx)), 0);
@@ -74168,7 +74169,7 @@ static int test_wolfSSL_d2i_and_i2d_PublicKey_ecc(void)
7416874169 BN_CTX* ctx;
7416974170 EC_GROUP* curve = NULL;
7417074171 EC_KEY* ephemeral_key = NULL;
74171- const EC_POINT* h;
74172+ const EC_POINT* h = NULL ;
7417274173
7417374174 /* Generate an x963 key pair and get public part into pub_buf */
7417474175 ExpectNotNull(ctx = BN_CTX_new());
@@ -75216,7 +75217,7 @@ static int test_wc_SetIssuerRaw(void)
7521675217 const char* joiCertFile = "./certs/test/cert-ext-joi.der";
7521775218 WOLFSSL_X509* x509 = NULL;
7521875219 int peerCertSz;
75219- const byte* peerCertBuf;
75220+ const byte* peerCertBuf = NULL ;
7522075221 Cert forgedCert;
7522175222
7522275223 ExpectNotNull(x509 = wolfSSL_X509_load_certificate_file(joiCertFile,
@@ -75241,7 +75242,7 @@ static int test_wc_SetIssueBuffer(void)
7524175242 const char* joiCertFile = "./certs/test/cert-ext-joi.der";
7524275243 WOLFSSL_X509* x509 = NULL;
7524375244 int peerCertSz;
75244- const byte* peerCertBuf;
75245+ const byte* peerCertBuf = NULL ;
7524575246 Cert forgedCert;
7524675247
7524775248 ExpectNotNull(x509 = wolfSSL_X509_load_certificate_file(joiCertFile,
@@ -83258,7 +83259,7 @@ static int test_wolfSSL_DH_check(void)
8325883259 byte buf[6000];
8325983260 char file[] = "./certs/dsaparams.pem";
8326083261 XFILE f = XBADFILE;
83261- int bytes;
83262+ int bytes = 0 ;
8326283263 BIO* bio = NULL;
8326383264 DSA* dsa = NULL;
8326483265#elif !defined(HAVE_FIPS) || FIPS_VERSION_GT(2,0)
@@ -85479,7 +85480,7 @@ static int test_openssl_make_self_signed_certificate(EVP_PKEY* pkey,
8547985480 BIGNUM* serial_number = NULL;
8548085481 X509_NAME* name = NULL;
8548185482 time_t epoch_off = 0;
85482- ASN1_INTEGER* asn1_serial_number;
85483+ ASN1_INTEGER* asn1_serial_number = NULL ;
8548385484 long not_before, not_after;
8548485485 int derSz;
8548585486
0 commit comments