]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/30-test_defltfips.t
Copyright year updates
[thirdparty/openssl.git] / test / recipes / 30-test_defltfips.t
CommitLineData
bfa6aaab 1#! /usr/bin/env perl
da1c088f 2# Copyright 2015-2023 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
10use strict;
11use warnings;
12
ca7cac88 13use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_file bldtop_dir data_dir/;
bfa6aaab
MC
14use OpenSSL::Test::Utils;
15use Cwd qw(abs_path);
16
17BEGIN {
ca7cac88 18 setup("test_defltfips");
bfa6aaab
MC
19}
20
21use lib srctop_dir('Configurations');
22use lib bldtop_dir('.');
bfa6aaab 23
9a255aa2
P
24plan skip_all => "Configuration loading is turned off"
25 if disabled("autoload-config");
26
bfa6aaab
MC
27my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
28
29plan tests =>
ca7cac88 30 ($no_fips ? 1 : 5);
bfa6aaab
MC
31
32unless ($no_fips) {
bfa6aaab
MC
33 $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips.cnf"));
34 ok(run(test(["defltfips_test", "fips"])), "running defltfips_test fips");
ca7cac88
MC
35
36 #Test an alternative way of configuring fips
37 $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips-alt.cnf"));
38 ok(run(test(["defltfips_test", "fips"])), "running defltfips_test fips");
39
40 #Configured to run FIPS but the module-mac is bad
41 $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips.cnf"));
3dd74e21 42 $ENV{OPENSSL_CONF_INCLUDE} = srctop_dir("test", "recipes", "30-test_defltfips");
ca7cac88
MC
43 ok(run(test(["defltfips_test", "badfips"])), "running defltfips_test badfips");
44
45 #Test an alternative way of configuring fips (but still with bad module-mac)
46 $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "fips-alt.cnf"));
47 ok(run(test(["defltfips_test", "badfips"])), "running defltfips_test badfips");
bfa6aaab
MC
48}
49
50$ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default.cnf"));
51ok(run(test(["defltfips_test"])), "running defltfips_test");