diff --git a/src/ssl.c b/src/ssl.c index 2bb95afaf..25c6416c4 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -22040,9 +22040,8 @@ void wolfSSL_EC_POINT_free(WOLFSSL_EC_POINT *p) WOLFSSL_ENTER("wolfSSL_EC_POINT_free"); if (p != NULL) { - if (p->internal == NULL) { + if (p->internal != NULL) { wc_ecc_del_point((ecc_point*)p->internal); - XFREE(p->internal, NULL, DYNAMIC_TYPE_ECC); p->internal = NULL; } diff --git a/tests/api.c b/tests/api.c index 274d09c7c..9f9e567c5 100644 --- a/tests/api.c +++ b/tests/api.c @@ -775,7 +775,6 @@ static void test_wolfSSL_EC(void) Gxy->X = Gx; Gxy->Y = Gy; Gxy->Z = Gz; - Gxy->inSet = 0; /* perform point multiplication */ AssertIntEQ(EC_POINT_mul(group, new_point, NULL, Gxy, k, ctx), WOLFSSL_SUCCESS); @@ -9759,9 +9758,9 @@ static void test_wolfSSL_EVP_PKEY_new_mac_key(void) #ifdef OPENSSL_EXTRA static const unsigned char pw[] = "password"; static const int pwSz = sizeof(pw) - 1; - size_t checkPwSz; - const unsigned char* checkPw; - WOLFSSL_EVP_PKEY* key; + size_t checkPwSz = 0; + const unsigned char* checkPw = NULL; + WOLFSSL_EVP_PKEY* key = NULL; printf(testingFmt, "wolfSSL_EVP_PKEY_new_mac_key()"); @@ -9780,15 +9779,15 @@ static void test_wolfSSL_EVP_PKEY_new_mac_key(void) AssertNotNull(key = wolfSSL_EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, pw, 0)); AssertIntEQ(key->pkey_sz, 0); - AssertNotNull(key->pkey.ptr); - AssertNotNull(checkPw = wolfSSL_EVP_PKEY_get0_hmac(key, &checkPwSz)); + checkPw = wolfSSL_EVP_PKEY_get0_hmac(key, &checkPwSz); + (void)checkPw; AssertIntEQ((int)checkPwSz, 0); wolfSSL_EVP_PKEY_free(key); AssertNotNull(key = wolfSSL_EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, NULL, 0)); AssertIntEQ(key->pkey_sz, 0); - AssertNotNull(key->pkey.ptr); - AssertNotNull(checkPw = wolfSSL_EVP_PKEY_get0_hmac(key, &checkPwSz)); + checkPw = wolfSSL_EVP_PKEY_get0_hmac(key, &checkPwSz); + (void)checkPw; AssertIntEQ((int)checkPwSz, 0); wolfSSL_EVP_PKEY_free(key); diff --git a/wolfcrypt/src/evp.c b/wolfcrypt/src/evp.c index 5fcd0d201..fb678fb5c 100644 --- a/wolfcrypt/src/evp.c +++ b/wolfcrypt/src/evp.c @@ -569,7 +569,7 @@ WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_mac_key(int type, ENGINE* e, pkey = wolfSSL_PKEY_new(); if (pkey != NULL) { pkey->pkey.ptr = (char*)XMALLOC(keylen, NULL, DYNAMIC_TYPE_PUBLIC_KEY); - if (pkey->pkey.ptr == NULL) { + if (pkey->pkey.ptr == NULL && keylen > 0) { wolfSSL_EVP_PKEY_free(pkey); pkey = NULL; }