Add DTLS renegotiation tests
[openssl.git] / test / ssl-tests / 08-npn.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 => "npn-simple",
21         server => {
22             extra => {
23                 "NPNProtocols" => "foo",
24             },
25         },
26         client => {
27             extra => {
28                 "NPNProtocols" => "foo",
29             },
30         },
31         test => {
32             "ExpectedNPNProtocol" => "foo",
33         },
34     },
35     {
36         name => "npn-client-finds-match",
37         server => {
38             extra => {
39                 "NPNProtocols" => "baz,bar",
40             },
41         },
42         client => {
43             extra => {
44                 "NPNProtocols" => "foo,bar",
45             },
46         },
47         test => {
48             "ExpectedNPNProtocol" => "bar",
49         },
50     },
51     {
52         name => "npn-client-honours-server-pref",
53         server => {
54             extra => {
55                 "NPNProtocols" => "bar,foo",
56             },
57         },
58         client => {
59             extra => {
60                 "NPNProtocols" => "foo,bar",
61             },
62         },
63         test => {
64             "ExpectedNPNProtocol" => "bar",
65         },
66     },
67     {
68         name => "npn-client-first-pref-on-mismatch",
69         server => {
70             extra => {
71                 "NPNProtocols" => "baz",
72             },
73         },
74         client => {
75             extra => {
76                 "NPNProtocols" => "foo,bar",
77             },
78         },
79         test => {
80             "ExpectedNPNProtocol" => "foo",
81         },
82     },
83     {
84         name => "npn-no-server-support",
85         server => { },
86         client => {
87             extra => {
88                 "NPNProtocols" => "foo",
89             },
90         },
91         test => {
92             "ExpectedNPNProtocol" => undef,
93         },
94     },
95     {
96         name => "npn-no-client-support",
97         server => {
98             extra => {
99                 "NPNProtocols" => "foo",
100             },
101         },
102         client => { },
103         test => {
104             "ExpectedNPNProtocol" => undef,
105         },
106     },
107     {
108         name => "npn-with-sni-no-context-switch",
109         server => {
110             extra => {
111                 "NPNProtocols" => "foo",
112                 "ServerNameCallback" => "IgnoreMismatch",
113             },
114         },
115         server2 => {
116             extra => {
117                 "NPNProtocols" => "bar",
118             },
119         },
120         client => {
121             extra => {
122                 "NPNProtocols" => "foo,bar",
123                 "ServerName" => "server1",
124             },
125         },
126         test => {
127             "ExpectedServerName" => "server1",
128             "ExpectedNPNProtocol" => "foo",
129         },
130     },
131     {
132         name => "npn-with-sni-context-switch",
133         server => {
134             extra => {
135                 "NPNProtocols" => "foo",
136                 "ServerNameCallback" => "IgnoreMismatch",
137             },
138         },
139         server2 => {
140             extra => {
141                 "NPNProtocols" => "bar",
142             },
143         },
144         client => {
145             extra => {
146                 "NPNProtocols" => "foo,bar",
147                 "ServerName" => "server2",
148             },
149         },
150         test => {
151             "ExpectedServerName" => "server2",
152             "ExpectedNPNProtocol" => "bar",
153         },
154     },
155     {
156         name => "npn-selected-sni-server-supports-npn",
157         server => {
158             extra => {
159                 "ServerNameCallback" => "IgnoreMismatch",
160             },
161         },
162         server2 => {
163             extra => {
164                 "NPNProtocols" => "bar",
165             },
166         },
167         client => {
168             extra => {
169                 "NPNProtocols" => "foo,bar",
170                 "ServerName" => "server2",
171             },
172         },
173         test => {
174             "ExpectedServerName" => "server2",
175             "ExpectedNPNProtocol" => "bar",
176         },
177     },
178     {
179         name => "npn-selected-sni-server-does-not-support-npn",
180         server => {
181             extra => {
182                 "NPNProtocols" => "bar",
183                 "ServerNameCallback" => "IgnoreMismatch",
184             },
185         },
186         server2 => { },
187         client => {
188             extra => {
189                 "NPNProtocols" => "foo,bar",
190                 "ServerName" => "server2",
191             },
192         },
193         test => {
194              "ExpectedServerName" => "server2",
195              "ExpectedNPNProtocol" => undef,
196         },
197     },
198     {
199         name => "alpn-preferred-over-npn",
200         server => {
201             extra => {
202                 "ALPNProtocols" => "foo",
203                 "NPNProtocols" => "bar",
204             },
205         },
206         client => {
207             extra => {
208                 "ALPNProtocols" => "foo",
209                 "NPNProtocols" => "bar",
210             },
211         },
212         test => {
213             "ExpectedALPNProtocol" => "foo",
214             "ExpectedNPNProtocol" => undef,
215         },
216     },
217     {
218         name => "sni-npn-preferred-over-alpn",
219         server => {
220             extra => {
221                 "ServerNameCallback" => "IgnoreMismatch",
222                 "ALPNProtocols" => "foo",
223             },
224         },
225         server2 => {
226             extra => {
227                 "NPNProtocols" => "bar",
228             },
229         },
230         client => {
231             extra => {
232                 "ServerName" => "server2",
233                 "ALPNProtocols" => "foo",
234                 "NPNProtocols" => "bar",
235             },
236         },
237         test => {
238             "ExpectedALPNProtocol" => undef,
239             "ExpectedNPNProtocol" => "bar",
240             "ExpectedServerName" => "server2",  
241         },
242     },
243     {
244         name => "npn-simple-resumption",
245         server => {
246             extra => {
247                 "NPNProtocols" => "foo",
248             },
249         },
250         client => {
251             extra => {
252                 "NPNProtocols" => "foo",
253             },
254         },
255         test => {
256             "HandshakeMode" => "Resume",
257             "ResumptionExpected" => "Yes",
258             "ExpectedNPNProtocol" => "foo",
259         },
260     },
261     {
262         name => "npn-server-switch-resumption",
263         server => {
264             extra => {
265                 "NPNProtocols" => "bar,foo",
266             },
267         },
268         resume_server => {
269             extra => {
270                 "NPNProtocols" => "baz,foo",
271             },
272         },
273         client => {
274             extra => {
275                 "NPNProtocols" => "foo,bar,baz",
276             },
277         },
278         test => {
279             "HandshakeMode" => "Resume",
280             "ResumptionExpected" => "Yes",
281             "ExpectedNPNProtocol" => "baz",
282         },
283     },
284     {
285         name => "npn-client-switch-resumption",
286         server => {
287             extra => {
288                 "NPNProtocols" => "foo,bar,baz",
289             },
290         },
291         client => {
292             extra => {
293                 "NPNProtocols" => "foo,baz",
294             },
295         },
296         resume_client => {
297             extra => {
298                 "NPNProtocols" => "bar,baz",
299             },
300         },
301         test => {
302             "HandshakeMode" => "Resume",
303             "ResumptionExpected" => "Yes",
304             "ExpectedNPNProtocol" => "bar",
305         },
306     },
307     {
308         name => "npn-client-first-pref-on-mismatch-resumption",
309         server => {
310             extra => {
311                 "NPNProtocols" => "bar",
312             },
313         },
314         resume_server => {
315             extra => {
316                 "NPNProtocols" => "baz",
317             },
318         },
319         client => {
320             extra => {
321                 "NPNProtocols" => "foo,bar",
322             },
323         },
324         test => {
325             "HandshakeMode" => "Resume",
326             "ResumptionExpected" => "Yes",
327             "ExpectedNPNProtocol" => "foo",
328         },
329     },
330     {
331         name => "npn-no-server-support-resumption",
332         server => {
333             extra => {
334                 "NPNProtocols" => "foo",
335             },
336         },
337         resume_server => { },
338         client => {
339             extra => {
340                 "NPNProtocols" => "foo",
341             },
342         },
343         test => {
344             "HandshakeMode" => "Resume",
345             "ResumptionExpected" => "Yes",
346             "ExpectedNPNProtocol" => undef,
347         },
348     },
349     {
350         name => "npn-no-client-support-resumption",
351         server => {
352             extra => {
353                 "NPNProtocols" => "foo",
354             },
355         },
356         client => {
357             extra => {
358                 "NPNProtocols" => "foo",
359             },
360         },
361         resume_client => { },
362         test => {
363             "HandshakeMode" => "Resume",
364             "ResumptionExpected" => "Yes",
365             "ExpectedNPNProtocol" => undef,
366         },
367     },
368     {
369         name => "alpn-preferred-over-npn-resumption",
370         server => {
371             extra => {
372                 "NPNProtocols" => "bar",
373             },
374         },
375         resume_server => {
376             extra => {
377                 "ALPNProtocols" => "foo",
378                 "NPNProtocols" => "baz",
379             },
380         },
381         client => {
382             extra => {
383                 "ALPNProtocols" => "foo",
384                 "NPNProtocols" => "bar,baz",
385             },
386         },
387         test => {
388             "HandshakeMode" => "Resume",
389             "ResumptionExpected" => "Yes",
390             "ExpectedALPNProtocol" => "foo",
391             "ExpectedNPNProtocol" => undef,
392         },
393     },
394     {
395         name => "npn-used-if-alpn-not-supported-resumption",
396         server => {
397             extra => {
398                 "ALPNProtocols" => "foo",
399                 "NPNProtocols" => "bar",
400             },
401         },
402         resume_server => {
403             extra => {
404                 "NPNProtocols" => "baz",
405             },
406         },
407         client => {
408             extra => {
409                 "ALPNProtocols" => "foo",
410                 "NPNProtocols" => "bar,baz",
411             },
412         },
413         test => {
414             "HandshakeMode" => "Resume",
415             "ResumptionExpected" => "Yes",
416             "ExpectedALPNProtocol" => undef,
417             "ExpectedNPNProtocol" => "baz",
418         },
419     },
420 );