]>
Commit | Line | Data |
---|---|---|
ce2cdac2 | 1 | # -*- mode: perl; -*- |
33388b44 | 2 | # Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. |
ce2cdac2 | 3 | # |
909f1a2e | 4 | # Licensed under the Apache License 2.0 (the "License"). You may not use |
ce2cdac2 EK |
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", | |
9f48bbac EK |
21 | server => { |
22 | extra => { | |
23 | "ALPNProtocols" => "foo", | |
24 | }, | |
25 | }, | |
26 | client => { | |
27 | extra => { | |
28 | "ALPNProtocols" => "foo", | |
29 | }, | |
30 | }, | |
ce2cdac2 | 31 | test => { |
2ac6bdc0 | 32 | "ExpectedALPNProtocol" => "foo", |
ce2cdac2 EK |
33 | }, |
34 | }, | |
35 | { | |
9f48bbac EK |
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 | }, | |
ce2cdac2 | 47 | test => { |
2ac6bdc0 | 48 | "ExpectedALPNProtocol" => "bar", |
ce2cdac2 EK |
49 | }, |
50 | }, | |
51 | { | |
9f48bbac EK |
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 | }, | |
ce2cdac2 | 63 | test => { |
2ac6bdc0 | 64 | "ExpectedALPNProtocol" => "bar", |
ce2cdac2 EK |
65 | }, |
66 | }, | |
67 | { | |
68 | name => "alpn-alert-on-mismatch", | |
9f48bbac EK |
69 | server => { |
70 | extra => { | |
71 | "ALPNProtocols" => "baz", | |
72 | }, | |
73 | }, | |
74 | client => { | |
75 | extra => { | |
76 | "ALPNProtocols" => "foo,bar", | |
77 | }, | |
78 | }, | |
ce2cdac2 | 79 | test => { |
2ac6bdc0 EK |
80 | "ExpectedResult" => "ServerFail", |
81 | "ExpectedServerAlert" => "NoApplicationProtocol", | |
ce2cdac2 EK |
82 | }, |
83 | }, | |
84 | { | |
85 | name => "alpn-no-server-support", | |
86 | server => { }, | |
9f48bbac EK |
87 | client => { |
88 | extra => { | |
89 | "ALPNProtocols" => "foo", | |
90 | }, | |
91 | }, | |
ce2cdac2 | 92 | test => { |
2ac6bdc0 | 93 | "ExpectedALPNProtocol" => undef, |
ce2cdac2 EK |
94 | }, |
95 | }, | |
96 | { | |
97 | name => "alpn-no-client-support", | |
9f48bbac EK |
98 | server => { |
99 | extra => { | |
100 | "ALPNProtocols" => "foo", | |
101 | }, | |
102 | }, | |
ce2cdac2 EK |
103 | client => { }, |
104 | test => { | |
2ac6bdc0 | 105 | "ExpectedALPNProtocol" => undef, |
ce2cdac2 EK |
106 | }, |
107 | }, | |
108 | { | |
109 | name => "alpn-with-sni-no-context-switch", | |
9f48bbac EK |
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 | }, | |
ce2cdac2 | 127 | test => { |
2ac6bdc0 EK |
128 | "ExpectedServerName" => "server1", |
129 | "ExpectedALPNProtocol" => "foo", | |
ce2cdac2 EK |
130 | }, |
131 | }, | |
132 | { | |
133 | name => "alpn-with-sni-context-switch", | |
9f48bbac EK |
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 | }, | |
ce2cdac2 | 151 | test => { |
2ac6bdc0 EK |
152 | "ExpectedServerName" => "server2", |
153 | "ExpectedALPNProtocol" => "bar", | |
ce2cdac2 EK |
154 | }, |
155 | }, | |
156 | { | |
157 | name => "alpn-selected-sni-server-supports-alpn", | |
9f48bbac EK |
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 | }, | |
ce2cdac2 | 174 | test => { |
2ac6bdc0 EK |
175 | "ExpectedServerName" => "server2", |
176 | "ExpectedALPNProtocol" => "bar", | |
ce2cdac2 EK |
177 | }, |
178 | }, | |
179 | { | |
180 | name => "alpn-selected-sni-server-does-not-support-alpn", | |
9f48bbac EK |
181 | server => { |
182 | extra => { | |
183 | "ALPNProtocols" => "bar", | |
184 | "ServerNameCallback" => "IgnoreMismatch", | |
185 | }, | |
186 | }, | |
ce2cdac2 | 187 | server2 => { }, |
9f48bbac EK |
188 | client => { |
189 | extra => { | |
190 | "ALPNProtocols" => "foo,bar", | |
191 | "ServerName" => "server2", | |
192 | }, | |
193 | }, | |
ce2cdac2 | 194 | test => { |
2ac6bdc0 EK |
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 | }, | |
71728dd8 | 317 | resume_client => { |
71728dd8 | 318 | }, |
2ac6bdc0 EK |
319 | test => { |
320 | "HandshakeMode" => "Resume", | |
321 | "ResumptionExpected" => "Yes", | |
322 | "ExpectedALPNProtocol" => undef, | |
ce2cdac2 EK |
323 | }, |
324 | }, | |
325 | ); |