From 8bdcef40e48f167e0d566fc5a831c05a7d94d7b1 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 24 May 2006 23:49:30 +0000 Subject: New function to dup EVP_PKEY_CTX. This will be needed to make new signing functions and EVP_MD_CTX_copy work properly. --- crypto/ec/ec_pmeth.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crypto/ec/ec_pmeth.c') diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index 760200892e..caaeebdb6d 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -88,6 +88,23 @@ static int pkey_ec_init(EVP_PKEY_CTX *ctx) return 1; } +static int pkey_ec_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) + { + EC_PKEY_CTX *dctx, *sctx; + if (!pkey_ec_init(dst)) + return 0; + sctx = src->data; + dctx = dst->data; + if (sctx->gen_group) + { + dctx->gen_group = EC_GROUP_dup(sctx->gen_group); + if (!dctx->gen_group) + return 0; + } + dctx->md = sctx->md; + return 1; + } + static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx) { EC_PKEY_CTX *dctx = ctx->data; @@ -284,6 +301,7 @@ const EVP_PKEY_METHOD ec_pkey_meth = EVP_PKEY_EC, 0, pkey_ec_init, + pkey_ec_copy, pkey_ec_cleanup, 0, -- cgit v1.2.3