]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
TEST: Make our test data binary
authorRichard Levitte <levitte@openssl.org>
Mon, 23 Nov 2020 01:26:34 +0000 (02:26 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 24 Nov 2020 10:01:58 +0000 (11:01 +0100)
Our test data (test/data.txt and test/data2.txt) are text files, but
declaring them binary means that there will be no line ending
transformation done on them.  This is necessary for testing on
non-Unix platforms, where certain tests could otherwise give results
that don't match expected results.

Fixes #13474

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13477)

.gitattributes
test/data.bin [moved from test/data.txt with 100% similarity]
test/data2.bin [moved from test/data2.txt with 100% similarity]
test/recipes/20-test_dgst.t
test/recipes/20-test_pkeyutl.t

index 3fbaf1160faba6257b0fa2367efa8866d08c12e6..6771355ff7b35c7ce004e939309516c8c77e8570 100644 (file)
@@ -1,3 +1,4 @@
+*.bin binary
 *.der binary
 /fuzz/corpora/** binary
 *.pfx binary
similarity index 100%
rename from test/data.txt
rename to test/data.bin
similarity index 100%
rename from test/data2.txt
rename to test/data2.bin
index 9dcf6d31a21096a14e84998c1575b2f4fa752ae5..4c29877e62c1117b687fe62cea5ebd2fe2336c89 100644 (file)
@@ -24,8 +24,8 @@ sub tsignverify {
     my $privkey = shift;
     my $pubkey = shift;
 
-    my $data_to_sign = srctop_file('test', 'data.txt');
-    my $other_data = srctop_file('test', 'data2.txt');
+    my $data_to_sign = srctop_file('test', 'data.bin');
+    my $other_data = srctop_file('test', 'data2.bin');
 
     my $sigfile = basename($privkey, '.pem') . '.sig';
     plan tests => 4;
@@ -106,12 +106,12 @@ SKIP: {
 subtest "HMAC generation with `dgst` CLI" => sub {
     plan tests => 2;
 
-    my $testdata = srctop_file('test', 'data.txt');
+    my $testdata = srctop_file('test', 'data.bin');
     #HMAC the data twice to check consistency
     my @hmacdata = run(app(['openssl', 'dgst', '-sha256', '-hmac', '123456',
                             $testdata, $testdata]), capture => 1);
     chomp(@hmacdata);
-    my $expected = qr/HMAC-SHA256\([^\)]*data.txt\)= 6f12484129c4a761747f13d8234a1ff0e074adb34e9e9bf3a155c391b97b9a7c/;
+    my $expected = qr/HMAC-SHA256\([^\)]*data.bin\)= 6f12484129c4a761747f13d8234a1ff0e074adb34e9e9bf3a155c391b97b9a7c/;
     ok($hmacdata[0] =~ $expected, "HMAC: Check HMAC value is as expected ($hmacdata[0]) vs ($expected)");
     ok($hmacdata[1] =~ $expected,
        "HMAC: Check second HMAC value is consistent with the first ($hmacdata[1]) vs ($expected)");
index 19bc3277583f9133ad842853e337da60fb967b9f..8c0614bc42407f783cab9bf416e0484c12823466 100644 (file)
@@ -75,8 +75,8 @@ sub tsignverify {
     my $pubkey = shift;
     my @extraopts = @_;
 
-    my $data_to_sign = srctop_file('test', 'data.txt');
-    my $other_data = srctop_file('test', 'data2.txt');
+    my $data_to_sign = srctop_file('test', 'data.bin');
+    my $other_data = srctop_file('test', 'data2.bin');
     my $sigfile = basename($privkey, '.pem') . '.sig';
 
     my @args = ();