+ $cmd = "openssl dgst${module_args} -md_gost12_512 testdata2.dat";
+ $name_re = qr/id-tc26-gost3411-12-512|md_gost12_512/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(testdata2.dat)= 55656e5bcf795b499031a7833cd7dc18fe10d4a47e15be545c6ab3f304a4fe411c4c39de5b1fc6844880111441e0b92bf1ec2fb7840453fe39a2b70ced461968\E\n$/ms,
+ "GOST R 34.11-2012 512bit 1K binary")) {
+ diag("Command was: $cmd");
+ }
+
+ unlink("testdata2.dat");
+
+ open $F, ">","testdata3.dat";
+ binmode $F;
+ print $F substr("12345670" x 128,0,539);
+ close $F;
+
+ $cmd = "openssl dgst${module_args} -md_gost94 testdata3.dat";
+ $name_re = qr/id-GostR3411-94|md_gost94/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(testdata3.dat)= bd5f1e4b539c7b00f0866afdbc8ed452503a18436061747a343f43efe888aac9\E\n$/ms,
+ "GOST R 34.11-94 539 bytes")) {
+ diag("Command was: $cmd");
+ }
+
+ $cmd = "openssl dgst${module_args} -md_gost12_256 testdata3.dat";
+ $name_re = qr/id-tc26-gost3411-12-256|md_gost12_256/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(testdata3.dat)= c98a17f9fadff78d08521e4179a7b2e6275f3b1da88339a3cb961a3514e5332e\E\n$/ms,
+ "GOST R 34.11-2012 256bit 539 bytes")) {
+ diag("Command was: $cmd");
+ }
+
+ $cmd = "openssl dgst${module_args} -md_gost12_512 testdata3.dat";
+ $name_re = qr/id-tc26-gost3411-12-512|md_gost12_512/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(testdata3.dat)= d5ad93fbc9ed7abc1cf28d00827a052b40bea74b04c4fd753102c1bcf9f9dad5142887f8a4cceaa0d64a0a8291592413d6adb956b99138a0023e127ff37bdf08\E\n$/ms,
+ "GOST R 34.11-2012 512bit 539 bytes")) {
+ diag("Command was: $cmd");
+ }
+
+ unlink "testdata3.dat";
+ open $F , ">","bigdata.dat";
+ binmode $F;
+ print $F ("121345678" x 7 . "1234567\n") x 4096,"12345\n";
+ close $F;
+
+ $cmd = "openssl dgst${module_args} -md_gost94 bigdata.dat";
+ $name_re = qr/id-GostR3411-94|md_gost94/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(bigdata.dat)= e5d3ac4ea3f67896c51ff919cedb9405ad771e39f0f2eab103624f9a758e506f\E\n$/ms,
+ "GOST R 34.11-94 128K")) {
+ diag("Command was: $cmd");
+ }
+
+ $cmd = "openssl dgst${module_args} -md_gost12_256 bigdata.dat";
+ $name_re = qr/id-tc26-gost3411-12-256|md_gost12_256/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(bigdata.dat)= 50e935d725d9359e5991b6b7eba8b3539fca03584d26adf4c827c982ffd49367\E\n$/ms,
+ "GOST R 34.11-2012 256bit 128K")) {
+ diag("Command was: $cmd");
+ }
+
+ $cmd = "openssl dgst${module_args} -md_gost12_512 bigdata.dat";
+ $name_re = qr/id-tc26-gost3411-12-512|md_gost12_512/;
+ unless (like(`$cmd`,
+ qr/^${name_re}\Q(bigdata.dat)= 1d93645ebfbb477660f98b7d1598e37fbf3bfc8234ead26e2246e1b979e590ac46138158a692f9a0c9ac2550758b4d0d4c9fb8af5e595a16d3760c6516443f82\E\n$/ms,
+ "GOST R 34.11-2012 512bit 128K")) {
+ diag("Command was: $cmd");
+ }
+
+ unlink "bigdata.dat";
+}