xref: /freebsd/crypto/openssl/test/recipes/90-test_sslapi.t (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1*e0c4386eSCy Schubert#! /usr/bin/env perl
2*e0c4386eSCy Schubert# Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
3*e0c4386eSCy Schubert#
4*e0c4386eSCy Schubert# Licensed under the Apache License 2.0 (the "License").  You may not use
5*e0c4386eSCy Schubert# this file except in compliance with the License.  You can obtain a copy
6*e0c4386eSCy Schubert# in the file LICENSE in the source distribution or at
7*e0c4386eSCy Schubert# https://www.openssl.org/source/license.html
8*e0c4386eSCy Schubert
9*e0c4386eSCy Schubert
10*e0c4386eSCy Schubertuse OpenSSL::Test::Utils;
11*e0c4386eSCy Schubertuse OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir bldtop_file/;
12*e0c4386eSCy Schubertuse File::Temp qw(tempfile);
13*e0c4386eSCy Schubert
14*e0c4386eSCy SchubertBEGIN {
15*e0c4386eSCy Schubertsetup("test_sslapi");
16*e0c4386eSCy Schubert}
17*e0c4386eSCy Schubert
18*e0c4386eSCy Schubertuse lib srctop_dir('Configurations');
19*e0c4386eSCy Schubertuse lib bldtop_dir('.');
20*e0c4386eSCy Schubert
21*e0c4386eSCy Schubertmy $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
22*e0c4386eSCy Schubert
23*e0c4386eSCy Schubertplan skip_all => "No TLS/SSL protocols are supported by this OpenSSL build"
24*e0c4386eSCy Schubert    if alldisabled(grep { $_ ne "ssl3" } available_protocols("tls"));
25*e0c4386eSCy Schubert
26*e0c4386eSCy Schubertplan tests =>
27*e0c4386eSCy Schubert    ($no_fips ? 0 : 1)          # sslapitest with fips
28*e0c4386eSCy Schubert    + 1;                        # sslapitest with default provider
29*e0c4386eSCy Schubert
30*e0c4386eSCy Schubert(undef, my $tmpfilename) = tempfile();
31*e0c4386eSCy Schubert
32*e0c4386eSCy Schubertok(run(test(["sslapitest", srctop_dir("test", "certs"),
33*e0c4386eSCy Schubert             srctop_file("test", "recipes", "90-test_sslapi_data",
34*e0c4386eSCy Schubert                         "passwd.txt"), $tmpfilename, "default",
35*e0c4386eSCy Schubert             srctop_file("test", "default.cnf"),
36*e0c4386eSCy Schubert             srctop_file("test",
37*e0c4386eSCy Schubert                         "recipes",
38*e0c4386eSCy Schubert                         "90-test_sslapi_data",
39*e0c4386eSCy Schubert                         "dhparams.pem")])),
40*e0c4386eSCy Schubert             "running sslapitest");
41*e0c4386eSCy Schubert
42*e0c4386eSCy Schubertunless ($no_fips) {
43*e0c4386eSCy Schubert    ok(run(test(["sslapitest", srctop_dir("test", "certs"),
44*e0c4386eSCy Schubert                 srctop_file("test", "recipes", "90-test_sslapi_data",
45*e0c4386eSCy Schubert                             "passwd.txt"), $tmpfilename, "fips",
46*e0c4386eSCy Schubert                 srctop_file("test", "fips-and-base.cnf"),
47*e0c4386eSCy Schubert                 srctop_file("test",
48*e0c4386eSCy Schubert                             "recipes",
49*e0c4386eSCy Schubert                             "90-test_sslapi_data",
50*e0c4386eSCy Schubert                             "dhparams.pem")])),
51*e0c4386eSCy Schubert                 "running sslapitest");
52*e0c4386eSCy Schubert}
53*e0c4386eSCy Schubert
54*e0c4386eSCy Schubertunlink $tmpfilename;
55