]>
Commit | Line | Data |
---|---|---|
bfa6aaab | 1 | #! /usr/bin/env perl |
8020d79b | 2 | # Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. |
bfa6aaab MC |
3 | # |
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 | |
8 | ||
9 | ||
10 | use strict; | |
11 | use warnings; | |
12 | ||
ca7cac88 | 13 | use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_file bldtop_dir data_dir/; |
bfa6aaab MC |
14 | use OpenSSL::Test::Utils; |
15 | use Cwd qw(abs_path); | |
16 | ||
17 | BEGIN { | |
ca7cac88 | 18 | setup("test_defltfips"); |
bfa6aaab MC |
19 | } |
20 | ||
21 | use lib srctop_dir('Configurations'); | |
22 | use lib bldtop_dir('.'); | |
bfa6aaab MC |
23 | |
24 | my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0); | |
25 | ||
26 | plan tests => | |
ca7cac88 | 27 | ($no_fips ? 1 : 5); |
bfa6aaab MC |
28 | |
29 | unless ($no_fips) { | |
bfa6aaab MC |
30 | $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips.cnf")); |
31 | ok(run(test(["defltfips_test", "fips"])), "running defltfips_test fips"); | |
ca7cac88 MC |
32 | |
33 | #Test an alternative way of configuring fips | |
34 | $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips-alt.cnf")); | |
35 | ok(run(test(["defltfips_test", "fips"])), "running defltfips_test fips"); | |
36 | ||
37 | #Configured to run FIPS but the module-mac is bad | |
38 | $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips.cnf")); | |
3dd74e21 | 39 | $ENV{OPENSSL_CONF_INCLUDE} = srctop_dir("test", "recipes", "30-test_defltfips"); |
ca7cac88 MC |
40 | ok(run(test(["defltfips_test", "badfips"])), "running defltfips_test badfips"); |
41 | ||
42 | #Test an alternative way of configuring fips (but still with bad module-mac) | |
43 | $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips-alt.cnf")); | |
44 | ok(run(test(["defltfips_test", "badfips"])), "running defltfips_test badfips"); | |
bfa6aaab MC |
45 | } |
46 | ||
47 | $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default.cnf")); | |
48 | ok(run(test(["defltfips_test"])), "running defltfips_test"); |