1#! /usr/bin/env perl
2# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
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# This is a sanity checker to see that the fipsmodule.cnf that's been
10# generated for testing is valid.
11
12use strict;
13use warnings;
14
15use OpenSSL::Test qw/:DEFAULT srctop_dir bldtop_dir bldtop_file srctop_file data_file/;
16use OpenSSL::Test::Utils;
17
18BEGIN {
19    setup("test_fipsmodule");
20}
21
22use lib srctop_dir('Configurations');
23use lib bldtop_dir('.');
24use platform;
25
26my $no_check = disabled("fips");
27plan skip_all => "Test only supported in a fips build"
28    if $no_check;
29plan tests => 1;
30
31my $fipsmodule = bldtop_file('providers', platform->dso('fips'));
32my $fipsmoduleconf = bldtop_file('test', 'fipsmodule.cnf');
33
34# verify the $fipsconf file
35ok(run(app(['openssl', 'fipsinstall',
36            '-in',  $fipsmoduleconf, '-module', $fipsmodule, '-verify'])),
37   "fipsinstall verify");
38