xref: /dpdk/app/test/test_security_inline_proto_vectors.h (revision 515cd4a488b6a0c6e40d20e6b10d8e89657dc23f)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2022 Marvell.
3  */
4 #ifndef _TEST_INLINE_IPSEC_REASSEMBLY_VECTORS_H_
5 #define _TEST_INLINE_IPSEC_REASSEMBLY_VECTORS_H_
6 
7 #include "test_cryptodev_security_ipsec.h"
8 
9 uint8_t dummy_ipv4_eth_hdr[] = {
10 		/* ETH */
11 		0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
12 		0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
13 };
14 uint8_t dummy_ipv6_eth_hdr[] = {
15 		/* ETH */
16 		0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
17 		0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
18 };
19 
20 #define MAX_FRAG_LEN		 1500
21 #define MAX_FRAGS		 6
22 #define MAX_PKT_LEN		 (MAX_FRAG_LEN * MAX_FRAGS)
23 
24 struct ip_reassembly_test_packet {
25 	uint32_t len;
26 	uint32_t l4_offset;
27 	uint8_t data[MAX_PKT_LEN];
28 };
29 
30 struct reassembly_vector {
31 	/* input/output text in struct ipsec_test_data are not used */
32 	struct ipsec_test_data *sa_data;
33 	struct ip_reassembly_test_packet *full_pkt;
34 	struct ip_reassembly_test_packet *frags[MAX_FRAGS];
35 	uint16_t nb_frags;
36 	bool burst;
37 };
38 
39 struct sa_expiry_vector {
40 	struct ipsec_session_data *sa_data;
41 	enum rte_eth_event_ipsec_subtype event;
42 	bool notify_event;
43 };
44 
45 /* The source file includes below test vectors */
46 /* IPv6:
47  *
48  *	1) pkt_ipv6_udp_p1
49  *		pkt_ipv6_udp_p1_f1
50  *		pkt_ipv6_udp_p1_f2
51  *
52  *	2) pkt_ipv6_udp_p2
53  *		pkt_ipv6_udp_p2_f1
54  *		pkt_ipv6_udp_p2_f2
55  *		pkt_ipv6_udp_p2_f3
56  *		pkt_ipv6_udp_p2_f4
57  *
58  *	3) pkt_ipv6_udp_p3
59  *		pkt_ipv6_udp_p3_f1
60  *		pkt_ipv6_udp_p3_f2
61  *		pkt_ipv6_udp_p3_f3
62  *		pkt_ipv6_udp_p3_f4
63  *		pkt_ipv6_udp_p3_f5
64  */
65 
66 /* IPv4:
67  *
68  *	1) pkt_ipv4_udp_p1
69  *		pkt_ipv4_udp_p1_f1
70  *		pkt_ipv4_udp_p1_f2
71  *
72  *	2) pkt_ipv4_udp_p2
73  *		pkt_ipv4_udp_p2_f1
74  *		pkt_ipv4_udp_p2_f2
75  *		pkt_ipv4_udp_p2_f3
76  *		pkt_ipv4_udp_p2_f4
77  *
78  *	3) pkt_ipv4_udp_p3
79  *		pkt_ipv4_udp_p3_f1
80  *		pkt_ipv4_udp_p3_f2
81  *		pkt_ipv4_udp_p3_f3
82  *		pkt_ipv4_udp_p3_f4
83  *		pkt_ipv4_udp_p3_f5
84  */
85 
86 struct ip_reassembly_test_packet pkt_ipv6_udp_p1 = {
87 	.len = 1500,
88 	.l4_offset = 40,
89 	.data = {
90 		/* IP */
91 		0x60, 0x00, 0x00, 0x00, 0x05, 0xb4, 0x2C, 0x40,
92 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
93 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
94 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
95 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
96 
97 		/* UDP */
98 		0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
99 	},
100 };
101 
102 struct ip_reassembly_test_packet pkt_ipv6_udp_p1_f1 = {
103 	.len = 1384,
104 	.l4_offset = 48,
105 	.data = {
106 		/* IP */
107 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
108 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
109 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
110 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
111 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
112 		0x11, 0x00, 0x00, 0x01, 0x5c, 0x92, 0xac, 0xf1,
113 
114 		/* UDP */
115 		0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
116 	},
117 };
118 
119 struct ip_reassembly_test_packet pkt_ipv6_udp_p1_f2 = {
120 	.len = 172,
121 	.l4_offset = 48,
122 	.data = {
123 		/* IP */
124 		0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2c, 0x40,
125 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
127 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
129 		0x11, 0x00, 0x05, 0x38, 0x5c, 0x92, 0xac, 0xf1,
130 	},
131 };
132 
133 struct ip_reassembly_test_packet pkt_ipv6_udp_p2 = {
134 	.len = 4482,
135 	.l4_offset = 40,
136 	.data = {
137 		/* IP */
138 		0x60, 0x00, 0x00, 0x00, 0x11, 0x5a, 0x2c, 0x40,
139 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
141 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
143 
144 		/* UDP */
145 		0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
146 	},
147 };
148 
149 struct ip_reassembly_test_packet pkt_ipv6_udp_p2_f1 = {
150 	.len = 1384,
151 	.l4_offset = 48,
152 	.data = {
153 		/* IP */
154 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
155 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
157 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
159 		0x11, 0x00, 0x00, 0x01, 0x64, 0x6c, 0x68, 0x9f,
160 
161 		/* UDP */
162 		0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
163 	},
164 };
165 
166 struct ip_reassembly_test_packet pkt_ipv6_udp_p2_f2 = {
167 	.len = 1384,
168 	.l4_offset = 48,
169 	.data = {
170 		/* IP */
171 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
172 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
173 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
174 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
176 		0x11, 0x00, 0x05, 0x39, 0x64, 0x6c, 0x68, 0x9f,
177 	},
178 };
179 
180 struct ip_reassembly_test_packet pkt_ipv6_udp_p2_f3 = {
181 	.len = 1384,
182 	.l4_offset = 48,
183 	.data = {
184 		/* IP */
185 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
186 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
187 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
188 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
189 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
190 		0x11, 0x00, 0x0a, 0x71, 0x64, 0x6c, 0x68, 0x9f,
191 	},
192 };
193 
194 struct ip_reassembly_test_packet pkt_ipv6_udp_p2_f4 = {
195 	.len = 482,
196 	.l4_offset = 48,
197 	.data = {
198 		/* IP */
199 		0x60, 0x00, 0x00, 0x00, 0x01, 0xba, 0x2c, 0x40,
200 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
201 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
202 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
203 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
204 		0x11, 0x00, 0x0f, 0xa8, 0x64, 0x6c, 0x68, 0x9f,
205 	},
206 };
207 
208 struct ip_reassembly_test_packet pkt_ipv6_udp_p3 = {
209 	.len = 5782,
210 	.l4_offset = 40,
211 	.data = {
212 		/* IP */
213 		0x60, 0x00, 0x00, 0x00, 0x16, 0x6e, 0x2c, 0x40,
214 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
216 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
218 
219 		/* UDP */
220 		0x08, 0x00, 0x27, 0x10, 0x16, 0x6e, 0x2f, 0x99,
221 	},
222 };
223 
224 struct ip_reassembly_test_packet pkt_ipv6_udp_p3_f1 = {
225 	.len = 1384,
226 	.l4_offset = 48,
227 	.data = {
228 		/* IP */
229 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
230 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
232 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
233 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
234 		0x11, 0x00, 0x00, 0x01, 0x65, 0xcf, 0x5a, 0xae,
235 
236 		/* UDP */
237 		0x80, 0x00, 0x27, 0x10, 0x16, 0x6e, 0x2f, 0x99,
238 	},
239 };
240 
241 struct ip_reassembly_test_packet pkt_ipv6_udp_p3_f2 = {
242 	.len = 1384,
243 	.l4_offset = 48,
244 	.data = {
245 		/* IP */
246 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
247 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
248 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
249 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
250 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
251 		0x11, 0x00, 0x05, 0x39, 0x65, 0xcf, 0x5a, 0xae,
252 	},
253 };
254 
255 struct ip_reassembly_test_packet pkt_ipv6_udp_p3_f3 = {
256 	.len = 1384,
257 	.l4_offset = 48,
258 	.data = {
259 		/* IP */
260 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
261 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
263 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
265 		0x11, 0x00, 0x0a, 0x71, 0x65, 0xcf, 0x5a, 0xae,
266 	},
267 };
268 
269 struct ip_reassembly_test_packet pkt_ipv6_udp_p3_f4 = {
270 	.len = 1384,
271 	.l4_offset = 48,
272 	.data = {
273 		/* IP */
274 		0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
275 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
277 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
279 		0x11, 0x00, 0x0f, 0xa9, 0x65, 0xcf, 0x5a, 0xae,
280 	},
281 };
282 
283 struct ip_reassembly_test_packet pkt_ipv6_udp_p3_f5 = {
284 	.len = 446,
285 	.l4_offset = 48,
286 	.data = {
287 		/* IP */
288 		0x60, 0x00, 0x00, 0x00, 0x01, 0x96, 0x2c, 0x40,
289 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 		0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
291 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292 		0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
293 		0x11, 0x00, 0x14, 0xe0, 0x65, 0xcf, 0x5a, 0xae,
294 	},
295 };
296 
297 struct ip_reassembly_test_packet pkt_ipv4_udp_p1 = {
298 	.len = 1500,
299 	.l4_offset = 20,
300 	.data = {
301 		/* IP */
302 		0x45, 0x00, 0x05, 0xdc, 0x00, 0x01, 0x00, 0x00,
303 		0x40, 0x11, 0x66, 0x0d, 0x0d, 0x00, 0x00, 0x02,
304 		0x02, 0x00, 0x00, 0x02,
305 
306 		/* UDP */
307 		0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
308 	},
309 };
310 
311 struct ip_reassembly_test_packet pkt_ipv4_udp_p1_f1 = {
312 	.len = 1420,
313 	.l4_offset = 20,
314 	.data = {
315 		/* IP */
316 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x01, 0x20, 0x00,
317 		0x40, 0x11, 0x46, 0x5d, 0x0d, 0x00, 0x00, 0x02,
318 		0x02, 0x00, 0x00, 0x02,
319 
320 		/* UDP */
321 		0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
322 	},
323 };
324 
325 struct ip_reassembly_test_packet pkt_ipv4_udp_p1_f2 = {
326 	.len = 100,
327 	.l4_offset = 20,
328 	.data = {
329 		/* IP */
330 		0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0xaf,
331 		0x40, 0x11, 0x6a, 0xd6, 0x0d, 0x00, 0x00, 0x02,
332 		0x02, 0x00, 0x00, 0x02,
333 	},
334 };
335 
336 struct ip_reassembly_test_packet pkt_ipv4_udp_p2 = {
337 	.len = 4482,
338 	.l4_offset = 20,
339 	.data = {
340 		/* IP */
341 		0x45, 0x00, 0x11, 0x82, 0x00, 0x02, 0x00, 0x00,
342 		0x40, 0x11, 0x5a, 0x66, 0x0d, 0x00, 0x00, 0x02,
343 		0x02, 0x00, 0x00, 0x02,
344 
345 		/* UDP */
346 		0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
347 	},
348 };
349 
350 struct ip_reassembly_test_packet pkt_ipv4_udp_p2_f1 = {
351 	.len = 1420,
352 	.l4_offset = 20,
353 	.data = {
354 		/* IP */
355 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0x00,
356 		0x40, 0x11, 0x46, 0x5c, 0x0d, 0x00, 0x00, 0x02,
357 		0x02, 0x00, 0x00, 0x02,
358 
359 		/* UDP */
360 		0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
361 	},
362 };
363 
364 struct ip_reassembly_test_packet pkt_ipv4_udp_p2_f2 = {
365 	.len = 1420,
366 	.l4_offset = 20,
367 	.data = {
368 		/* IP */
369 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0xaf,
370 		0x40, 0x11, 0x45, 0xad, 0x0d, 0x00, 0x00, 0x02,
371 		0x02, 0x00, 0x00, 0x02,
372 	},
373 };
374 
375 struct ip_reassembly_test_packet pkt_ipv4_udp_p2_f3 = {
376 	.len = 1420,
377 	.l4_offset = 20,
378 	.data = {
379 		/* IP */
380 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x21, 0x5e,
381 		0x40, 0x11, 0x44, 0xfe, 0x0d, 0x00, 0x00, 0x02,
382 		0x02, 0x00, 0x00, 0x02,
383 	},
384 };
385 
386 struct ip_reassembly_test_packet pkt_ipv4_udp_p2_f4 = {
387 	.len = 282,
388 	.l4_offset = 20,
389 	.data = {
390 		/* IP */
391 		0x45, 0x00, 0x01, 0x1a, 0x00, 0x02, 0x02, 0x0d,
392 		0x40, 0x11, 0x68, 0xc1, 0x0d, 0x00, 0x00, 0x02,
393 		0x02, 0x00, 0x00, 0x02,
394 	},
395 };
396 
397 struct ip_reassembly_test_packet pkt_ipv4_udp_p3 = {
398 	.len = 5782,
399 	.l4_offset = 20,
400 	.data = {
401 		/* IP */
402 		0x45, 0x00, 0x16, 0x96, 0x00, 0x03, 0x00, 0x00,
403 		0x40, 0x11, 0x55, 0x51, 0x0d, 0x00, 0x00, 0x02,
404 		0x02, 0x00, 0x00, 0x02,
405 
406 		/* UDP */
407 		0x08, 0x00, 0x27, 0x10, 0x16, 0x82, 0xbb, 0xfd,
408 	},
409 };
410 
411 struct ip_reassembly_test_packet pkt_ipv4_udp_p3_f1 = {
412 	.len = 1420,
413 	.l4_offset = 20,
414 	.data = {
415 		/* IP */
416 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x03, 0x20, 0x00,
417 		0x40, 0x11, 0x46, 0x5b, 0x0d, 0x00, 0x00, 0x02,
418 		0x02, 0x00, 0x00, 0x02,
419 
420 		/* UDP */
421 		0x80, 0x00, 0x27, 0x10, 0x16, 0x82, 0xbb, 0xfd,
422 	},
423 };
424 
425 struct ip_reassembly_test_packet pkt_ipv4_udp_p3_f2 = {
426 	.len = 1420,
427 	.l4_offset = 20,
428 	.data = {
429 		/* IP */
430 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x03, 0x20, 0xaf,
431 		0x40, 0x11, 0x45, 0xac, 0x0d, 0x00, 0x00, 0x02,
432 		0x02, 0x00, 0x00, 0x02,
433 	},
434 };
435 
436 struct ip_reassembly_test_packet pkt_ipv4_udp_p3_f3 = {
437 	.len = 1420,
438 	.l4_offset = 20,
439 	.data = {
440 		/* IP */
441 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x03, 0x21, 0x5e,
442 		0x40, 0x11, 0x44, 0xfd, 0x0d, 0x00, 0x00, 0x02,
443 		0x02, 0x00, 0x00, 0x02,
444 	},
445 };
446 
447 struct ip_reassembly_test_packet pkt_ipv4_udp_p3_f4 = {
448 	.len = 1420,
449 	.l4_offset = 20,
450 	.data = {
451 		/* IP */
452 		0x45, 0x00, 0x05, 0x8c, 0x00, 0x03, 0x22, 0x0d,
453 		0x40, 0x11, 0x44, 0x4e, 0x0d, 0x00, 0x00, 0x02,
454 		0x02, 0x00, 0x00, 0x02,
455 	},
456 };
457 
458 struct ip_reassembly_test_packet pkt_ipv4_udp_p3_f5 = {
459 	.len = 182,
460 	.l4_offset = 20,
461 	.data = {
462 		/* IP */
463 		0x45, 0x00, 0x00, 0xb6, 0x00, 0x03, 0x02, 0xbc,
464 		0x40, 0x11, 0x68, 0x75, 0x0d, 0x00, 0x00, 0x02,
465 		0x02, 0x00, 0x00, 0x02,
466 	},
467 };
468 
469 static inline void
470 test_vector_payload_populate(struct ip_reassembly_test_packet *pkt,
471 		bool first_frag)
472 {
473 	uint32_t i = pkt->l4_offset;
474 
475 	/**
476 	 * For non-fragmented packets and first frag, skip 8 bytes from
477 	 * l4_offset for UDP header.
478 	 */
479 	if (first_frag)
480 		i += 8;
481 
482 	for (; i < pkt->len; i++)
483 		pkt->data[i] = 0x58;
484 }
485 
486 struct ipsec_test_data conf_aes_128_gcm = {
487 	.key = {
488 		.data = {
489 			0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
490 			0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
491 		},
492 	},
493 
494 	.salt = {
495 		.data = {
496 			0xca, 0xfe, 0xba, 0xbe
497 		},
498 		.len = 4,
499 	},
500 
501 	.iv = {
502 		.data = {
503 			0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88
504 		},
505 	},
506 
507 	.ipsec_xform = {
508 		.spi = 0xa5f8,
509 		.salt = 0xbebafeca,
510 		.options.esn = 0,
511 		.options.udp_encap = 0,
512 		.options.copy_dscp = 0,
513 		.options.copy_flabel = 0,
514 		.options.copy_df = 0,
515 		.options.dec_ttl = 0,
516 		.options.ecn = 0,
517 		.options.stats = 0,
518 		.options.tunnel_hdr_verify = 0,
519 		.options.ip_csum_enable = 0,
520 		.options.l4_csum_enable = 0,
521 		.options.ip_reassembly_en = 1,
522 		.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
523 		.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
524 		.mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
525 		.tunnel.type = RTE_SECURITY_IPSEC_TUNNEL_IPV4,
526 		.replay_win_sz = 0,
527 	},
528 
529 	.aead = true,
530 
531 	.xform = {
532 		.aead = {
533 			.next = NULL,
534 			.type = RTE_CRYPTO_SYM_XFORM_AEAD,
535 			.aead = {
536 				.op = RTE_CRYPTO_AEAD_OP_ENCRYPT,
537 				.algo = RTE_CRYPTO_AEAD_AES_GCM,
538 				.key.length = 16,
539 				.iv.length = 12,
540 				.iv.offset = 0,
541 				.digest_length = 16,
542 				.aad_length = 12,
543 			},
544 		},
545 	},
546 };
547 
548 struct ipsec_test_data conf_aes_128_gcm_v6_tunnel = {
549 	.key = {
550 		.data = {
551 			0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
552 			0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
553 		},
554 	},
555 
556 	.salt = {
557 		.data = {
558 			0xca, 0xfe, 0xba, 0xbe
559 		},
560 		.len = 4,
561 	},
562 
563 	.iv = {
564 		.data = {
565 			0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88
566 		},
567 	},
568 
569 	.ipsec_xform = {
570 		.spi = 0xa5f8,
571 		.salt = 0xbebafeca,
572 		.options.esn = 0,
573 		.options.udp_encap = 0,
574 		.options.copy_dscp = 0,
575 		.options.copy_flabel = 0,
576 		.options.copy_df = 0,
577 		.options.dec_ttl = 0,
578 		.options.ecn = 0,
579 		.options.stats = 0,
580 		.options.tunnel_hdr_verify = 0,
581 		.options.ip_csum_enable = 0,
582 		.options.l4_csum_enable = 0,
583 		.options.ip_reassembly_en = 1,
584 		.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
585 		.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
586 		.mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
587 		.tunnel.type = RTE_SECURITY_IPSEC_TUNNEL_IPV4,
588 		.replay_win_sz = 0,
589 	},
590 
591 	.aead = true,
592 
593 	.xform = {
594 		.aead = {
595 			.next = NULL,
596 			.type = RTE_CRYPTO_SYM_XFORM_AEAD,
597 			.aead = {
598 				.op = RTE_CRYPTO_AEAD_OP_ENCRYPT,
599 				.algo = RTE_CRYPTO_AEAD_AES_GCM,
600 				.key.length = 16,
601 				.iv.length = 12,
602 				.iv.offset = 0,
603 				.digest_length = 16,
604 				.aad_length = 12,
605 			},
606 		},
607 	},
608 };
609 
610 const struct reassembly_vector ipv4_2frag_vector = {
611 	.sa_data = &conf_aes_128_gcm,
612 	.full_pkt = &pkt_ipv4_udp_p1,
613 	.frags[0] = &pkt_ipv4_udp_p1_f1,
614 	.frags[1] = &pkt_ipv4_udp_p1_f2,
615 	.nb_frags = 2,
616 	.burst = false,
617 };
618 
619 const struct reassembly_vector ipv6_2frag_vector = {
620 	.sa_data = &conf_aes_128_gcm_v6_tunnel,
621 	.full_pkt = &pkt_ipv6_udp_p1,
622 	.frags[0] = &pkt_ipv6_udp_p1_f1,
623 	.frags[1] = &pkt_ipv6_udp_p1_f2,
624 	.nb_frags = 2,
625 	.burst = false,
626 };
627 
628 const struct reassembly_vector ipv4_4frag_vector = {
629 	.sa_data = &conf_aes_128_gcm,
630 	.full_pkt = &pkt_ipv4_udp_p2,
631 	.frags[0] = &pkt_ipv4_udp_p2_f1,
632 	.frags[1] = &pkt_ipv4_udp_p2_f2,
633 	.frags[2] = &pkt_ipv4_udp_p2_f3,
634 	.frags[3] = &pkt_ipv4_udp_p2_f4,
635 	.nb_frags = 4,
636 	.burst = false,
637 };
638 
639 const struct reassembly_vector ipv6_4frag_vector = {
640 	.sa_data = &conf_aes_128_gcm_v6_tunnel,
641 	.full_pkt = &pkt_ipv6_udp_p2,
642 	.frags[0] = &pkt_ipv6_udp_p2_f1,
643 	.frags[1] = &pkt_ipv6_udp_p2_f2,
644 	.frags[2] = &pkt_ipv6_udp_p2_f3,
645 	.frags[3] = &pkt_ipv6_udp_p2_f4,
646 	.nb_frags = 4,
647 	.burst = false,
648 };
649 const struct reassembly_vector ipv4_5frag_vector = {
650 	.sa_data = &conf_aes_128_gcm,
651 	.full_pkt = &pkt_ipv4_udp_p3,
652 	.frags[0] = &pkt_ipv4_udp_p3_f1,
653 	.frags[1] = &pkt_ipv4_udp_p3_f2,
654 	.frags[2] = &pkt_ipv4_udp_p3_f3,
655 	.frags[3] = &pkt_ipv4_udp_p3_f4,
656 	.frags[4] = &pkt_ipv4_udp_p3_f5,
657 	.nb_frags = 5,
658 	.burst = false,
659 };
660 const struct reassembly_vector ipv6_5frag_vector = {
661 	.sa_data = &conf_aes_128_gcm_v6_tunnel,
662 	.full_pkt = &pkt_ipv6_udp_p3,
663 	.frags[0] = &pkt_ipv6_udp_p3_f1,
664 	.frags[1] = &pkt_ipv6_udp_p3_f2,
665 	.frags[2] = &pkt_ipv6_udp_p3_f3,
666 	.frags[3] = &pkt_ipv6_udp_p3_f4,
667 	.frags[4] = &pkt_ipv6_udp_p3_f5,
668 	.nb_frags = 5,
669 	.burst = false,
670 };
671 /* Negative test cases. */
672 const struct reassembly_vector ipv4_incomplete_vector = {
673 	.sa_data = &conf_aes_128_gcm,
674 	.full_pkt = &pkt_ipv4_udp_p2,
675 	.frags[0] = &pkt_ipv4_udp_p2_f1,
676 	.frags[1] = &pkt_ipv4_udp_p2_f2,
677 	.nb_frags = 2,
678 	.burst = false,
679 };
680 const struct reassembly_vector ipv4_overlap_vector = {
681 	.sa_data = &conf_aes_128_gcm,
682 	.full_pkt = &pkt_ipv4_udp_p1,
683 	.frags[0] = &pkt_ipv4_udp_p1_f1,
684 	.frags[1] = &pkt_ipv4_udp_p1_f1, /* Overlap */
685 	.frags[2] = &pkt_ipv4_udp_p1_f2,
686 	.nb_frags = 3,
687 	.burst = false,
688 };
689 const struct reassembly_vector ipv4_out_of_order_vector = {
690 	.sa_data = &conf_aes_128_gcm,
691 	.full_pkt = &pkt_ipv4_udp_p2,
692 	.frags[0] = &pkt_ipv4_udp_p2_f1,
693 	.frags[1] = &pkt_ipv4_udp_p2_f3,
694 	.frags[2] = &pkt_ipv4_udp_p2_f4,
695 	.frags[3] = &pkt_ipv4_udp_p2_f2, /* out of order */
696 	.nb_frags = 4,
697 	.burst = false,
698 };
699 const struct reassembly_vector ipv4_4frag_burst_vector = {
700 	.sa_data = &conf_aes_128_gcm,
701 	.full_pkt = &pkt_ipv4_udp_p2,
702 	.frags[0] = &pkt_ipv4_udp_p2_f1,
703 	.frags[1] = &pkt_ipv4_udp_p2_f2,
704 	.frags[2] = &pkt_ipv4_udp_p2_f3,
705 	.frags[3] = &pkt_ipv4_udp_p2_f4,
706 	.nb_frags = 4,
707 	.burst = true,
708 };
709 
710 #endif
711