2 # Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
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
13 use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir srctop_file srctop_dir bldtop_file);
14 use OpenSSL::Test::Utils;
20 use lib srctop_dir('Configurations');
21 use lib bldtop_dir('.');
24 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
25 my $no_legacy = disabled('legacy') || ($ENV{NO_LEGACY} // 0);
27 # Default config depends on if the legacy module is built or not
28 my $defaultcnf = $no_legacy ? 'default.cnf' : 'default-and-legacy.cnf';
30 my @configs = ( $defaultcnf );
31 # Only add the FIPS config if the FIPS module has been built
32 push @configs, 'fips.cnf' unless $no_fips;
34 my @files = qw( evpciph.txt evpdigest.txt );
35 my @defltfiles = qw( evpencod.txt evpkdf.txt evppkey_kdf.txt evpmac.txt
36 evppbe.txt evppkey.txt evppkey_ecc.txt evpcase.txt evpaessiv.txt
38 my @ideafiles = qw( evpciph_idea.txt );
39 push @defltfiles, @ideafiles unless disabled("idea");
41 my @castfiles = qw( evpciph_cast5.txt );
42 push @defltfiles, @castfiles unless disabled("cast");
44 my @seedfiles = qw( evpciph_seed.txt );
45 push @defltfiles, @seedfiles unless disabled("seed");
47 my @sm4files = qw( evpciph_sm4.txt );
48 push @defltfiles, @sm4files unless disabled("sm4");
50 my @desfiles = qw( evpciph_des.txt );
51 push @defltfiles, @desfiles unless disabled("des");
53 my @rc4files = qw( evpciph_rc4.txt );
54 push @defltfiles, @rc4files unless disabled("rc4");
56 my @rc5files = qw( evpciph_rc5.txt );
57 push @defltfiles, @rc5files unless disabled("rc5");
60 ($no_fips ? 0 : 1) # FIPS install test
61 + (scalar(@configs) * scalar(@files))
62 + scalar(@defltfiles);
65 my $infile = bldtop_file('providers', platform->dso('fips'));
66 $ENV{OPENSSL_MODULES} = bldtop_dir("providers");
67 $ENV{OPENSSL_CONF_INCLUDE} = bldtop_dir("providers");
69 ok(run(app(['openssl', 'fipsinstall',
70 '-out', bldtop_file('providers', 'fipsinstall.conf'),
72 '-provider_name', 'fips', '-mac_name', 'HMAC',
73 '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
74 '-section_name', 'fips_sect'])),
79 $ENV{OPENSSL_CONF} = srctop_file("test", $_);
81 foreach my $f ( @files ) {
82 ok(run(test(["evp_test", data_file("$f")])),
83 "running evp_test $f");
87 #TODO(3.0): As more operations are converted to providers we can move more of
88 # these tests to the loop above
90 $ENV{OPENSSL_CONF} = srctop_file("test", $defaultcnf);
92 foreach my $f ( @defltfiles ) {
93 ok(run(test(["evp_test", data_file("$f")])),
94 "running evp_test $f");