xref: /netbsd-src/crypto/external/bsd/openssl/dist/test/recipes/00-prep_fipsmodule_cnf.t (revision b0d1725196a7921d003d2c66a14f186abda4176b)
1*b0d17251Schristos#! /usr/bin/env perl
2*b0d17251Schristos# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
3*b0d17251Schristos#
4*b0d17251Schristos# Licensed under the Apache License 2.0 (the "License").  You may not use
5*b0d17251Schristos# this file except in compliance with the License.  You can obtain a copy
6*b0d17251Schristos# in the file LICENSE in the source distribution or at
7*b0d17251Schristos# https://www.openssl.org/source/license.html
8*b0d17251Schristos
9*b0d17251Schristosuse strict;
10*b0d17251Schristosuse warnings;
11*b0d17251Schristos
12*b0d17251Schristosuse OpenSSL::Test qw/:DEFAULT srctop_dir bldtop_dir bldtop_file srctop_file data_file/;
13*b0d17251Schristosuse OpenSSL::Test::Utils;
14*b0d17251Schristos
15*b0d17251SchristosBEGIN {
16*b0d17251Schristos    setup("prep_fipsmodule");
17*b0d17251Schristos}
18*b0d17251Schristos
19*b0d17251Schristosuse lib srctop_dir('Configurations');
20*b0d17251Schristosuse lib bldtop_dir('.');
21*b0d17251Schristosuse platform;
22*b0d17251Schristos
23*b0d17251Schristosmy $no_check = disabled("fips");
24*b0d17251Schristosplan skip_all => "FIPS module config file only supported in a fips build"
25*b0d17251Schristos    if $no_check;
26*b0d17251Schristos
27*b0d17251Schristosmy $fipsmodule = bldtop_file('providers', platform->dso('fips'));
28*b0d17251Schristosmy $fipsmoduleconf = bldtop_file('test', 'fipsmodule.cnf');
29*b0d17251Schristos
30*b0d17251Schristosplan tests => 1;
31*b0d17251Schristos
32*b0d17251Schristos# Create the $fipsmoduleconf file
33*b0d17251Schristosok(run(app(['openssl', 'fipsinstall',
34*b0d17251Schristos            '-module', $fipsmodule, '-provider_name', 'fips',
35*b0d17251Schristos            '-section_name', 'fips_sect', '-out', $fipsmoduleconf])),
36*b0d17251Schristos   "fips install");
37