7 open $F,">","testdata.dat";
8 print $F "12345670" x 128;
11 open $F,">","testbig.dat";
12 print $F ("12345670" x 8 . "\n") x 4096;
15 my $key='0123456789abcdef' x 2;
17 my $engine=$ENV{'ENGINE_NAME'}||"gost";
19 # Reopen STDERR to eliminate extra output
20 open STDERR, ">>","tests.err";
22 is(`openssl dgst -engine ${engine} -mac gost-mac -macopt key:${key} testdata.dat`,
23 "GOST-MAC-gost-mac(testdata.dat)= 2ee8d13d\n",
24 "GOST MAC - default size");
27 for ($i=1;$i<=8; $i++) {
28 is(`openssl dgst -engine ${engine} -mac gost-mac -macopt key:${key} -sigopt size:$i testdata.dat`,
29 "GOST-MAC-gost-mac(testdata.dat)= ".substr("2ee8d13dff7f037d",0,$i*2)."\n",
30 "GOST MAC - size $i bytes");
35 is(`openssl dgst -engine ${engine} -mac gost-mac -macopt key:${key} testbig.dat`,
36 "GOST-MAC-gost-mac(testbig.dat)= 5efab81f\n",
37 "GOST MAC - big data");
39 is(`openssl dgst -engine ${engine} -mac gost-mac-12 -macopt key:${key} testdata.dat`,
40 "GOST-MAC-12-gost-mac-12(testdata.dat)= be4453ec\n",
41 "GOST MAC - parameters 2012");
44 for ($i=1;$i<=8; $i++) {
45 is(`openssl dgst -engine ${engine} -mac gost-mac-12 -macopt key:${key} -sigopt size:$i testdata.dat`,
46 "GOST-MAC-12-gost-mac-12(testdata.dat)= ".substr("be4453ec1ec327be",0,$i*2)."\n",
47 "GOST MAC parameters 2012 - size $i bytes");
49 unlink('testdata.dat');
50 unlink('testbig.dat');