Fix dsaparam -genkey with DER outform
[openssl.git] / test / ssl-tests / protocol_version.pm
index ceb5ae0eccb4cb5a126aa8bd97d68ebe3c803fcd..215f9e8c4f572b1a14f2faa56c4d3468f2407cf5 100644 (file)
@@ -1,5 +1,5 @@
 # -*- mode: perl; -*-
-# Copyright 2016-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the OpenSSL license (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
@@ -129,6 +129,39 @@ sub generate_version_tests {
             }
         }
     }
+    return @tests if disabled("tls1_3") || disabled("tls1_2") || $dtls;
+
+    #Add some version/ciphersuite sanity check tests
+    push @tests, {
+        "name" => "ciphersuite-sanity-check-client",
+        "client" => {
+            #Offering only <=TLSv1.2 ciphersuites with TLSv1.3 should fail
+            "CipherString" => "AES128-SHA",
+            "Ciphersuites" => "",
+        },
+        "server" => {
+            "MaxProtocol" => "TLSv1.2"
+        },
+        "test" => {
+            "ExpectedResult" => "ClientFail",
+        }
+    };
+    push @tests, {
+        "name" => "ciphersuite-sanity-check-server",
+        "client" => {
+            "CipherString" => "AES128-SHA",
+            "MaxProtocol" => "TLSv1.2"
+        },
+        "server" => {
+            #Allowing only <=TLSv1.2 ciphersuites with TLSv1.3 should fail
+            "CipherString" => "AES128-SHA",
+            "Ciphersuites" => "",
+        },
+        "test" => {
+            "ExpectedResult" => "ServerFail",
+        }
+    };
+
     return @tests;
 }
 
@@ -163,46 +196,51 @@ sub generate_resumption_tests {
                 $resumption_expected = "No";
             }
 
-            foreach my $ticket ("SessionTicket", "-SessionTicket") {
-                # Client is flexible, server upgrades/downgrades.
-                push @server_tests, {
-                    "name" => "resumption",
-                    "client" => { },
-                    "server" => {
-                        "MinProtocol" => $protocols[$original_protocol],
-                        "MaxProtocol" => $protocols[$original_protocol],
-                        "Options" => $ticket,
-                    },
-                    "resume_server" => {
-                        "MaxProtocol" => $protocols[$resume_protocol],
-                    },
-                    "test" => {
-                        "ExpectedProtocol" => $protocols[$resume_protocol],
-                        "Method" => $method,
-                        "HandshakeMode" => "Resume",
-                        "ResumptionExpected" => $resumption_expected,
-                    }
-                };
-                # Server is flexible, client upgrades/downgrades.
-                push @client_tests, {
-                    "name" => "resumption",
-                    "client" => {
-                        "MinProtocol" => $protocols[$original_protocol],
-                        "MaxProtocol" => $protocols[$original_protocol],
-                    },
-                    "server" => {
-                        "Options" => $ticket,
-                    },
-                    "resume_client" => {
-                        "MaxProtocol" => $protocols[$resume_protocol],
-                    },
-                    "test" => {
-                        "ExpectedProtocol" => $protocols[$resume_protocol],
-                        "Method" => $method,
-                        "HandshakeMode" => "Resume",
-                        "ResumptionExpected" => $resumption_expected,
-                    }
-                };
+            for (my $sctp = 0; $sctp < ($dtls && !disabled("sctp") ? 2 : 1);
+                 $sctp++) {
+                foreach my $ticket ("SessionTicket", "-SessionTicket") {
+                    # Client is flexible, server upgrades/downgrades.
+                    push @server_tests, {
+                        "name" => "resumption",
+                        "client" => { },
+                        "server" => {
+                            "MinProtocol" => $protocols[$original_protocol],
+                            "MaxProtocol" => $protocols[$original_protocol],
+                            "Options" => $ticket,
+                        },
+                        "resume_server" => {
+                            "MaxProtocol" => $protocols[$resume_protocol],
+                        },
+                        "test" => {
+                            "ExpectedProtocol" => $protocols[$resume_protocol],
+                            "Method" => $method,
+                            "HandshakeMode" => "Resume",
+                            "ResumptionExpected" => $resumption_expected,
+                        }
+                    };
+                    $server_tests[-1]{"test"}{"UseSCTP"} = "Yes" if $sctp;
+                    # Server is flexible, client upgrades/downgrades.
+                    push @client_tests, {
+                        "name" => "resumption",
+                        "client" => {
+                            "MinProtocol" => $protocols[$original_protocol],
+                            "MaxProtocol" => $protocols[$original_protocol],
+                        },
+                        "server" => {
+                            "Options" => $ticket,
+                        },
+                        "resume_client" => {
+                            "MaxProtocol" => $protocols[$resume_protocol],
+                        },
+                        "test" => {
+                            "ExpectedProtocol" => $protocols[$resume_protocol],
+                            "Method" => $method,
+                            "HandshakeMode" => "Resume",
+                            "ResumptionExpected" => $resumption_expected,
+                        }
+                    };
+                    $client_tests[-1]{"test"}{"UseSCTP"} = "Yes" if $sctp;
+                }
             }
         }
     }