diff -urN openssl-1.0.1c-orig/test/Makefile openssl-1.0.1c/test/Makefile
--- openssl-1.0.1c-orig/test/Makefile	2011-12-27 18:38:27.000000000 +0400
+++ openssl-1.0.1c/test/Makefile	2012-11-17 13:22:01.000000000 +0400
@@ -38,6 +38,7 @@
 SHA1TEST=	sha1test
 SHA256TEST=	sha256t
 SHA512TEST=	sha512t
+GOST341194TEST=	gost341194t
 MDC2TEST=	mdc2test
 RMDTEST=	rmdtest
 MD2TEST=	md2test
@@ -70,6 +71,7 @@
 	$(MD2TEST)$(EXE_EXT)  $(MD4TEST)$(EXE_EXT) $(MD5TEST)$(EXE_EXT) $(HMACTEST)$(EXE_EXT) $(WPTEST)$(EXE_EXT) \
 	$(RC2TEST)$(EXE_EXT) $(RC4TEST)$(EXE_EXT) $(RC5TEST)$(EXE_EXT) \
 	$(DESTEST)$(EXE_EXT) $(SHATEST)$(EXE_EXT) $(SHA1TEST)$(EXE_EXT) $(SHA256TEST)$(EXE_EXT) $(SHA512TEST)$(EXE_EXT) \
+	$(GOST341194TEST)$(EXE_EXT) \
 	$(MDC2TEST)$(EXE_EXT) $(RMDTEST)$(EXE_EXT) \
 	$(RANDTEST)$(EXE_EXT) $(DHTEST)$(EXE_EXT) $(ENGINETEST)$(EXE_EXT) \
 	$(BFTEST)$(EXE_EXT) $(CASTTEST)$(EXE_EXT) $(SSLTEST)$(EXE_EXT) $(EXPTEST)$(EXE_EXT) $(DSATEST)$(EXE_EXT) $(RSATEST)$(EXE_EXT) \
@@ -83,6 +85,7 @@
 	$(HMACTEST).o $(WPTEST).o \
 	$(RC2TEST).o $(RC4TEST).o $(RC5TEST).o \
 	$(DESTEST).o $(SHATEST).o $(SHA1TEST).o $(SHA256TEST).o $(SHA512TEST).o \
+	$(GOST341194TEST).o \
 	$(MDC2TEST).o $(RMDTEST).o \
 	$(RANDTEST).o $(DHTEST).o $(ENGINETEST).o $(CASTTEST).o \
 	$(BFTEST).o  $(SSLTEST).o  $(DSATEST).o  $(EXPTEST).o $(RSATEST).o \
@@ -130,7 +133,7 @@
 	@(cd ..; $(MAKE) DIRS=apps all)
 
 alltests: \
-	test_des test_idea test_sha test_md4 test_md5 test_hmac \
+	test_des test_idea test_sha test_gost341194 test_md4 test_md5 test_hmac \
 	test_md2 test_mdc2 test_wp \
 	test_rmd test_rc2 test_rc4 test_rc5 test_bf test_cast test_aes \
 	test_rand test_bn test_ec test_ecdsa test_ecdh \
@@ -153,6 +156,9 @@
 	../util/shlib_wrap.sh ./$(SHA1TEST)
 	../util/shlib_wrap.sh ./$(SHA256TEST)
 	../util/shlib_wrap.sh ./$(SHA512TEST)
+	
+test_gost341194:
+	../util/shlib_wrap.sh ./$(GOST341194TEST)
 
 test_mdc2:
 	../util/shlib_wrap.sh ./$(MDC2TEST)
@@ -394,6 +400,9 @@
 $(SHA512TEST)$(EXE_EXT): $(SHA512TEST).o $(DLIBCRYPTO)
 	@target=$(SHA512TEST); $(BUILD_CMD)
 
