提交 944f8580 编写于 作者: D Dr. Stephen Henson

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

the source.
上级 27a3d9f9
...@@ -252,23 +252,21 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx) ...@@ -252,23 +252,21 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
#endif #endif
if (pctx->pkey) if (pctx->pkey)
{
CRYPTO_add(&pctx->pkey->references,1,CRYPTO_LOCK_EVP_PKEY); CRYPTO_add(&pctx->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
rctx->pkey = pctx->pkey;
} rctx->pkey = pctx->pkey;
if (pctx->peerkey) if (pctx->peerkey)
{
CRYPTO_add(&pctx->peerkey->references,1,CRYPTO_LOCK_EVP_PKEY); CRYPTO_add(&pctx->peerkey->references,1,CRYPTO_LOCK_EVP_PKEY);
rctx->peerkey = pctx->peerkey;
} rctx->peerkey = pctx->peerkey;
rctx->data = NULL; rctx->data = NULL;
rctx->app_data = NULL; rctx->app_data = NULL;
rctx->operation = pctx->operation; rctx->operation = pctx->operation;
if (pctx->pmeth->copy(rctx, pctx) > 0) if (pctx->pmeth->copy(rctx, pctx) > 0)
return pctx; return rctx;
EVP_PKEY_CTX_free(rctx); EVP_PKEY_CTX_free(rctx);
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册