]>
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 @types = ( "digest", "cipher" );
25 plan tests
=> 2 + 16 * scalar(@types);
27 $ENV{OPENSSL_MODULES
} = bldtop_dir
("providers");
28 $ENV{OPENSSL_CONF_INCLUDE
} = bldtop_dir
("providers");
30 my $infile = bldtop_file
('providers', platform
->dso('fips'));
31 ok
(run
(app
(['openssl', 'fipsinstall', '-out', bldtop_file
('providers', 'fipsinstall.conf'),
33 '-provider_name', 'fips', '-mac_name', 'HMAC',
34 '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
35 '-section_name', 'fips_sect'])), "fipinstall");
37 # Do implicit fetch using the default context
38 ok
(run
(test
(["evp_fetch_prov_test", "-defaultctx"])),
39 "running evp_fetch_prov_test using implicit fetch using the default libctx");
41 foreach my $alg(@types) {
42 $ENV{OPENSSL_CONF
} = srctop_file
("test", "default.cnf");
43 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg"])),
44 "running evp_fetch_prov_test using implicit fetch using a created libctx");
45 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "default"])),
46 "running evp_fetch_prov_test with implicit fetch using default provider loaded");
47 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "default=yes", "default"])),
48 "running evp_fetch_prov_test with $alg fetch 'default=yes' using default provider loaded");
49 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "fips=no", "default"])),
50 "running evp_fetch_prov_test with $alg fetch 'fips=no' using default provider loaded");
51 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "default=no", "-fetchfail", "default"])),
52 "running evp_fetch_prov_test with $alg fetch 'default=no' using default provider loaded should fail");
53 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "fips=yes", "-fetchfail", "default"])),
54 "running evp_fetch_prov_test with $alg fetch 'fips=yes' using default provider loaded should fail");
56 $ENV{OPENSSL_CONF
} = srctop_file
("test", "fips.cnf");
57 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "", "fips"])),
58 "running evp_fetch_prov_test with $alg fetch '' using loaded fips provider");
59 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "fips=yes", "fips"])),
60 "running evp_fetch_prov_test with $alg fetch 'fips=yes' using loaded fips provider");
61 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "default=no", "fips"])),
62 "running evp_fetch_prov_test with $alg fetch 'default=no' using loaded fips provider");
63 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "default=yes", "-fetchfail", "fips"])),
64 "running evp_fetch_prov_test with $alg fetch 'default=yes' using loaded fips provider should fail");
65 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "fips=no", "-fetchfail", "fips"])),
66 "running evp_fetch_prov_test with $alg fetch 'fips=no' using loaded fips provider should fail");
68 $ENV{OPENSSL_CONF
} = srctop_file
("test", "default-and-fips.cnf");
69 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "", "default", "fips"])),
70 "running evp_fetch_prov_test with $alg fetch '' using loaded default & fips provider");
71 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "default=no", "default", "fips"])),
72 "running evp_fetch_prov_test with $alg fetch 'default=no' using loaded default & fips provider");
73 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "default=yes", "default", "fips"])),
74 "running evp_fetch_prov_test with $alg fetch 'default=yes' using loaded default & fips provider");
75 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "fips=no", "default", "fips"])),
76 "running evp_fetch_prov_test with $alg fetch 'fips=no' using loaded default & fips provider");
77 ok
(run
(test
(["evp_fetch_prov_test", "-type", "$alg", "-property", "fips=yes", "default", "fips"])),
78 "running evp_fetch_prov_test with $alg fetch 'fips=yes' using loaded default & fips provider");