ff931a94254600324250bc28953f13e713704f03
[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             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
208             MaxProtocol => "TLSv1.2",
209             extra => {
210                 "ALPNProtocols" => "foo",
211             },
212         },
213         test => {
214             "HandshakeMode" => "Resume",
215             "ResumptionExpected" => "Yes",
216             "ExpectedALPNProtocol" => "foo",
217         },
218     },
219     {
220         name => "alpn-server-switch-resumption",
221         server => {
222             extra => {
223                 "ALPNProtocols" => "bar,foo",
224             },
225         },
226         resume_server => {
227             extra => {
228                 "ALPNProtocols" => "baz,foo",
229             },
230         },
231         client => {
232             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
233             MaxProtocol => "TLSv1.2",
234             extra => {
235                 "ALPNProtocols" => "foo,bar,baz",
236             },
237         },
238         test => {
239             "HandshakeMode" => "Resume",
240             "ResumptionExpected" => "Yes",
241             "ExpectedALPNProtocol" => "baz",
242         },
243     },
244     {
245         name => "alpn-client-switch-resumption",
246         server => {
247             extra => {
248                 "ALPNProtocols" => "foo,bar,baz",
249             },
250         },
251         client => {
252             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
253             MaxProtocol => "TLSv1.2",
254             extra => {
255                 "ALPNProtocols" => "foo,baz",
256             },
257         },
258         resume_client => {
259             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
260             MaxProtocol => "TLSv1.2",
261             extra => {
262                 "ALPNProtocols" => "bar,baz",
263             },
264         },
265         test => {
266             "HandshakeMode" => "Resume",
267             "ResumptionExpected" => "Yes",
268             "ExpectedALPNProtocol" => "bar",
269         },
270     },
271     {
272         name => "alpn-alert-on-mismatch-resumption",
273         server => {
274             extra => {
275                 "ALPNProtocols" => "bar",
276             },
277         },
278         resume_server => {
279             extra => {
280                 "ALPNProtocols" => "baz",
281             },
282         },
283         client => {
284             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
285             MaxProtocol => "TLSv1.2",
286             extra => {
287                 "ALPNProtocols" => "foo,bar",
288             },
289         },
290         test => {
291             "HandshakeMode" => "Resume",
292             "ExpectedResult" => "ServerFail",
293             "ExpectedServerAlert" => "NoApplicationProtocol",
294         },
295     },
296     {
297         name => "alpn-no-server-support-resumption",
298         server => {
299             extra => {
300                 "ALPNProtocols" => "foo",
301             },
302         },
303         resume_server => { },
304         client => {
305             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
306             MaxProtocol => "TLSv1.2",
307             extra => {
308                 "ALPNProtocols" => "foo",
309             },
310         },
311         test => {
312             "HandshakeMode" => "Resume",
313             "ResumptionExpected" => "Yes",
314             "ExpectedALPNProtocol" => undef,
315         },
316     },
317     {
318         name => "alpn-no-client-support-resumption",
319         server => {
320             extra => {
321                 "ALPNProtocols" => "foo",
322             },
323         },
324         client => {
325             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
326             MaxProtocol => "TLSv1.2",
327             extra => {
328                 "ALPNProtocols" => "foo",
329             },
330         },
331         resume_client => {
332             #TODO(TLS1.3): Temporary until we support TLSv1.3 resumption
333             MaxProtocol => "TLSv1.2"
334         },
335         test => {
336             "HandshakeMode" => "Resume",
337             "ResumptionExpected" => "Yes",
338             "ExpectedALPNProtocol" => undef,
339         },
340     },
341 );