Document what EXFLAG_SET is for in x509v3.h
[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 SNI/Session tickets
11
12 use strict;
13 use warnings;
14
15 package ssltests;
16
17
18 our @tests = ();
19
20 #Note: MaxProtocol is set to TLSv1.2 as session tickets work differently in
21 #TLSv1.3.
22 #TODO(TLS1.3): Implement TLSv1.3 style session tickets
23 sub generate_tests() {
24     foreach my $c ("SessionTicket", "-SessionTicket") {
25         foreach my $s1 ("SessionTicket", "-SessionTicket") {
26             foreach my $s2 ("SessionTicket", "-SessionTicket") {
27                 foreach my $n ("server1", "server2") {
28                     my $result = expected_result($c, $s1, $s2, $n);
29                     push @tests, {
30                         "name" => "sni-session-ticket",
31                         "client" => {
32                             "Options" => $c,
33                             "extra" => {
34                                 "ServerName" => $n,
35                             },
36                             "MaxProtocol" => "TLSv1.2"
37                         },
38                         "server" => {
39                             "Options" => $s1,
40                             "extra" => {
41                                 # We don't test mismatch here.
42                                 "ServerNameCallback" => "IgnoreMismatch",
43                             },
44                         },
45                         "server2" => {
46                             "Options" => $s2,
47                         },
48                         "test" => {
49                             "ExpectedServerName" => $n,
50                             "ExpectedResult" => "Success",
51                             "SessionTicketExpected" => $result,
52                         }
53                     };
54                 }
55             }
56         }
57     }
58 }
59
60 # If the client has session tickets disabled, then No support
61 # If the server initial_ctx has session tickets disabled, then No support
62 # If SNI is in use, then if the "switched-to" context has session tickets disabled,
63 #    then No support
64 sub expected_result {
65     my ($c, $s1, $s2, $n) = @_;
66
67     return "No" if $c eq "-SessionTicket";
68     return "No" if $s1 eq "-SessionTicket";
69     return "No" if ($s2 eq "-SessionTicket" && $n eq "server2");
70
71     return "Yes";
72
73 }
74
75 # Add a "Broken" case.
76 push @tests, {
77     "name" => "sni-session-ticket",
78     "client" => {
79         "MaxProtocol" => "TLSv1.2",
80         "Options" => "SessionTicket",
81         "extra" => {
82             "ServerName" => "server1",
83         }
84     },
85     "server" => {
86         "Options" => "SessionTicket",
87         "extra" => {
88               "BrokenSessionTicket" => "Yes",
89         },
90     },
91     "server2" => {
92         "Options" => "SessionTicket",
93     },
94     "test" => {
95         "ExpectedResult" => "Success",
96         "SessionTicketExpected" => "No",
97     }
98 };
99
100 generate_tests();