summaryrefslogtreecommitdiffstats
path: root/crypto/evp/bio_enc.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2010-02-07 13:39:39 +0000
committerDr. Stephen Henson <steve@openssl.org>2010-02-07 13:39:39 +0000
commitc2bf720842d4a38bf00d3fcfdca6864ec82dc6c6 (patch)
tree353ff5cd682cbc816f17b22761019a948a34526b /crypto/evp/bio_enc.c
parentc95bf51167f7d7b5d21d84bef02832bb896888de (diff)
Add missing function EVP_CIPHER_CTX_copy(). Current code uses memcpy() to copy
an EVP_CIPHER_CTX structure which may have problems with external ENGINEs who need to duplicate internal handles etc.
Diffstat (limited to 'crypto/evp/bio_enc.c')
-rw-r--r--crypto/evp/bio_enc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c
index afb4d319ce..3cf75f087e 100644
--- a/crypto/evp/bio_enc.c
+++ b/crypto/evp/bio_enc.c
@@ -370,8 +370,10 @@ again:
case BIO_CTRL_DUP:
dbio=(BIO *)ptr;
dctx=(BIO_ENC_CTX *)dbio->ptr;
- memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher));
- dbio->init=1;
+ EVP_CIPHER_CTX_init(&dctx->cipher);
+ ret = EVP_CIPHER_CTX_copy(&dctx->cipher,&ctx->cipher);
+ if (ret)
+ dbio->init=1;
break;
default:
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);