mirror of
https://github.com/openssl/openssl.git
synced 2025-04-06 20:20:50 +08:00
Add a test case for EVP_MD_meth_dup() and EVP_CIPHER_meth_dup()
Check that EVP_MD_meth_free() and EVP_CIPHER_meth_free() does actually free the data. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16159)
This commit is contained in:
parent
bb98a1123b
commit
03c2f21b98
@ -3690,7 +3690,25 @@ static int test_custom_pmeth(int idx)
|
||||
custom_pmeth = NULL;
|
||||
return testresult;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int test_evp_md_cipher_meth(void)
|
||||
{
|
||||
EVP_MD *md = EVP_MD_meth_dup(EVP_sha256());
|
||||
EVP_CIPHER *ciph = EVP_CIPHER_meth_dup(EVP_aes_128_cbc());
|
||||
int testresult = 0;
|
||||
|
||||
if (!TEST_ptr(md) || !TEST_ptr(ciph))
|
||||
goto err;
|
||||
|
||||
testresult = 1;
|
||||
|
||||
err:
|
||||
EVP_MD_meth_free(md);
|
||||
EVP_CIPHER_meth_free(ciph);
|
||||
|
||||
return testresult;
|
||||
}
|
||||
#endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1,
|
||||
@ -3814,6 +3832,7 @@ int setup_tests(void)
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
ADD_ALL_TESTS(test_custom_pmeth, 12);
|
||||
ADD_TEST(test_evp_md_cipher_meth);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user