Reorganize SSL test structures
[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 );