Sync error codes with 1.0.1-stable.
[openssl.git] / crypto / evp / bio_enc.c
index afb4d319ceb6ce43656cbf2a9e76ef9e41ddf69e..3cf75f087e09d80890e078bfbabdfea22b701a61 100644 (file)
@@ -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);