--- openssl-1.0.1g/engines/ccgost/gost_crypt.c	2014-03-17 20:14:20.000000000 +0400
+++ openssl-1.0.1g-debug/engines/ccgost/gost_crypt.c	2014-04-20 05:50:13.326825813 +0400
@@ -193,9 +193,12 @@ static int gost_cipher_init_cpa(EVP_CIPH
 	const unsigned char *iv, int enc)
 	{
 	struct ossl_gost_cipher_ctx *c=ctx->cipher_data;
-	gost_init(&(c->cctx),&Gost28147_CryptoProParamSetA);
-	c->key_meshing=1;
-	c->count=0;
+	if (ctx->app_data == NULL)
+		{
+		if (!gost_cipher_set_param(c,NID_undef)) return 0;
+		ctx->app_data = ctx->cipher_data;
+		}
+    
 	if(key) gost_key(&(c->cctx),key);
 	if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
 	memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
@@ -507,10 +510,15 @@ int gost_imit_init_cpa(EVP_MD_CTX *ctx)
 	struct ossl_gost_imit_ctx *c = ctx->md_data;
 	memset(c->buffer,0,sizeof(c->buffer));
 	memset(c->partial_block,0,sizeof(c->partial_block));
+
+	const struct gost_cipher_info *param;
+	param=get_encryption_params(NID_undef); /* Use default params. */
+	if (!param) return 0;
+	
+	gost_init(&(c->cctx), param->sblock);
 	c->count = 0;
 	c->bytes_left=0;
 	c->key_meshing=1;
-	gost_init(&(c->cctx),&Gost28147_CryptoProParamSetA);
 	return 1;
 	}
 