+$(GOST341194TEST)$(EXE_EXT): $(GOST341194TEST).o $(DLIBCRYPTO)
+	@target=$(GOST341194TEST); $(BUILD_CMD)
+
 $(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
 	@target=$(RMDTEST); $(BUILD_CMD)
 
diff -urN openssl-1.0.1c-orig/test/gost341194t.c openssl-1.0.1c/test/gost341194t.c
--- openssl-1.0.1c-orig/test/gost341194t.c	1970-01-01 03:00:00.000000000 +0300
+++ openssl-1.0.1c/test/gost341194t.c	2012-11-17 12:14:03.000000000 +0400
@@ -0,0 +1,270 @@
+/* vim: set fileencoding=ascii : Charset: ASCII */
+/* test/gostr341194t.c */
+/* ====================================================================
+ * Copyright (c) 2012 Crypto-Pro, Ltd., Serguei E. Leontiev,
+ *                    leo@sai.msu.ru
+ *
+ * This file is distributed under the same license as OpenSSL
+ * ====================================================================
+ */
+#include <stdio.h>
+
+#if defined(OPENSSL_NO_ENGINE) || defined(OPENSSL_NO_GOST)
+int main(int argc, char *argv[])
+{
+    printf("No GOST R 34.11-94 support\n");
+    return 0;
+}
+#else
+
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/conf.h>
+#include <openssl/crypto.h>
+#include <openssl/engine.h>
+#include <openssl/evp.h>
+
+#define CCGOST_ID "gost"
+#define CCGOST_MD "md_gost94"
+#define CCGOST_DIR "../engines/ccgost"
+#include "../engines/ccgost/gosthash.h"
+
+#define G94_DIGEST_LENGTH	(32)
+
+typedef byte g94_digest_val[G94_DIGEST_LENGTH];
+
+typedef struct g94_tc_ {
+    unsigned long long len;
+    const char *msg;
+    g94_digest_val tps_digest;	/* GostR3411_94_TestParamSet */
+    g94_digest_val cpps_digest;	/* GostR3411_94_CryptoProParamSet */
+}   g94_tc;
+
+const g94_tc tcs[] = {
+    {
+	0, "",
+	{ 
+	    0xce, 0x85, 0xb9, 0x9c, 0xc4, 0x67, 0x52, 0xff,
+	    0xfe, 0xe3, 0x5c, 0xab, 0x9a, 0x7b, 0x02, 0x78,
+	    0xab, 0xb4, 0xc2, 0xd2, 0x05, 0x5c, 0xff, 0x68,
+	    0x5a, 0xf4, 0x91, 0x2c, 0x49, 0x49, 0x0f, 0x8d
+	},
+	{ /* Computed by CryptoPro CSP, MacOSX, cryptcp -hash */
+	    0x98, 0x1e, 0x5f, 0x3c, 0xa3, 0x0c, 0x84, 0x14, 
+	    0x87, 0x83, 0x0f, 0x84, 0xfb, 0x43, 0x3e, 0x13, 
+	    0xac, 0x11, 0x01, 0x56, 0x9b, 0x9c, 0x13, 0x58, 
+	    0x4a, 0xc4, 0x83, 0x23, 0x4c, 0xd6, 0x56, 0xc0 
+	}
+    },
+    {
+	15, "123456789abcdef",
+	{ 
+           0xc9, 0xa8, 0x28, 0x95, 0x67, 0xbf, 0xea, 0xc1,
+           0xce, 0x25, 0xb6, 0x26, 0x94, 0x09, 0xce, 0xde, 
+           0x5e, 0x39, 0x5b, 0x42, 0x75, 0x0c, 0x3a, 0x76, 
+           0x60, 0x3f, 0xef, 0x14, 0x26, 0x8c, 0x16, 0xf0
+	},
+	{ /* Computed by CryptoPro CSP, MacOSX, cryptcp -hash */
+           0x15, 0x21, 0xd4, 0xfa, 0x2e, 0x5d, 0xbf, 0xb6,
+           0x94, 0x5e, 0x7c, 0x84, 0x33, 0x9b, 0xd9, 0x37,
+           0x61, 0x7d, 0x91, 0x14, 0x35, 0xd9, 0x7b, 0xda,
+           0xb5, 0x4c, 0x8e, 0x85, 0x92, 0x0c, 0x15, 0xde
+	}
+    },
+    {
+	32, "This is message, length=32 bytes",
+	{ /* See p. A.3.1 [GOSTR341194], p. 7.3.1 [ENG-GOSTR341194] */
+	  /* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
+	  /* See p. 12.11.A [rus-fedchenko-cpike-ipsecme-gost-00-rp] */
+	    0xb1, 0xc4, 0x66, 0xd3, 0x75, 0x19, 0xb8, 0x2e,
+	    0x83, 0x19, 0x81, 0x9f, 0xf3, 0x25, 0x95, 0xe0,
+	    0x47, 0xa2, 0x8c, 0xb6, 0xf8, 0x3e, 0xff, 0x1c,
+	    0x69, 0x16, 0xa8, 0x15, 0xa6, 0x37, 0xff, 0xfa 
+	},
+	{ /* Computed by CryptoPro CSP, MacOSX, cryptcp -hash */
+	    0x2c, 0xef, 0xc2, 0xf7, 0xb7, 0xbd, 0xc5, 0x14,
+	    0xe1, 0x8e, 0xa5, 0x7f, 0xa7, 0x4f, 0xf3, 0x57,
+	    0xe7, 0xfa, 0x17, 0xd6, 0x52, 0xc7, 0x5f, 0x69,
+	    0xcb, 0x1b, 0xe7, 0x89, 0x3e, 0xde, 0x48, 0xeb 
+	}
+    },
+    {
+	50, "Suppose the original message has length = 50 bytes",
+	{ /* See p. A.3.2 [GOSTR341194], p. 7.3.2 [ENG-GOSTR341194] */
+	  /* <http://tools.ietf.org/html/rfc5831#section-7.3.2> */
+	  /* See p. 12.11.B [rus-fedchenko-cpike-ipsecme-gost-00-rp] */
+	    0x47, 0x1a, 0xba, 0x57, 0xa6, 0x0a, 0x77, 0x0d,
+	    0x3a, 0x76, 0x13, 0x06, 0x35, 0xc1, 0xfb, 0xea,
+	    0x4e, 0xf1, 0x4d, 0xe5, 0x1f, 0x78, 0xb4, 0xae,
+	    0x57, 0xdd, 0x89, 0x3b, 0x62, 0xf5, 0x52, 0x08 
+	},
+	{ /* See p. 12.11.C [rus-fedchenko-cpike-ipsecme-gost-00-rp] */
+	    0xc3, 0x73, 0x0c, 0x5c, 0xbc, 0xca, 0xcf, 0x91,
+	    0x5a, 0xc2, 0x92, 0x67, 0x6f, 0x21, 0xe8, 0xbd,
+	    0x4e, 0xf7, 0x53, 0x31, 0xd9, 0x40, 0x5e, 0x5f,
+	    0x1a, 0x61, 0xdc, 0x31, 0x30, 0xa6, 0x50, 0x11 
+	}
+    },
+    {
+	1000*1000, NULL,
+	{
+	    0x1f, 0xfc, 0x4d, 0xbb, 0xec, 0xf9, 0x71, 0x6a,
+	    0x60, 0x5d, 0x5a, 0x3c, 0x04, 0x62, 0x70, 0xc7,
+	    0xaa, 0xe1, 0x44, 0x02, 0x1e, 0x87, 0x84, 0x94,
+	    0x30, 0xba, 0xc9, 0x75, 0x87, 0x4c, 0x05, 0x50
+	},
+	{ /* Computed by CryptoPro CSP, MacOSX, cryptcp -hash */
+	    0x7d, 0xea, 0x5f, 0xdd, 0xa6, 0x81, 0xff, 0x14,
+	    0x3a, 0x82, 0x20, 0x4d, 0x7d, 0x16, 0xf1, 0x68,
+	    0x27, 0x8b, 0xfe, 0xde, 0xe7, 0x7d, 0x77, 0xa3,
+	    0x5c, 0xb3, 0x45, 0xeb, 0xb7, 0xca, 0x51, 0xe4
+	}
+    },
+    {
+	5ULL*1024ULL*1024ULL*1024ULL, NULL, 
+	{
+	    0x39, 0xe4, 0x78, 0xd4, 0xa9, 0x22, 0xc4, 0x22,
+	    0xf0, 0x49, 0x21, 0x76, 0x72, 0x92, 0x89, 0xb7,
+	    0x50, 0xfe, 0x29, 0xce, 0x0d, 0xf1, 0x6f, 0x05,
+	    0x8f, 0xd4, 0x29, 0xef, 0x41, 0x43, 0x47, 0xb8
+	},
+	{ /* Computed by CryptoPro CSP, MacOSX, cryptcp -hash */
+	    0x33, 0x50, 0xd5, 0x52, 0xc2, 0x10, 0x44, 0x7d,
+	    0xf6, 0x63, 0xf7, 0x14, 0x12, 0xd5, 0x95, 0xc3,
+	    0x17, 0xb7, 0x81, 0x5d, 0x6f, 0xa3, 0x18, 0x64,
+	    0xf1, 0x0e, 0x36, 0x27, 0xf2, 0xcb, 0x1f, 0x84
+	}
+    }
+};
+
+int main(int argc, char *argv[])
+{
+    int t;
+    unsigned long long b;
+    unsigned long long maxlen = 5*1000*1000;
+    int ignore = 0;
+    ENGINE *impl = NULL;
+    EVP_MD_CTX evp;
+    unsigned char edv[EVP_MAX_MD_SIZE];
+    unsigned int sdv = 0;
+    const EVP_MD *md_gost94 = NULL;
+
+    byte zb[509] = { 0 };
+
+    printf("Testing GOST R 34.11-94 ");
+
+    if(1 < argc) {
+	if(1 != sscanf(argv[1], "%llu", &maxlen) ||
+	   ( 2 < argc ? 
+	     1 != sscanf(argv[2], "%d", &ignore) : 0)) {
+	    fflush(NULL);
+	    fprintf(stderr, "Usage: %s [maxlen [ignore-error]]\n", 
+	    			argv[0]);
+	    return 1;
+	}
+    }
+
+    /* 
+     * Internal function test on GostR3411_94_TestParamSet
+     */
+    #ifdef OPENSSL_NO_DYNAMIC_ENGINE
+    {
+	gost_hash_ctx ctx;
+	g94_digest_val dv;
+
+	init_gost_hash_ctx(&ctx, &GostR3411_94_TestParamSet);
+	for(t = 0; t < sizeof(tcs)/sizeof(tcs[0]); t++) {
+	    if(tcs[t].len > maxlen) {
+		continue;
+	    }
+	    start_hash(&ctx);
+	    if(NULL != tcs[t].msg) {
+		hash_block(&ctx, (const byte *)tcs[t].msg, 
+					    strlen(tcs[t].msg));
+	    } else {
+		for(b = tcs[t].len; sizeof(zb) <= b; b -= sizeof(zb)) {
+		    hash_block(&ctx, zb, sizeof(zb));
+		}
+		hash_block(&ctx, zb, b);
+	    }
+	    finish_hash(&ctx, &dv[0]);
+	    if(0 != memcmp(tcs[t].tps_digest, dv, 
+					sizeof(g94_digest_val))) {
+		fflush(NULL);
+		fprintf(stderr, "Internal test t=%d len=%llu "
+				"failed.\n", t, tcs[t].len);
+		if(!ignore) {
+		    return 2;
+		}
+	    } else {
+		printf(",");
+		fflush(NULL);
+	    }
+	}
+	done_gost_hash_ctx(&ctx);
+    }
+    #endif
+
+    /* 
+     * ccgost engine test on GostR3411_94_CryptoProParamSet
+     */
+    #ifndef OPENSSL_NO_DYNAMIC_ENGINE
+	setenv("OPENSSL_ENGINES", CCGOST_DIR, 1);
+    #endif
+    ENGINE_load_builtin_engines();
+
+	/* Test load engine */
+    if(NULL == (impl = ENGINE_by_id(CCGOST_ID))) {
+	fflush(NULL);
+	fprintf(stderr, "Can't load engine id \"" CCGOST_ID "\"\n");
+	if(!ignore) {
+	    return 3;
+	}
+    }
+    if(NULL == (md_gost94 = EVP_get_digestbyname(CCGOST_MD))) {
+	fflush(NULL);
+	fprintf(stderr, "\"" CCGOST_MD "\" - not found\n");
+	if(!ignore) {
+	    return 4;
+	}
+    }
+
+	/* Test cases */
+    for(t = 0; t < sizeof(tcs)/sizeof(tcs[0]); t++) {
+	if(tcs[t].len > maxlen) {
+	    continue;
+	}
+	if(NULL != tcs[t].msg) {
+	    EVP_Digest(tcs[t].msg, strlen(tcs[t].msg), 
+	    			edv, &sdv, 
+				md_gost94, impl);
+	} else {
+	    EVP_MD_CTX_init (&evp);
+	    EVP_DigestInit_ex(&evp, md_gost94, impl);
+	    for(b = tcs[t].len; sizeof(zb) <= b; b -= sizeof(zb)) {
+		EVP_DigestUpdate(&evp, zb, sizeof(zb));
+	    }
+	    EVP_DigestUpdate(&evp, zb, b);
+	    EVP_DigestFinal_ex(&evp, edv, &sdv);
+	    EVP_MD_CTX_cleanup(&evp);
+	}
+	if(sizeof(g94_digest_val) != sdv ||
+	   0 != memcmp(tcs[t].cpps_digest, edv, sizeof(g94_digest_val))) {
+	    fflush(NULL);
+	    fprintf(stderr, "Engine test t=%d len=%llu "
+			    "failed.\n", t, tcs[t].len);
+	    if(!ignore) {
+	    	return 5;
+	    }
+	} else {
+	    printf(".");
+	    fflush(NULL);
+	}
+    }
+
+    printf(" passed\n");
+    fflush(NULL);
+
+    return EXIT_SUCCESS;
+}
+#endif
