diff options
author | Matt Caswell <matt@openssl.org> | 2021-07-27 10:32:49 +0100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-07-28 09:37:09 +1000 |
commit | 03c2f21b980524dc05a0426146f845ec1e969c2e (patch) | |
tree | 8fd967a77c7f2affd3ea09cc544ac1baa8168156 /test/evp_extra_test.c | |
parent | bb98a1123b3d7a8464f2c1f61ffd41f826c7c423 (diff) |
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)
Diffstat (limited to 'test/evp_extra_test.c')
-rw-r--r-- | test/evp_extra_test.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 7494c1f21b..e03e2a252e 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -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; |