Update copyright year
[openssl.git] / test / recipes / 90-test_sslprovider.t
1 #! /usr/bin/env perl
2 # Copyright 2016-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
10 use OpenSSL::Test::Utils;
11 use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_file bldtop_dir/;
12
13 BEGIN {
14 setup("test_sslprovider");
15 }
16
17 use lib srctop_dir('Configurations');
18 use lib bldtop_dir('.');
19 use platform;
20
21 plan skip_all => "No TLS/SSL protocols are supported by this OpenSSL build"
22     if alldisabled(grep { $_ ne "ssl3" } available_protocols("tls"));
23
24 plan tests => 3;
25
26 $ENV{OPENSSL_MODULES} = bldtop_dir("providers");
27 $ENV{OPENSSL_CONF_INCLUDE} = bldtop_dir("providers");
28
29 SKIP: {
30     skip "Skipping FIPS installation", 1
31         if disabled("fips");
32
33     ok(run(app(['openssl', 'fipsinstall',
34                 '-out', bldtop_file('providers', 'fipsinstall.cnf'),
35                 '-module', bldtop_file('providers', platform->dso('fips')),
36                 '-provider_name', 'fips', '-mac_name', 'HMAC',
37                 '-macopt', 'digest:SHA256', '-macopt', 'hexkey:00',
38                 '-section_name', 'fips_sect'])),
39        "fipsinstall");
40 }
41
42 ok(run(test(["sslprovidertest", srctop_dir("test", "certs"), "default",
43              srctop_file("test", "default.cnf")])),
44              "running sslprovidertest");
45
46 SKIP: {
47     skip "Skipping FIPS provider test", 1
48         if disabled("fips");
49
50     ok(run(test(["sslprovidertest", srctop_dir("test", "certs"), "fips",
51                  srctop_file("test", "fips.cnf")])),
52                  "running sslprovidertest");
53 }