Add DTLS renegotiation tests
[openssl.git] / test / ssl-tests / 06-sni-ticket.conf.in
1 # -*- mode: perl; -*-
2 # Copyright 2016-2016 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the OpenSSL license (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 ## Test version negotiation
11
12 use strict;
13 use warnings;
14
15 package ssltests;
16
17
18 our @tests = ();
19
20 sub generate_tests() {
21     foreach my $c ("SessionTicket", "-SessionTicket") {
22         foreach my $s1 ("SessionTicket", "-SessionTicket") {
23             foreach my $s2 ("SessionTicket", "-SessionTicket") {
24                 foreach my $n ("server1", "server2") {
25                     my $result = expected_result($c, $s1, $s2, $n);
26                     push @tests, {
27                         "name" => "sni-session-ticket",
28                         "client" => {
29                             "Options" => $c,
30                             "extra" => {
31                                 "ServerName" => $n,
32                             },
33                         },
34                         "server" => {
35                             "Options" => $s1,
36                             "extra" => {
37                                 # We don't test mismatch here.
38                                 "ServerNameCallback" => "IgnoreMismatch",
39                             },
40                         },
41                         "server2" => {
42                             "Options" => $s2,
43                         },
44                         "test" => {
45                             "ExpectedServerName" => $n,
46                             "ExpectedResult" => "Success",
47                             "SessionTicketExpected" => $result,
48                         }
49                     };
50                 }
51             }
52         }
53     }
54 }
55
56 # If the client has session tickets disabled, then No support
57 # If the server initial_ctx has session tickets disabled, then No support
58 # If SNI is in use, then if the "switched-to" context has session tickets disabled,
59 #    then No support
60 sub expected_result {
61     my ($c, $s1, $s2, $n) = @_;
62
63     return "No" if $c eq "-SessionTicket";
64     return "No" if $s1 eq "-SessionTicket";
65     return "No" if ($s2 eq "-SessionTicket" && $n eq "server2");
66
67     return "Yes";
68
69 }
70
71 # Add a "Broken" case.
72 push @tests, {
73     "name" => "sni-session-ticket",
74     "client" => {
75         "Options" => "SessionTicket",
76         "extra" => {
77             "ServerName" => "server1",
78         }
79     },
80     "server" => {
81         "Options" => "SessionTicket",
82         "extra" => {
83               "BrokenSessionTicket" => "Yes",
84         },
85     },
86     "server2" => {
87         "Options" => "SessionTicket",
88     },
89     "test" => {
90         "ExpectedResult" => "Success",
91         "SessionTicketExpected" => "No",
92     }
93 };
94
95 generate_tests();