1234353Sdim#! /usr/bin/env perl
2218885Sdim# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
3218885Sdim#
4218885Sdim# Licensed under the Apache License 2.0 (the "License").  You may not use
5218885Sdim# this file except in compliance with the License.  You can obtain a copy
6218885Sdim# in the file LICENSE in the source distribution or at
7218885Sdim# https://www.openssl.org/source/license.html
8218885Sdim
9218885Sdim# This is a sanity checker to see that the fipsmodule.cnf that's been
10218885Sdim# generated for testing is valid.
11218885Sdim
12218885Sdimuse strict;
13218885Sdimuse warnings;
14218885Sdim
15221345Sdimuse OpenSSL::Test qw/:DEFAULT srctop_dir bldtop_dir bldtop_file srctop_file data_file/;
16221345Sdimuse OpenSSL::Test::Utils;
17221345Sdim
18218885SdimBEGIN {
19221345Sdim    setup("test_fipsmodule");
20221345Sdim}
21221345Sdim
22221345Sdimuse lib srctop_dir('Configurations');
23221345Sdimuse lib bldtop_dir('.');
24221345Sdimuse platform;
25221345Sdim
26218885Sdimmy $no_check = disabled("fips");
27218885Sdimplan skip_all => "Test only supported in a fips build"
28221345Sdim    if $no_check;
29221345Sdimplan tests => 1;
30221345Sdim
31221345Sdimmy $fipsmodule = bldtop_file('providers', platform->dso('fips'));
32218885Sdimmy $fipsmoduleconf = bldtop_file('test', 'fipsmodule.cnf');
33218885Sdim
34218885Sdim# verify the $fipsconf file
35218885Sdimok(run(app(['openssl', 'fipsinstall',
36221345Sdim            '-in',  $fipsmoduleconf, '-module', $fipsmodule, '-verify'])),
37221345Sdim   "fipsinstall verify");
38221345Sdim