e2e40aaa76e5bb1bed9b5e4cad4128ddfed077fd
[openssl.git] / test / recipes / 30-test_acvp.t
1 #! /usr/bin/env perl
2 # Copyright 2020 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 use strict;
10 use warnings;
11
12 use OpenSSL::Test qw(:DEFAULT bldtop_dir srctop_dir srctop_file bldtop_file);
13 use OpenSSL::Test::Utils;
14
15 BEGIN {
16 setup("test_acvp");
17 }
18
19 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
20
21 plan skip_all => "ACVP is not supported by this test"
22     if $no_fips || disabled("acvp_tests");
23
24 use lib srctop_dir('Configurations');
25 use lib bldtop_dir('.');
26 use platform;
27
28 my $infile = bldtop_file('providers', platform->dso('fips'));
29
30 plan tests => 2;
31
32 ok(run(app(['openssl', 'fipsinstall',
33            '-out', bldtop_file('providers', 'fipsmodule.cnf'),
34            '-module', $infile,
35            '-provider_name', 'fips', '-mac_name', 'HMAC',
36            '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
37            '-section_name', 'fips_sect'])),
38    "fipsinstall");
39
40 ok(run(test(["acvp_test", "-config", srctop_file("test","fips.cnf")])),
41    "running acvp_test");