Reorganize SSL test structures
[openssl.git] / test / ssl-tests / 09-alpn.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         name => "alpn-simple",
21         server => {
22             extra => {
23                 "ALPNProtocols" => "foo",
24             },
25         },
26         client => {
27             extra => {
28                 "ALPNProtocols" => "foo",
29             },
30         },
31         test => {
32              "ExpectedALPNProtocol" => "foo",
33         },
34     },
35     {
36         name => "alpn-server-finds-match",
37         server => {
38             extra => {
39                 "ALPNProtocols" => "baz,bar",
40             },
41         },
42         client => {
43             extra => {
44                 "ALPNProtocols" => "foo,bar",
45             },
46         },
47         test => {
48              "ExpectedALPNProtocol" => "bar",
49         },
50     },
51     {
52         name => "alpn-server-honours-server-pref",
53         server => {
54             extra => {
55                 "ALPNProtocols" => "bar,foo",
56             },
57         },
58         client => {
59             extra => {
60                 "ALPNProtocols" => "foo,bar",
61             },
62         },
63         test => {
64              "ExpectedALPNProtocol" => "bar",
65         },
66     },
67     {
68         name => "alpn-alert-on-mismatch",
69         server => {
70             extra => {
71                 "ALPNProtocols" => "baz",
72             },
73         },
74         client => {
75             extra => {
76                 "ALPNProtocols" => "foo,bar",
77             },
78         },
79         test => {
80              "ExpectedResult" => "ServerFail",
81              "ExpectedServerAlert" => "NoApplicationProtocol",
82         },
83     },
84     {
85         name => "alpn-no-server-support",
86         server => { },
87         client => {
88             extra => {
89                 "ALPNProtocols" => "foo",
90             },
91         },
92         test => {
93              "ExpectedALPNProtocol" => undef,
94         },
95     },
96     {
97         name => "alpn-no-client-support",
98         server => {
99             extra => {
100                 "ALPNProtocols" => "foo",
101             },
102         },
103         client => { },
104         test => {
105              "ExpectedALPNProtocol" => undef,
106         },
107     },
108     {
109         name => "alpn-with-sni-no-context-switch",
110         server => {
111             extra => {
112                 "ALPNProtocols" => "foo",
113                 "ServerNameCallback" => "IgnoreMismatch",
114             },
115         },
116         server2 => {
117             extra => {
118                 "ALPNProtocols" => "bar",
119             },
120         },
121         client => {
122             extra => {
123                 "ALPNProtocols" => "foo,bar",
124                 "ServerName" => "server1",
125             },
126         },
127         test => {
128              "ExpectedServerName" => "server1",
129              "ExpectedALPNProtocol" => "foo",
130         },
131     },
132     {
133         name => "alpn-with-sni-context-switch",
134         server => {
135             extra => {
136                 "ALPNProtocols" => "foo",
137                 "ServerNameCallback" => "IgnoreMismatch",
138             },
139         },
140         server2 => {
141             extra => {
142                 "ALPNProtocols" => "bar",
143             },
144         },
145         client => {
146             extra => {
147                 "ALPNProtocols" => "foo,bar",
148                 "ServerName" => "server2",
149             },
150         },
151         test => {
152              "ExpectedServerName" => "server2",
153              "ExpectedALPNProtocol" => "bar",
154         },
155     },
156     {
157         name => "alpn-selected-sni-server-supports-alpn",
158         server => {
159             extra => {
160                "ServerNameCallback" => "IgnoreMismatch",
161             },
162         },
163         server2 => {
164             extra => {
165                 "ALPNProtocols" => "bar",
166             },
167         },
168         client => {
169             extra => {
170                 "ALPNProtocols" => "foo,bar",
171                 "ServerName" => "server2",
172             },
173         },
174         test => {
175              "ExpectedServerName" => "server2",
176              "ExpectedALPNProtocol" => "bar",
177         },
178     },
179     {
180         name => "alpn-selected-sni-server-does-not-support-alpn",
181         server => {
182             extra => {
183                 "ALPNProtocols" => "bar", 
184                 "ServerNameCallback" => "IgnoreMismatch",
185             },
186         },
187         server2 => { },
188         client => {
189             extra => {
190                 "ALPNProtocols" => "foo,bar",
191                 "ServerName" => "server2",
192             },
193         },
194         test => {
195              "ExpectedServerName" => "server2",
196              "ExpectedALPNProtocol" => undef,
197         },
198     },
199 );