]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/30-test_evp_fetch_prov.t
2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
12 use OpenSSL
::Test
qw(:DEFAULT bldtop_dir srctop_file srctop_dir bldtop_file);
13 use OpenSSL
::Test
::Utils
;
16 setup
("test_evp_fetch_prov");
19 use lib srctop_dir
('Configurations');
20 use lib bldtop_dir
('.');
23 my $no_fips = disabled
('fips') || ($ENV{NO_FIPS
} // 0);
25 my @types = ( "digest", "cipher" );
27 $ENV{OPENSSL_MODULES
} = bldtop_dir
("providers");
28 $ENV{OPENSSL_CONF_INCLUDE
} = bldtop_dir
("providers");
32 { config
=> srctop_file
("test", "default.cnf"),
33 providers
=> [ 'default' ],
34 tests
=> [ { providers
=> [] },
36 { args
=> [ '-property', 'provider=default' ],
37 message
=> 'using property "provider=default"' },
38 { args
=> [ '-property', 'provider!=fips' ],
39 message
=> 'using property "provider!=fips"' },
40 { args
=> [ '-property', 'provider!=default', '-fetchfail' ],
42 'using property "provider!=default" is expected to fail' },
43 { args
=> [ '-property', 'provider=fips', '-fetchfail' ],
45 'using property "provider=fips" is expected to fail' } ] }
50 cmd
=> perltest
(['fipsinstall.pl', bldtop_dir
()]),
51 message
=> "fipsinstall"
54 { config
=> srctop_file
("test", "fips.cnf"),
55 providers
=> [ 'fips' ],
57 { args
=> [ '-property', '' ] },
58 { args
=> [ '-property', 'provider=fips' ],
59 message
=> 'using property "provider=fips"' },
60 { args
=> [ '-property', 'provider!=default' ],
61 message
=> 'using property "provider!=default"' },
62 { args
=> [ '-property', 'provider=default', '-fetchfail' ],
64 'using property "provider=default" is expected to fail' },
65 { args
=> [ '-property', 'provider!=fips', '-fetchfail' ],
67 'using property "provider!=fips" is expected to fail' },
68 { args
=> [ '-property', 'fips=yes' ],
69 message
=> 'using property "fips=yes"' },
70 { args
=> [ '-property', 'fips!=no' ],
71 message
=> 'using property "fips!=no"' },
72 { args
=> [ '-property', '-fips' ],
73 message
=> 'using property "-fips"' },
74 { args
=> [ '-property', 'fips=no', '-fetchfail' ],
75 message
=> 'using property "fips=no is expected to fail"' },
76 { args
=> [ '-property', 'fips!=yes', '-fetchfail' ],
77 message
=> 'using property "fips!=yes is expected to fail"' } ] },
78 { config
=> srctop_file
("test", "default-and-fips.cnf"),
79 providers
=> [ 'default', 'fips' ],
81 { args
=> [ '-property', '' ] },
82 { args
=> [ '-property', 'provider!=default' ],
83 message
=> 'using property "provider!=default"' },
84 { args
=> [ '-property', 'provider=default' ],
85 message
=> 'using property "provider=default"' },
86 { args
=> [ '-property', 'provider!=fips' ],
87 message
=> 'using property "provider!=fips"' },
88 { args
=> [ '-property', 'provider=fips' ],
89 message
=> 'using property "provider=fips"' },
90 { args
=> [ '-property', 'fips=yes' ],
91 message
=> 'using property "fips=yes"' },
92 { args
=> [ '-property', 'fips!=no' ],
93 message
=> 'using property "fips!=no"' },
94 { args
=> [ '-property', '-fips' ],
95 message
=> 'using property "-fips"' },
96 { args
=> [ '-property', 'fips=no' ],
97 message
=> 'using property "fips=no"' },
98 { args
=> [ '-property', 'fips!=yes' ],
99 message
=> 'using property "fips!=yes"' } ] },
104 foreach (@testdata) {
105 $testcount += scalar @
{$_->{tests
}};
108 plan tests
=> 1 + scalar @setups + $testcount * scalar(@types);
110 ok
(run
(test
(["evp_fetch_prov_test", "-defaultctx"])),
111 "running evp_fetch_prov_test using the default libctx");
113 foreach my $setup (@setups) {
114 ok
(run
($setup->{cmd
}), $setup->{message
});
117 foreach my $alg (@types) {
118 foreach my $testcase (@testdata) {
119 $ENV{OPENSSL_CONF
} = "";
120 foreach my $test (@
{$testcase->{tests
}}) {
122 @
{ $test->{providers
} // $testcase->{providers
} };
123 my $testprovstr = @testproviders
124 ?
' and loaded providers ' . join(' & ',
125 map { "'$_'" } @testproviders)
127 my @testargs = @
{ $test->{args
} // [] };
129 defined $test->{message
} ?
' '.$test->{message
} : '';
132 "running evp_fetch_prov_test with $alg$testprovstr$testmsg";
134 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg",
135 "-config", "$testcase->{config}",
136 @testargs, @testproviders])),