2016-04-22 19:21:51 +08:00
|
|
|
#! /usr/bin/env perl
|
2020-04-23 20:55:52 +08:00
|
|
|
# Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2016-04-22 19:21:51 +08:00
|
|
|
#
|
2018-12-06 20:05:25 +08:00
|
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-04-22 19:21:51 +08:00
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
|
2015-04-18 02:16:13 +08:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2019-09-15 17:55:10 +08:00
|
|
|
use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir srctop_file srctop_dir bldtop_file);
|
2019-08-12 13:04:13 +08:00
|
|
|
use OpenSSL::Test::Utils;
|
2015-04-18 02:16:13 +08:00
|
|
|
|
2019-09-15 17:55:10 +08:00
|
|
|
BEGIN {
|
2015-04-18 02:16:13 +08:00
|
|
|
setup("test_evp");
|
2019-09-15 17:55:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
use lib srctop_dir('Configurations');
|
|
|
|
use lib bldtop_dir('.');
|
|
|
|
use platform;
|
2015-04-18 02:16:13 +08:00
|
|
|
|
2019-09-29 16:32:04 +08:00
|
|
|
my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
|
|
|
|
my $no_legacy = disabled('legacy') || ($ENV{NO_LEGACY} // 0);
|
|
|
|
|
2019-08-12 13:04:13 +08:00
|
|
|
# Default config depends on if the legacy module is built or not
|
2019-09-29 16:32:04 +08:00
|
|
|
my $defaultcnf = $no_legacy ? 'default.cnf' : 'default-and-legacy.cnf';
|
2019-08-12 13:04:13 +08:00
|
|
|
|
|
|
|
my @configs = ( $defaultcnf );
|
|
|
|
# Only add the FIPS config if the FIPS module has been built
|
2019-09-29 16:32:04 +08:00
|
|
|
push @configs, 'fips.cnf' unless $no_fips;
|
2019-08-12 13:04:13 +08:00
|
|
|
|
2020-06-05 11:47:55 +08:00
|
|
|
my @files = qw( evprand.txt evpciph.txt evpdigest.txt evppkey.txt
|
2020-06-08 12:33:27 +08:00
|
|
|
evppkey_ecc.txt evpciph_aes_cts.txt);
|
|
|
|
|
2019-08-05 20:38:25 +08:00
|
|
|
my @defltfiles = qw( evpencod.txt evpkdf.txt evppkey_kdf.txt evpmac.txt
|
2020-02-20 14:16:21 +08:00
|
|
|
evppbe.txt evpcase.txt evpccmcavs.txt );
|
2019-09-18 13:57:08 +08:00
|
|
|
my @ideafiles = qw( evpciph_idea.txt );
|
|
|
|
push @defltfiles, @ideafiles unless disabled("idea");
|
2017-05-12 00:17:38 +08:00
|
|
|
|
2019-11-08 10:14:44 +08:00
|
|
|
my @sivfiles = qw( evpaessiv.txt );
|
|
|
|
push @defltfiles, @sivfiles unless disabled("siv");
|
|
|
|
|
2019-09-18 16:55:11 +08:00
|
|
|
my @castfiles = qw( evpciph_cast5.txt );
|
|
|
|
push @defltfiles, @castfiles unless disabled("cast");
|
|
|
|
|
2019-09-18 20:13:59 +08:00
|
|
|
my @seedfiles = qw( evpciph_seed.txt );
|
|
|
|
push @defltfiles, @seedfiles unless disabled("seed");
|
|
|
|
|
2019-09-19 13:38:51 +08:00
|
|
|
my @sm4files = qw( evpciph_sm4.txt );
|
|
|
|
push @defltfiles, @sm4files unless disabled("sm4");
|
|
|
|
|
2019-09-23 12:35:16 +08:00
|
|
|
my @desfiles = qw( evpciph_des.txt );
|
|
|
|
push @defltfiles, @desfiles unless disabled("des");
|
|
|
|
|
2019-09-25 08:46:39 +08:00
|
|
|
my @rc4files = qw( evpciph_rc4.txt );
|
|
|
|
push @defltfiles, @rc4files unless disabled("rc4");
|
|
|
|
|
2019-10-03 14:05:49 +08:00
|
|
|
my @rc5files = qw( evpciph_rc5.txt );
|
|
|
|
push @defltfiles, @rc5files unless disabled("rc5");
|
|
|
|
|
2019-10-08 14:42:28 +08:00
|
|
|
my @rc2files = qw( evpciph_rc2.txt );
|
|
|
|
push @defltfiles, @rc2files unless disabled("rc2");
|
|
|
|
|
2019-10-16 14:18:42 +08:00
|
|
|
my @chachafiles = qw( evpciph_chacha.txt );
|
|
|
|
push @defltfiles, @chachafiles unless disabled("chacha");
|
|
|
|
|
2019-11-15 22:15:09 +08:00
|
|
|
my @bffiles = qw( evpciph_bf.txt );
|
|
|
|
push @defltfiles, @bffiles unless disabled("bf");
|
|
|
|
|
2020-01-25 14:55:36 +08:00
|
|
|
my @md2files = qw( evpmd_md2.txt );
|
|
|
|
push @defltfiles, @md2files unless disabled("md2");
|
2020-01-13 13:42:46 +08:00
|
|
|
|
2020-01-25 14:55:36 +08:00
|
|
|
my @mdc2files = qw( evpmd_mdc2.txt );
|
|
|
|
push @defltfiles, @mdc2files unless disabled("mdc2");
|
2020-01-14 06:01:34 +08:00
|
|
|
|
2019-09-29 16:32:04 +08:00
|
|
|
plan tests =>
|
|
|
|
($no_fips ? 0 : 1) # FIPS install test
|
|
|
|
+ (scalar(@configs) * scalar(@files))
|
|
|
|
+ scalar(@defltfiles);
|
|
|
|
|
|
|
|
unless ($no_fips) {
|
2020-04-21 18:24:44 +08:00
|
|
|
my $infile = bldtop_file('providers', platform->dso('fips'));
|
2019-09-29 16:32:04 +08:00
|
|
|
|
2020-04-21 18:24:44 +08:00
|
|
|
ok(run(app(['openssl', 'fipsinstall',
|
2020-02-26 05:27:24 +08:00
|
|
|
'-out', bldtop_file('providers', 'fipsmodule.cnf'),
|
2020-04-21 18:24:44 +08:00
|
|
|
'-module', $infile,
|
2020-06-29 10:20:41 +08:00
|
|
|
'-provider_name', 'fips',
|
2020-04-21 18:24:44 +08:00
|
|
|
'-section_name', 'fips_sect'])),
|
2019-11-23 15:54:29 +08:00
|
|
|
"fipsinstall");
|
2019-09-29 16:32:04 +08:00
|
|
|
}
|
2017-05-12 00:17:38 +08:00
|
|
|
|
2019-07-17 20:26:26 +08:00
|
|
|
foreach (@configs) {
|
|
|
|
$ENV{OPENSSL_CONF} = srctop_file("test", $_);
|
|
|
|
|
|
|
|
foreach my $f ( @files ) {
|
|
|
|
ok(run(test(["evp_test", data_file("$f")])),
|
|
|
|
"running evp_test $f");
|
|
|
|
}
|
2017-05-12 00:17:38 +08:00
|
|
|
}
|
2019-08-05 20:38:25 +08:00
|
|
|
|
|
|
|
#TODO(3.0): As more operations are converted to providers we can move more of
|
|
|
|
# these tests to the loop above
|
|
|
|
|
2019-08-12 13:04:13 +08:00
|
|
|
$ENV{OPENSSL_CONF} = srctop_file("test", $defaultcnf);
|
2019-08-05 20:38:25 +08:00
|
|
|
|
|
|
|
foreach my $f ( @defltfiles ) {
|
|
|
|
ok(run(test(["evp_test", data_file("$f")])),
|
|
|
|
"running evp_test $f");
|
|
|
|
}
|