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