summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-06-27 17:23:24 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-06-27 17:23:24 +0000
commit944f858021afb04ba4758b19716b118108ac3fcf (patch)
treea209801eb3f97ffd8082549858f3347e46326dea /crypto/evp
parent27a3d9f9aa1ca6137ffd13a23775709c6f1ef567 (diff)
Fix EVP_PKEY_CTX_dup() to return correct value and handle NULL keys in
the source.
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/pmeth_lib.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index 49a8ee99cb..5b8000d691 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -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;
- }
+
+ rctx->pkey = pctx->pkey;
if (pctx->peerkey)
- {
CRYPTO_add(&pctx->peerkey->references,1,CRYPTO_LOCK_EVP_PKEY);
- rctx->peerkey = pctx->peerkey;
- }
+
+ 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;