Fix EVP_PKEY_CTX_dup() to return correct value and handle NULL keys in

the source.
This commit is contained in:
Dr. Stephen Henson 2006-06-27 17:23:24 +00:00
parent 27a3d9f9aa
commit 944f858021

View file

@ -252,23 +252,21 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
#endif
if (pctx->pkey)
{
CRYPTO_add(&pctx->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
rctx->pkey = pctx->pkey;
}
if (pctx->peerkey)
{
CRYPTO_add(&pctx->peerkey->references,1,CRYPTO_LOCK_EVP_PKEY);
rctx->peerkey = pctx->peerkey;
}
rctx->data = NULL;
rctx->app_data = NULL;
rctx->operation = pctx->operation;
if (pctx->pmeth->copy(rctx, pctx) > 0)
return pctx;
return rctx;
EVP_PKEY_CTX_free(rctx);
return NULL;