]>
Commit | Line | Data |
---|---|---|
6dc99745 | 1 | # -*- mode: perl; -*- |
33388b44 | 2 | # Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. |
6dc99745 | 3 | # |
909f1a2e | 4 | # Licensed under the Apache License 2.0 (the "License"). You may not use |
6dc99745 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 | ||
cf72c757 | 10 | ## Test packet fragmentation |
6dc99745 EK |
11 | |
12 | use strict; | |
13 | use warnings; | |
14 | ||
15 | package ssltests; | |
16 | ||
17 | ||
18 | our @tests = ( | |
19 | # Default fragment size is 512. | |
20 | { | |
21 | name => "one-fragment-minus-app-data", | |
22 | server => { }, | |
23 | client => { }, | |
24 | test => { | |
25 | ApplicationData => 511, | |
26 | } | |
27 | }, | |
28 | { | |
29 | name => "one-fragment-app-data", | |
30 | server => { }, | |
31 | client => { }, | |
32 | test => { | |
33 | ApplicationData => 512, | |
34 | } | |
35 | }, | |
36 | { | |
37 | name => "one-fragment-plus-app-data", | |
38 | server => { }, | |
39 | client => { }, | |
40 | test => { | |
41 | ApplicationData => 513, | |
42 | } | |
43 | }, | |
44 | { | |
45 | name => "small-app-data", | |
46 | server => { }, | |
47 | client => { }, | |
48 | test => { | |
49 | ApplicationData => 4 * 1024 + 1, | |
50 | } | |
51 | }, | |
52 | { | |
53 | name => "small-app-data-large-fragment-size", | |
54 | server => { }, | |
55 | client => { }, | |
56 | test => { | |
57 | ApplicationData => 4 * 1024 + 1, | |
58 | MaxFragmentSize => 16384, | |
59 | } | |
60 | }, | |
61 | { | |
62 | name => "medium-app-data", | |
63 | server => { }, | |
64 | client => { }, | |
65 | test => { | |
66 | ApplicationData => 32 * 1024 + 7, | |
67 | } | |
68 | }, | |
69 | # Exceeds the 64kB write buffer size. | |
70 | { | |
71 | name => "medium-plus-app-data", | |
72 | server => { }, | |
73 | client => { }, | |
74 | test => { | |
75 | ApplicationData => 128 * 1024 - 3, | |
76 | } | |
77 | }, | |
78 | { | |
79 | name => "large-app-data", | |
80 | server => { }, | |
81 | client => { }, | |
82 | test => { | |
83 | ApplicationData => 1024 * 1024, | |
84 | } | |
85 | }, | |
86 | { | |
87 | name => "large-app-data-large-fragment-size", | |
88 | server => { }, | |
89 | client => { }, | |
90 | test => { | |
91 | ApplicationData => 1024 * 1024, | |
92 | MaxFragmentSize => 16384, | |
93 | } | |
94 | }, | |
95 | { | |
96 | name => "large-app-data-odd-fragment-size", | |
97 | server => { }, | |
98 | client => { }, | |
99 | test => { | |
100 | ApplicationData => 1024 * 1024, | |
101 | MaxFragmentSize => 5 * 1024 - 5, | |
102 | } | |
103 | }, | |
104 | # When the buffer / fragment size ratio is sufficiently large, | |
105 | # multi-buffer code kicks in on some platforms for AES-SHA. The | |
106 | # exact minimum ratio depends on the platform, and is usually | |
436ad81f | 107 | # around 4. Since the test buffer is 64kB, a 4kB fragment is |
6dc99745 EK |
108 | # easily sufficient. |
109 | # | |
110 | # (We run this test on all platforms though it's only true multibuffer | |
111 | # on some of them.) | |
112 | { | |
113 | name => "large-app-data-aes-sha1-multibuffer", | |
114 | server => { }, | |
115 | client => { | |
116 | CipherString => "AES128-SHA", | |
582a17d6 | 117 | MaxProtocol => "TLSv1.2" |
6dc99745 EK |
118 | }, |
119 | test => { | |
120 | ApplicationData => 1024 * 1024, | |
121 | MaxFragmentSize => 4 * 1024, | |
122 | } | |
123 | }, | |
124 | { | |
125 | name => "large-app-data-aes-sha2-multibuffer", | |
126 | server => { }, | |
127 | client => { | |
128 | CipherString => "AES128-SHA256", | |
582a17d6 | 129 | MaxProtocol => "TLSv1.2" |
6dc99745 EK |
130 | }, |
131 | test => { | |
132 | ApplicationData => 1024 * 1024, | |
133 | MaxFragmentSize => 4 * 1024, | |
134 | } | |
135 | }, | |
136 | { | |
137 | name => "large-app-data-aes-sha1-multibuffer-odd-fragment", | |
138 | server => { }, | |
139 | client => { | |
140 | CipherString => "AES128-SHA", | |
582a17d6 | 141 | MaxProtocol => "TLSv1.2" |
6dc99745 EK |
142 | }, |
143 | test => { | |
144 | ApplicationData => 1024 * 1024 + 3, | |
145 | MaxFragmentSize => 5 * 1024 - 5, | |
146 | } | |
147 | }, | |
148 | { | |
149 | name => "large-app-data-aes-sha2-multibuffer-odd-fragment", | |
150 | server => { }, | |
151 | client => { | |
152 | CipherString => "AES128-SHA256", | |
582a17d6 | 153 | MaxProtocol => "TLSv1.2" |
6dc99745 EK |
154 | }, |
155 | test => { | |
156 | ApplicationData => 1024 * 1024 - 3, | |
157 | MaxFragmentSize => 5 * 1024 + 5, | |
158 | } | |
159 | }, | |
160 | # Test that multibuffer-capable code also handles small data correctly. | |
161 | # Here fragment size == app data size < buffer size, | |
162 | # so no multibuffering should happen. | |
163 | { | |
164 | name => "small-app-data-aes-sha1-multibuffer", | |
165 | server => { }, | |
166 | client => { | |
167 | CipherString => "AES128-SHA", | |
582a17d6 | 168 | MaxProtocol => "TLSv1.2" |
6dc99745 EK |
169 | }, |
170 | test => { | |
171 | ApplicationData => 4 * 1024, | |
172 | MaxFragmentSize => 4 * 1024, | |
173 | } | |
174 | }, | |
175 | { | |
176 | name => "small-app-data-aes-sha2-multibuffer", | |
177 | server => { }, | |
178 | client => { | |
179 | CipherString => "AES128-SHA256", | |
582a17d6 | 180 | MaxProtocol => "TLSv1.2" |
6dc99745 EK |
181 | }, |
182 | test => { | |
183 | ApplicationData => 4 * 1024, | |
184 | MaxFragmentSize => 4 * 1024, | |
185 | } | |
186 | }, | |
cf72c757 F |
187 | ############################################ |
188 | # Default (Max) Fragment Size is 512. | |
189 | # Default Application data size is 256. | |
190 | { | |
191 | name => "Maximum Fragment Len extension set to 1024 w. FragmentSize disabled", | |
192 | server => { }, | |
193 | client => { | |
194 | extra => { | |
195 | MaxFragmentLenExt => 1024, | |
196 | }, | |
197 | }, | |
198 | test => { | |
199 | ApplicationData => 3072, | |
200 | MaxFragmentSize => 16384, | |
201 | } | |
202 | }, | |
203 | { | |
204 | name => "Maximum Fragment Len extension equal FragmentSize to 2048", | |
205 | server => { }, | |
206 | client => { | |
207 | extra => { | |
208 | MaxFragmentLenExt => 2048, | |
209 | }, | |
210 | }, | |
211 | test => { | |
212 | ApplicationData => 3072, | |
213 | MaxFragmentSize => 2048, | |
214 | } | |
215 | }, | |
216 | { | |
217 | name => "Maximum Fragment Len extension 512 lower than FragmentSize 1024", | |
218 | server => { }, | |
219 | client => { | |
220 | extra => { | |
221 | MaxFragmentLenExt => 512, | |
222 | }, | |
223 | }, | |
224 | test => { | |
225 | ApplicationData => 3072, | |
226 | MaxFragmentSize => 1024, | |
227 | } | |
228 | }, | |
229 | { | |
230 | name => "Maximum Fragment Len extension 1024 lower than FragmentSize 1024", | |
231 | server => { }, | |
232 | client => { | |
233 | extra => { | |
234 | MaxFragmentLenExt => 2048, | |
235 | }, | |
236 | }, | |
237 | test => { | |
238 | ApplicationData => 3072, | |
239 | MaxFragmentSize => 1024, | |
240 | } | |
241 | }, | |
242 | { | |
243 | name => "Maximum Fragment Len extension 4096 greater than FragmentSize 2048", | |
244 | server => { }, | |
245 | client => { | |
246 | extra => { | |
247 | MaxFragmentLenExt => 4096, | |
248 | }, | |
249 | }, | |
250 | test => { | |
251 | ApplicationData => 8196, | |
252 | MaxFragmentSize => 2048, | |
253 | } | |
254 | }, | |
255 | { | |
256 | name => "Maximum Fragment Len extension 2048 greater than FragmentSize 1024", | |
257 | server => { }, | |
258 | client => { | |
259 | extra => { | |
260 | MaxFragmentLenExt => 2048, | |
261 | }, | |
262 | }, | |
263 | test => { | |
264 | ApplicationData => 3072, | |
265 | MaxFragmentSize => 1024, | |
266 | } | |
267 | }, | |
6dc99745 | 268 | ); |