Home | History | Annotate | Line # | Download | only in recipes
      1 #! /usr/bin/env perl
      2 # Copyright 2016-2022 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_dir bldtop_file/;
     12 use File::Temp qw(tempfile);
     13 
     14 BEGIN {
     15 setup("test_sslapi");
     16 }
     17 
     18 use lib srctop_dir('Configurations');
     19 use lib bldtop_dir('.');
     20 
     21 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
     22 
     23 plan skip_all => "No TLS/SSL protocols are supported by this OpenSSL build"
     24     if alldisabled(grep { $_ ne "ssl3" } available_protocols("tls"));
     25 
     26 plan tests =>
     27     ($no_fips ? 0 : 1)          # sslapitest with fips
     28     + 1;                        # sslapitest with default provider
     29 
     30 (undef, my $tmpfilename) = tempfile();
     31 
     32 ok(run(test(["sslapitest", srctop_dir("test", "certs"),
     33              srctop_file("test", "recipes", "90-test_sslapi_data",
     34                          "passwd.txt"), $tmpfilename, "default",
     35              srctop_file("test", "default.cnf"),
     36              srctop_file("test",
     37                          "recipes",
     38                          "90-test_sslapi_data",
     39                          "dhparams.pem")])),
     40              "running sslapitest");
     41 
     42 unless ($no_fips) {
     43     ok(run(test(["sslapitest", srctop_dir("test", "certs"),
     44                  srctop_file("test", "recipes", "90-test_sslapi_data",
     45                              "passwd.txt"), $tmpfilename, "fips",
     46                  srctop_file("test", "fips-and-base.cnf"),
     47                  srctop_file("test",
     48                              "recipes",
     49                              "90-test_sslapi_data",
     50                              "dhparams.pem")])),
     51                  "running sslapitest");
     52 }
     53 
     54 unlink $tmpfilename;
     55