18560e1801b1b660b6e8e7caf48dcc39f9a504a0
[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     {
200         name => "alpn-simple-resumption",
201         server => {
202             extra => {
203                 "ALPNProtocols" => "foo",
204             },
205         },
206         client => {
207             extra => {
208                 "ALPNProtocols" => "foo",
209             },
210         },
211         test => {
212             "HandshakeMode" => "Resume",
213             "ResumptionExpected" => "Yes",
214             "ExpectedALPNProtocol" => "foo",
215         },
216     },
217     {
218         name => "alpn-server-switch-resumption",
219         server => {
220             extra => {
221                 "ALPNProtocols" => "bar,foo",
222             },
223         },
224         resume_server => {
225             extra => {
226                 "ALPNProtocols" => "baz,foo",
227             },
228         },
229         client => {
230             extra => {
231                 "ALPNProtocols" => "foo,bar,baz",
232             },
233         },
234         test => {
235             "HandshakeMode" => "Resume",
236             "ResumptionExpected" => "Yes",
237             "ExpectedALPNProtocol" => "baz",
238         },
239     },
240     {
241         name => "alpn-client-switch-resumption",
242         server => {
243             extra => {
244                 "ALPNProtocols" => "foo,bar,baz",
245             },
246         },
247         client => {
248             extra => {
249                 "ALPNProtocols" => "foo,baz",
250             },
251         },
252         resume_client => {
253             extra => {
254                 "ALPNProtocols" => "bar,baz",
255             },
256         },
257         test => {
258             "HandshakeMode" => "Resume",
259             "ResumptionExpected" => "Yes",
260             "ExpectedALPNProtocol" => "bar",
261         },
262     },
263     {
264         name => "alpn-alert-on-mismatch-resumption",
265         server => {
266             extra => {
267                 "ALPNProtocols" => "bar",
268             },
269         },
270         resume_server => {
271             extra => {
272                 "ALPNProtocols" => "baz",
273             },
274         },
275         client => {
276             extra => {
277                 "ALPNProtocols" => "foo,bar",
278             },
279         },
280         test => {
281             "HandshakeMode" => "Resume",
282             "ExpectedResult" => "ServerFail",
283             "ExpectedServerAlert" => "NoApplicationProtocol",
284         },
285     },
286     {
287         name => "alpn-no-server-support-resumption",
288         server => {
289             extra => {
290                 "ALPNProtocols" => "foo",
291             },
292         },
293         resume_server => { },
294         client => {
295             extra => {
296                 "ALPNProtocols" => "foo",
297             },
298         },
299         test => {
300             "HandshakeMode" => "Resume",
301             "ResumptionExpected" => "Yes",
302             "ExpectedALPNProtocol" => undef,
303         },
304     },
305     {
306         name => "alpn-no-client-support-resumption",
307         server => {
308             extra => {
309                 "ALPNProtocols" => "foo",
310             },
311         },
312         client => {
313             extra => {
314                 "ALPNProtocols" => "foo",
315             },
316         },
317         resume_client => { },
318         test => {
319             "HandshakeMode" => "Resume",
320             "ResumptionExpected" => "Yes",
321             "ExpectedALPNProtocol" => undef,
322         },
323     },
324 );