summaryrefslogtreecommitdiffstats
path: root/test/ecdsatest.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-03-19 18:45:43 +0100
committerPauli <pauli@openssl.org>2021-03-28 16:38:57 +1000
commit2145ba5e8383184d7f212500ec2f759bdf08503a (patch)
treea862106cc508e75f170b3105e3b5919fb38219d3 /test/ecdsatest.c
parentc464583483df70ad8df9907168bf015d672742bd (diff)
Implement EVP_PKEY_dup() function
Fixes #14501 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14624)
Diffstat (limited to 'test/ecdsatest.c')
-rw-r--r--test/ecdsatest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index 38486f5955..2cd7b970a2 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -190,7 +190,7 @@ static int test_builtin(int n, int as)
EC_KEY *eckey_neg = NULL, *eckey = NULL;
unsigned char dirt, offset, tbs[128];
unsigned char *sig = NULL;
- EVP_PKEY *pkey_neg = NULL, *pkey = NULL;
+ EVP_PKEY *pkey_neg = NULL, *pkey = NULL, *dup_pk = NULL;
EVP_MD_CTX *mctx = NULL;
size_t sig_len;
int nid, ret = 0;
@@ -237,6 +237,10 @@ static int test_builtin(int n, int as)
|| !TEST_true(EVP_PKEY_assign_EC_KEY(pkey_neg, eckey_neg)))
goto err;
+ if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pkey))
+ || !TEST_int_eq(EVP_PKEY_eq(pkey, dup_pk), 1))
+ goto err;
+
temp = ECDSA_size(eckey);
/*
@@ -337,6 +341,7 @@ static int test_builtin(int n, int as)
err:
EVP_PKEY_free(pkey);
EVP_PKEY_free(pkey_neg);
+ EVP_PKEY_free(dup_pk);
EVP_MD_CTX_free(mctx);
OPENSSL_free(sig);
return ret;