int gost_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
{
- memcpy(to->md_data,from->md_data,sizeof(struct ossl_gost_digest_ctx));
+ struct ossl_gost_digest_ctx *md_ctx=to->md_data;
+ if (to->md_data && from->md_data) {
+ memcpy(to->md_data,from->md_data,sizeof(struct ossl_gost_digest_ctx));
+ md_ctx->dctx.cipher_ctx=&(md_ctx->cctx);
+ }
return 1;
}
int gost_digest_cleanup(EVP_MD_CTX *ctx)
{
+ if (ctx->md_data)
memset(ctx->md_data,0,sizeof(struct ossl_gost_digest_ctx));
return 1;
}