]> git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/30-test_evp.t
Add SEED ciphers to default provider
[thirdparty/openssl.git] / test / recipes / 30-test_evp.t
1 #! /usr/bin/env perl
2 # Copyright 2015-2018 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
10 use strict;
11 use warnings;
12
13 use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir srctop_file srctop_dir bldtop_file);
14 use OpenSSL::Test::Utils;
15
16 BEGIN {
17 setup("test_evp");
18 }
19
20 use lib srctop_dir('Configurations');
21 use lib bldtop_dir('.');
22 use platform;
23
24 # Default config depends on if the legacy module is built or not
25 my $defaultcnf = disabled('legacy') ? 'default.cnf' : 'default-and-legacy.cnf';
26
27 my @configs = ( $defaultcnf );
28 # Only add the FIPS config if the FIPS module has been built
29 push @configs, 'fips.cnf' unless disabled('fips');
30
31 my @files = qw( evpciph.txt evpdigest.txt );
32 my @defltfiles = qw( evpencod.txt evpkdf.txt evppkey_kdf.txt evpmac.txt
33 evppbe.txt evppkey.txt evppkey_ecc.txt evpcase.txt evpaessiv.txt
34 evpccmcavs.txt );
35 my @ideafiles = qw( evpciph_idea.txt );
36 push @defltfiles, @ideafiles unless disabled("idea");
37
38 my @castfiles = qw( evpciph_cast5.txt );
39 push @defltfiles, @castfiles unless disabled("cast");
40
41 my @seedfiles = qw( evpciph_seed.txt );
42 push @defltfiles, @seedfiles unless disabled("seed");
43
44 plan tests => (scalar(@configs) * scalar(@files)) + scalar(@defltfiles) + 1;
45
46 my $infile = bldtop_file('providers', platform->dso('fips'));
47 $ENV{OPENSSL_MODULES} = bldtop_dir("providers");
48 $ENV{OPENSSL_CONF_INCLUDE} = bldtop_dir("providers");
49
50 ok(run(app(['openssl', 'fipsinstall', '-out', bldtop_file('providers', 'fipsinstall.conf'),
51 '-module', $infile,
52 '-provider_name', 'fips', '-mac_name', 'HMAC',
53 '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
54 '-section_name', 'fips_sect'])), "fipinstall");
55
56 foreach (@configs) {
57 $ENV{OPENSSL_CONF} = srctop_file("test", $_);
58
59 foreach my $f ( @files ) {
60 ok(run(test(["evp_test", data_file("$f")])),
61 "running evp_test $f");
62 }
63 }
64
65 #TODO(3.0): As more operations are converted to providers we can move more of
66 # these tests to the loop above
67
68 $ENV{OPENSSL_CONF} = srctop_file("test", $defaultcnf);
69
70 foreach my $f ( @defltfiles ) {
71 ok(run(test(["evp_test", data_file("$f")])),
72 "running evp_test $f");
73 }