]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/30-test_evp_fetch_prov.t
2 # Copyright 2015-2021 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
('.');
22 my $no_fips = disabled
('fips') || ($ENV{NO_FIPS
} // 0);
24 my @types = ( "digest", "cipher" );
27 { config
=> srctop_file
("test", "default.cnf"),
28 providers
=> [ 'default' ],
29 tests
=> [ { providers
=> [] },
31 { args
=> [ '-property', 'provider=default' ],
32 message
=> 'using property "provider=default"' },
33 { args
=> [ '-property', 'provider!=fips' ],
34 message
=> 'using property "provider!=fips"' },
35 { args
=> [ '-property', 'provider!=default', '-fetchfail' ],
37 'using property "provider!=default" is expected to fail' },
38 { args
=> [ '-property', 'provider=fips', '-fetchfail' ],
40 'using property "provider=fips" is expected to fail' } ] }
45 { config
=> srctop_file
("test", "fips.cnf"),
46 providers
=> [ 'fips' ],
48 { args
=> [ '-property', '' ] },
49 { args
=> [ '-property', 'provider=fips' ],
50 message
=> 'using property "provider=fips"' },
51 { args
=> [ '-property', 'provider!=default' ],
52 message
=> 'using property "provider!=default"' },
53 { args
=> [ '-property', 'provider=default', '-fetchfail' ],
55 'using property "provider=default" is expected to fail' },
56 { args
=> [ '-property', 'provider!=fips', '-fetchfail' ],
58 'using property "provider!=fips" is expected to fail' },
59 { args
=> [ '-property', 'fips=yes' ],
60 message
=> 'using property "fips=yes"' },
61 { args
=> [ '-property', 'fips!=no' ],
62 message
=> 'using property "fips!=no"' },
63 { args
=> [ '-property', '-fips' ],
64 message
=> 'using property "-fips"' },
65 { args
=> [ '-property', 'fips=no', '-fetchfail' ],
66 message
=> 'using property "fips=no is expected to fail"' },
67 { args
=> [ '-property', 'fips!=yes', '-fetchfail' ],
68 message
=> 'using property "fips!=yes is expected to fail"' } ] },
69 { config
=> srctop_file
("test", "default-and-fips.cnf"),
70 providers
=> [ 'default', 'fips' ],
72 { args
=> [ '-property', '' ] },
73 { args
=> [ '-property', 'provider!=default' ],
74 message
=> 'using property "provider!=default"' },
75 { args
=> [ '-property', 'provider=default' ],
76 message
=> 'using property "provider=default"' },
77 { args
=> [ '-property', 'provider!=fips' ],
78 message
=> 'using property "provider!=fips"' },
79 { args
=> [ '-property', 'provider=fips' ],
80 message
=> 'using property "provider=fips"' },
81 { args
=> [ '-property', 'fips=yes' ],
82 message
=> 'using property "fips=yes"' },
83 { args
=> [ '-property', 'fips!=no' ],
84 message
=> 'using property "fips!=no"' },
85 { args
=> [ '-property', '-fips' ],
86 message
=> 'using property "-fips"' },
87 { args
=> [ '-property', 'fips=no' ],
88 message
=> 'using property "fips=no"' },
89 { args
=> [ '-property', 'fips!=yes' ],
90 message
=> 'using property "fips!=yes"' } ] },
96 $testcount += scalar @
{$_->{tests
}};
99 plan tests
=> 1 + $testcount * scalar(@types);
101 ok
(run
(test
(["evp_fetch_prov_test", "-defaultctx"])),
102 "running evp_fetch_prov_test using the default libctx");
104 foreach my $alg (@types) {
105 foreach my $testcase (@testdata) {
106 $ENV{OPENSSL_CONF
} = "";
107 foreach my $test (@
{$testcase->{tests
}}) {
109 @
{ $test->{providers
} // $testcase->{providers
} };
110 my $testprovstr = @testproviders
111 ?
' and loaded providers ' . join(' & ',
112 map { "'$_'" } @testproviders)
114 my @testargs = @
{ $test->{args
} // [] };
116 defined $test->{message
} ?
' '.$test->{message
} : '';
119 "running evp_fetch_prov_test with $alg$testprovstr$testmsg";
121 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg",
122 "-config", "$testcase->{config}",
123 @testargs, @testproviders])),