Fixes for missing free calls on hash tests.

This commit is contained in:
David Garske
2020-08-26 09:48:46 -07:00
parent 6d5731b8e9
commit 1b2b3de2c9
2 changed files with 14 additions and 0 deletions

View File

@@ -33346,6 +33346,10 @@ static void test_wolfSSL_EVP_PKEY_sign(void)
SHA256_Init(&c);
SHA256_Update(&c, in, inlen);
SHA256_Final(hash, &c);
#ifdef WOLFSSL_SMALL_STACK_CACHE
/* workaround for small stack cache case */
wc_Sha256Free((wc_Sha256*)&c);
#endif
AssertNotNull(rsa = RSA_generate_key(2048, 3, NULL, NULL));
AssertNotNull(pkey = wolfSSL_EVP_PKEY_new());
@@ -35759,6 +35763,10 @@ static void test_wolfSSL_RSA_verify()
SHA256_Init(&c);
SHA256_Update(&c, text, strlen(text));
SHA256_Final(hash, &c);
#ifdef WOLFSSL_SMALL_STACK_CACHE
/* workaround for small stack cache case */
wc_Sha256Free((wc_Sha256*)&c);
#endif
/* read privete key file */
fp = XFOPEN(svrKeyFile, "r");

View File

@@ -320,6 +320,7 @@ int md5_test(void)
if (XMEMCMP(hash, test_md5[i].output, WC_MD5_DIGEST_SIZE) != 0)
return -5 - i;
}
wc_Md5Free(&md5);
return 0;
}
@@ -380,6 +381,7 @@ int sha_test(void)
if (XMEMCMP(hash, test_sha[i].output, WC_SHA_DIGEST_SIZE) != 0)
return -10 - i;
}
wc_ShaFree(&sha);
return 0;
}
@@ -426,6 +428,7 @@ int sha224_test(void)
if (XMEMCMP(hash, test_sha[i].output, WC_SHA224_DIGEST_SIZE) != 0)
return -10 - i;
}
wc_Sha224Free(&sha);
return 0;
}
@@ -475,6 +478,7 @@ int sha256_test(void)
if (XMEMCMP(hash, test_sha[i].output, WC_SHA256_DIGEST_SIZE) != 0)
return -10 - i;
}
wc_Sha256Free(&sha);
return 0;
}
@@ -529,6 +533,7 @@ int sha512_test(void)
if (XMEMCMP(hash, test_sha[i].output, WC_SHA512_DIGEST_SIZE) != 0)
return -10 - i;
}
wc_Sha512Free(&sha);
return 0;
}
@@ -581,6 +586,7 @@ int sha384_test(void)
if (XMEMCMP(hash, test_sha[i].output, WC_SHA384_DIGEST_SIZE) != 0)
return -10 - i;
}
wc_Sha384Free(&sha);
return 0;
}