Add and use function test_pem to work out test filenames.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 16 Feb 2017 15:27:49 +0000 (15:27 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 17 Feb 2017 16:33:12 +0000 (16:33 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2667)

test/ssl-tests/04-client_auth.conf.in
test/ssl-tests/17-renegotiate.conf.in
test/ssl-tests/18-dtls-renegotiate.conf.in
test/ssl-tests/20-cert-select.conf.in
test/ssl-tests/ssltests_base.pm

index be601a9..8b92836 100644 (file)
@@ -19,8 +19,6 @@ push @is_disabled, anydisabled("ssl3", "tls1", "tls1_1", "tls1_2");
 
 our @tests = ();
 
 
 our @tests = ();
 
-my $dir_sep = $^O ne "VMS" ? "/" : "";
-
 sub generate_tests() {
 
     foreach (0..$#protocols) {
 sub generate_tests() {
 
     foreach (0..$#protocols) {
@@ -77,7 +75,7 @@ sub generate_tests() {
                 server => {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
                 server => {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
-                    "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}root-cert.pem",
+                    "VerifyCAFile" => test_pem("root-cert.pem"),
                     "VerifyMode" => "Require",
                 },
                 client => {
                     "VerifyMode" => "Require",
                 },
                 client => {
@@ -97,14 +95,14 @@ sub generate_tests() {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
                     "ClientSignatureAlgorithms" => $clisigalgs,
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
                     "ClientSignatureAlgorithms" => $clisigalgs,
-                    "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}root-cert.pem",
+                    "VerifyCAFile" => test_pem("root-cert.pem"),
                     "VerifyMode" => "Request",
                 },
                 client => {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
                     "VerifyMode" => "Request",
                 },
                 client => {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
-                    "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-client-chain.pem",
-                    "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-key.pem",
+                    "Certificate" => test_pem("ee-client-chain.pem"),
+                    "PrivateKey"  => test_pem("ee-key.pem"),
                 },
                 test   => { "ExpectedResult" => "Success",
                             "ExpectedClientCertType" => "RSA",
                 },
                 test   => { "ExpectedResult" => "Success",
                             "ExpectedClientCertType" => "RSA",
@@ -124,8 +122,8 @@ sub generate_tests() {
                 client => {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
                 client => {
                     "MinProtocol" => $protocol,
                     "MaxProtocol" => $protocol,
-                    "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-client-chain.pem",
-                    "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-key.pem",
+                    "Certificate" => test_pem("ee-client-chain.pem"),
+                    "PrivateKey"  => test_pem("ee-key.pem"),
                 },
                 test   => {
                     "ExpectedResult" => "ServerFail",
                 },
                 test   => {
                     "ExpectedResult" => "ServerFail",
index 77264c4..1efba84 100644 (file)
@@ -14,8 +14,6 @@ use warnings;
 
 package ssltests;
 
 
 package ssltests;
 
-my $dir_sep = $^O ne "VMS" ? "/" : "";
-
 our @tests = (
     {
         name => "renegotiate-client-no-resume",
 our @tests = (
     {
         name => "renegotiate-client-no-resume",
@@ -76,12 +74,12 @@ our @tests = (
         server => {
             "Options" => "NoResumptionOnRenegotiation",
             "MaxProtocol" => "TLSv1.2",
         server => {
             "Options" => "NoResumptionOnRenegotiation",
             "MaxProtocol" => "TLSv1.2",
-            "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}root-cert.pem",
+            "VerifyCAFile" => test_pem("root-cert.pem"),
             "VerifyMode" => "Require",
         },
         client => {
             "VerifyMode" => "Require",
         },
         client => {
-            "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-client-chain.pem",
-            "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-key.pem"
+            "Certificate" => test_pem("ee-client-chain.pem"),
+            "PrivateKey"  => test_pem("ee-key.pem"),
         },
         test => {
             "Method" => "TLS",
         },
         test => {
             "Method" => "TLS",
@@ -95,12 +93,12 @@ our @tests = (
         server => {
             "Options" => "NoResumptionOnRenegotiation",
             "MaxProtocol" => "TLSv1.2",
         server => {
             "Options" => "NoResumptionOnRenegotiation",
             "MaxProtocol" => "TLSv1.2",
-            "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}root-cert.pem",
+            "VerifyCAFile" => test_pem("root-cert.pem"),
             "VerifyMode" => "Once",
         },
         client => {
             "VerifyMode" => "Once",
         },
         client => {
-            "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-client-chain.pem",
-            "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-key.pem"
+            "Certificate" => test_pem("ee-client-chain.pem"),
+            "PrivateKey"  => test_pem("ee-key.pem"),
         },
         test => {
             "Method" => "TLS",
         },
         test => {
             "Method" => "TLS",
index 43046e3..c7020f0 100644 (file)
@@ -14,8 +14,6 @@ use warnings;
 
 package ssltests;
 
 
 package ssltests;
 
-my $dir_sep = $^O ne "VMS" ? "/" : "";
-
 our @tests = (
     {
         name => "renegotiate-client-no-resume",
 our @tests = (
     {
         name => "renegotiate-client-no-resume",
@@ -64,12 +62,12 @@ our @tests = (
     {
         name => "renegotiate-client-auth-require",
         server => {
     {
         name => "renegotiate-client-auth-require",
         server => {
-            "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}root-cert.pem",
+            "VerifyCAFile" => test_pem("root-cert.pem"),
             "VerifyMode" => "Require",
         },
         client => {
             "VerifyMode" => "Require",
         },
         client => {
-            "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-client-chain.pem",
-            "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-key.pem"
+            "Certificate" => test_pem("ee-client-chain.pem"),
+            "PrivateKey"  => test_pem("ee-key.pem"),
         },
         test => {
             "Method" => "DTLS",
         },
         test => {
             "Method" => "DTLS",
@@ -81,12 +79,12 @@ our @tests = (
     {
         name => "renegotiate-client-auth-once",
         server => {
     {
         name => "renegotiate-client-auth-once",
         server => {
-            "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}root-cert.pem",
+            "VerifyCAFile" => test_pem("root-cert.pem"),
             "VerifyMode" => "Once",
         },
         client => {
             "VerifyMode" => "Once",
         },
         client => {
-            "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-client-chain.pem",
-            "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}ee-key.pem"
+            "Certificate" => test_pem("ee-client-chain.pem"),
+            "PrivateKey"  => test_pem("ee-key.pem"),
         },
         test => {
             "Method" => "DTLS",
         },
         test => {
             "Method" => "DTLS",
index 3d36a0e..c5a5c31 100644 (file)
@@ -9,13 +9,9 @@ use warnings;
 package ssltests;
 use OpenSSL::Test::Utils;
 
 package ssltests;
 use OpenSSL::Test::Utils;
 
-my $dir_sep = $^O ne "VMS" ? "/" : "";
-
-my $cert_dir = "\${ENV::TEST_CERTS_DIR}${dir_sep}";
-
 my $server = {
 my $server = {
-    "ECDSA.Certificate" => "${cert_dir}server-ecdsa-cert.pem",
-    "ECDSA.PrivateKey" => "${cert_dir}server-ecdsa-key.pem",
+    "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
+    "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
     "MaxProtocol" => "TLSv1.2"
 };
 
     "MaxProtocol" => "TLSv1.2"
 };
 
@@ -124,17 +120,17 @@ our @tests = (
 
 
 my $server_tls_1_3 = {
 
 
 my $server_tls_1_3 = {
-    "ECDSA.Certificate" => "${cert_dir}server-ecdsa-cert.pem",
-    "ECDSA.PrivateKey" => "${cert_dir}server-ecdsa-key.pem",
+    "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
+    "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
     "MinProtocol" => "TLSv1.3",
     "MaxProtocol" => "TLSv1.3"
 };
 
 my $client_tls_1_3 = {
     "MinProtocol" => "TLSv1.3",
     "MaxProtocol" => "TLSv1.3"
 };
 
 my $client_tls_1_3 = {
-    "RSA.Certificate" => "${cert_dir}ee-client-chain.pem",
-    "RSA.PrivateKey" => "${cert_dir}ee-key.pem",
-    "ECDSA.Certificate" => "${cert_dir}ee-ecdsa-client-chain.pem",
-    "ECDSA.PrivateKey" => "${cert_dir}ee-ecdsa-key.pem",
+    "RSA.Certificate" => test_pem("ee-client-chain.pem"),
+    "RSA.PrivateKey" => test_pem("ee-key.pem"),
+    "ECDSA.Certificate" => test_pem("ee-ecdsa-client-chain.pem"),
+    "ECDSA.PrivateKey" => test_pem("ee-ecdsa-key.pem"),
     "MinProtocol" => "TLSv1.3",
     "MaxProtocol" => "TLSv1.3"
 };
     "MinProtocol" => "TLSv1.3",
     "MaxProtocol" => "TLSv1.3"
 };
@@ -219,7 +215,7 @@ my @tests_tls_1_3 = (
         name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection",
         server => {
             "ClientSignatureAlgorithms" => "PSS+SHA256",
         name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection",
         server => {
             "ClientSignatureAlgorithms" => "PSS+SHA256",
-            "VerifyCAFile" => "${cert_dir}root-cert.pem",
+            "VerifyCAFile" => test_pem("root-cert.pem"),
             "VerifyMode" => "Require"
         },
         client => $client_tls_1_3,
             "VerifyMode" => "Require"
         },
         client => $client_tls_1_3,
@@ -234,7 +230,7 @@ my @tests_tls_1_3 = (
         name => "TLS 1.3 ECDSA Client Auth Signature Algorithm Selection",
         server => {
             "ClientSignatureAlgorithms" => "ECDSA+SHA256",
         name => "TLS 1.3 ECDSA Client Auth Signature Algorithm Selection",
         server => {
             "ClientSignatureAlgorithms" => "ECDSA+SHA256",
-            "VerifyCAFile" => "${cert_dir}root-cert.pem",
+            "VerifyCAFile" => test_pem("root-cert.pem"),
             "VerifyMode" => "Require"
         },
         client => $client_tls_1_3,
             "VerifyMode" => "Require"
         },
         client => $client_tls_1_3,
index 303224a..dc81642 100644 (file)
 
 package ssltests;
 
 
 package ssltests;
 
-my $dir_sep = $^O ne "VMS" ? "/" : "";
+sub test_pem
+{
+    my ($file) = @_;
+    my $dir_sep = $^O ne "VMS" ? "/" : "";
+    return "\${ENV::TEST_CERTS_DIR}" . $dir_sep . $file,
+}
 
 our %base_server = (
 
 our %base_server = (
-    "Certificate" => "\${ENV::TEST_CERTS_DIR}${dir_sep}servercert.pem",
-    "PrivateKey"  => "\${ENV::TEST_CERTS_DIR}${dir_sep}serverkey.pem",
+    "Certificate" => test_pem("servercert.pem"),
+    "PrivateKey"  => test_pem("serverkey.pem"),
     "CipherString" => "DEFAULT",
 );
 
 our %base_client = (
     "CipherString" => "DEFAULT",
 );
 
 our %base_client = (
-    "VerifyCAFile" => "\${ENV::TEST_CERTS_DIR}${dir_sep}rootcert.pem",
+    "VerifyCAFile" => test_pem("rootcert.pem"),
     "VerifyMode" => "Peer",
     "CipherString" => "DEFAULT",
 );
     "VerifyMode" => "Peer",
     "CipherString" => "DEFAULT",
 );