summaryrefslogtreecommitdiffstats
path: root/test/evp_extra_test2.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-01-07 11:47:20 +1100
committerPauli <ppzgs1@gmail.com>2022-01-19 21:50:22 +1100
commit0be4b0403d2f65adf0d037581223dbebd0fa135e (patch)
tree1c07fc0f442eee17ae59848d521b6c1da0b57c5d /test/evp_extra_test2.c
parent0324ae3e98725f722b7d7871c23fbbff596a5bf6 (diff)
test: add digest context dup tests
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17529)
Diffstat (limited to 'test/evp_extra_test2.c')
-rw-r--r--test/evp_extra_test2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/evp_extra_test2.c b/test/evp_extra_test2.c
index b70c168d9d..287f3d1443 100644
--- a/test/evp_extra_test2.c
+++ b/test/evp_extra_test2.c
@@ -853,6 +853,21 @@ static int test_rsa_pss_sign(void)
return ret;
}
+static int test_evp_md_ctx_dup(void)
+{
+ EVP_MD_CTX *mdctx;
+ EVP_MD_CTX *copyctx = NULL;
+ int ret;
+
+ /* test copying freshly initialized context */
+ ret = TEST_ptr(mdctx = EVP_MD_CTX_new())
+ && TEST_ptr(copyctx = EVP_MD_CTX_dup(mdctx));
+
+ EVP_MD_CTX_free(mdctx);
+ EVP_MD_CTX_free(copyctx);
+ return ret;
+}
+
static int test_evp_md_ctx_copy(void)
{
EVP_MD_CTX *mdctx = NULL;
@@ -895,6 +910,7 @@ int setup_tests(void)
#endif
ADD_ALL_TESTS(test_PEM_read_bio_negative, OSSL_NELEM(keydata));
ADD_TEST(test_rsa_pss_sign);
+ ADD_TEST(test_evp_md_ctx_dup);
ADD_TEST(test_evp_md_ctx_copy);
return 1;
}