]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/30-test_evp.t
Make -provider_name and -section_name optional
[thirdparty/openssl.git] / test / recipes / 30-test_evp.t
CommitLineData
596d6b7e 1#! /usr/bin/env perl
33388b44 2# Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
596d6b7e 3#
909f1a2e 4# Licensed under the Apache License 2.0 (the "License"). You may not use
596d6b7e
RS
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
4fb35f8f
RL
9
10use strict;
11use warnings;
12
7bb82f92 13use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir srctop_file srctop_dir bldtop_file);
23ccf13d 14use OpenSSL::Test::Utils;
4fb35f8f 15
7bb82f92 16BEGIN {
4fb35f8f 17setup("test_evp");
7bb82f92
SL
18}
19
20use lib srctop_dir('Configurations');
21use lib bldtop_dir('.');
22use platform;
4fb35f8f 23
e0d952fc
RL
24my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
25my $no_legacy = disabled('legacy') || ($ENV{NO_LEGACY} // 0);
26
23ccf13d 27# Default config depends on if the legacy module is built or not
e0d952fc 28my $defaultcnf = $no_legacy ? 'default.cnf' : 'default-and-legacy.cnf';
23ccf13d
RL
29
30my @configs = ( $defaultcnf );
31# Only add the FIPS config if the FIPS module has been built
e0d952fc 32push @configs, 'fips.cnf' unless $no_fips;
23ccf13d 33
c9ed9307 34my @files = qw( evprand.txt evpciph.txt evpdigest.txt evppkey.txt
7cc355c2
SL
35 evppkey_ecc.txt evpciph_aes_cts.txt);
36
f305ecda 37my @defltfiles = qw( evpencod.txt evpkdf.txt evppkey_kdf.txt evpmac.txt
1c725f46 38 evppbe.txt evpcase.txt evpccmcavs.txt );
f22431f2
SL
39my @ideafiles = qw( evpciph_idea.txt );
40push @defltfiles, @ideafiles unless disabled("idea");
6b7b3433 41
eb173822
SL
42my @sivfiles = qw( evpaessiv.txt );
43push @defltfiles, @sivfiles unless disabled("siv");
44
18b00427
SL
45my @castfiles = qw( evpciph_cast5.txt );
46push @defltfiles, @castfiles unless disabled("cast");
47
70adc646
SL
48my @seedfiles = qw( evpciph_seed.txt );
49push @defltfiles, @seedfiles unless disabled("seed");
50
105dde25
SL
51my @sm4files = qw( evpciph_sm4.txt );
52push @defltfiles, @sm4files unless disabled("sm4");
53
e3f3ee44
SL
54my @desfiles = qw( evpciph_des.txt );
55push @defltfiles, @desfiles unless disabled("des");
56
bafde183
SL
57my @rc4files = qw( evpciph_rc4.txt );
58push @defltfiles, @rc4files unless disabled("rc4");
59
6a41156c
SL
60my @rc5files = qw( evpciph_rc5.txt );
61push @defltfiles, @rc5files unless disabled("rc5");
62
f816aa47
SL
63my @rc2files = qw( evpciph_rc2.txt );
64push @defltfiles, @rc2files unless disabled("rc2");
65
3d5a7578
SL
66my @chachafiles = qw( evpciph_chacha.txt );
67push @defltfiles, @chachafiles unless disabled("chacha");
68
18385800
MC
69my @bffiles = qw( evpciph_bf.txt );
70push @defltfiles, @bffiles unless disabled("bf");
71
4ff5b41a
RL
72my @md2files = qw( evpmd_md2.txt );
73push @defltfiles, @md2files unless disabled("md2");
d3ac2eab 74
4ff5b41a
RL
75my @mdc2files = qw( evpmd_mdc2.txt );
76push @defltfiles, @mdc2files unless disabled("mdc2");
ed5cb177 77
e0d952fc
RL
78plan tests =>
79 ($no_fips ? 0 : 1) # FIPS install test
80 + (scalar(@configs) * scalar(@files))
81 + scalar(@defltfiles);
82
83unless ($no_fips) {
1e78a50f 84 my $infile = bldtop_file('providers', platform->dso('fips'));
e0d952fc 85
1e78a50f 86 ok(run(app(['openssl', 'fipsinstall',
1cd2c1f8 87 '-out', bldtop_file('providers', 'fipsmodule.cnf'),
5744dacb 88 '-module', $infile])),
be3acd79 89 "fipsinstall");
e0d952fc 90}
6b7b3433 91
e2f72313
RL
92foreach (@configs) {
93 $ENV{OPENSSL_CONF} = srctop_file("test", $_);
94
95 foreach my $f ( @files ) {
96 ok(run(test(["evp_test", data_file("$f")])),
97 "running evp_test $f");
98 }
6b7b3433 99}
f305ecda
MC
100
101#TODO(3.0): As more operations are converted to providers we can move more of
102# these tests to the loop above
103
23ccf13d 104$ENV{OPENSSL_CONF} = srctop_file("test", $defaultcnf);
f305ecda
MC
105
106foreach my $f ( @defltfiles ) {
107 ok(run(test(["evp_test", data_file("$f")])),
108 "running evp_test $f");
109}