tests: Add tests for IPSec async mode using the crypto SW scheduler
[vpp.git] / test / test_ipsec_esp.py
1 import socket
2 import unittest
3 from scapy.layers.ipsec import ESP
4 from scapy.layers.inet import IP, ICMP, UDP
5 from scapy.layers.inet6 import IPv6
6 from scapy.layers.l2 import Ether
7 from scapy.packet import Raw
8
9 from parameterized import parameterized
10 from framework import VppTestRunner
11 from template_ipsec import IpsecTra46Tests, IpsecTun46Tests, TemplateIpsec, \
12     IpsecTcpTests, IpsecTun4Tests, IpsecTra4Tests, config_tra_params, \
13     config_tun_params, IPsecIPv4Params, IPsecIPv6Params, \
14     IpsecTra4, IpsecTun4, IpsecTra6, IpsecTun6, \
15     IpsecTun6HandoffTests, IpsecTun4HandoffTests, \
16     IpsecTra6ExtTests
17 from vpp_ipsec import VppIpsecSpd, VppIpsecSpdEntry, VppIpsecSA,\
18     VppIpsecSpdItfBinding
19 from vpp_ip_route import VppIpRoute, VppRoutePath
20 from vpp_ip import DpoProto
21 from vpp_papi import VppEnum
22
23 NUM_PKTS = 67
24 engines_supporting_chain_bufs = ["openssl"]
25
26
27 class ConfigIpsecESP(TemplateIpsec):
28     encryption_type = ESP
29     tra4_encrypt_node_name = "esp4-encrypt"
30     tra4_decrypt_node_name = ["esp4-decrypt", "esp4-decrypt-post"]
31     tra6_encrypt_node_name = "esp6-encrypt"
32     tra6_decrypt_node_name = ["esp6-decrypt", "esp6-decrypt-post"]
33     tun4_encrypt_node_name = "esp4-encrypt"
34     tun4_decrypt_node_name = ["esp4-decrypt", "esp4-decrypt-post"]
35     tun6_encrypt_node_name = "esp6-encrypt"
36     tun6_decrypt_node_name = ["esp6-decrypt", "esp6-decrypt-post"]
37
38     @classmethod
39     def setUpClass(cls):
40         super(ConfigIpsecESP, cls).setUpClass()
41
42     @classmethod
43     def tearDownClass(cls):
44         super(ConfigIpsecESP, cls).tearDownClass()
45
46     def setUp(self):
47         super(ConfigIpsecESP, self).setUp()
48
49     def tearDown(self):
50         super(ConfigIpsecESP, self).tearDown()
51
52     def config_network(self, params):
53         self.net_objs = []
54         self.tun_if = self.pg0
55         self.tra_if = self.pg2
56         self.logger.info(self.vapi.ppcli("show int addr"))
57
58         self.tra_spd = VppIpsecSpd(self, self.tra_spd_id)
59         self.tra_spd.add_vpp_config()
60         self.net_objs.append(self.tra_spd)
61         self.tun_spd = VppIpsecSpd(self, self.tun_spd_id)
62         self.tun_spd.add_vpp_config()
63         self.net_objs.append(self.tun_spd)
64
65         b = VppIpsecSpdItfBinding(self, self.tun_spd,
66                                   self.tun_if)
67         b.add_vpp_config()
68         self.net_objs.append(b)
69
70         b = VppIpsecSpdItfBinding(self, self.tra_spd,
71                                   self.tra_if)
72         b.add_vpp_config()
73         self.net_objs.append(b)
74
75         for p in params:
76             self.config_esp_tra(p)
77             config_tra_params(p, self.encryption_type)
78         for p in params:
79             self.config_esp_tun(p)
80             config_tun_params(p, self.encryption_type, self.tun_if)
81
82         for p in params:
83             d = DpoProto.DPO_PROTO_IP6 if p.is_ipv6 else DpoProto.DPO_PROTO_IP4
84             r = VppIpRoute(self,  p.remote_tun_if_host, p.addr_len,
85                            [VppRoutePath(self.tun_if.remote_addr[p.addr_type],
86                                          0xffffffff,
87                                          proto=d)])
88             r.add_vpp_config()
89             self.net_objs.append(r)
90
91         self.logger.info(self.vapi.ppcli("show ipsec all"))
92
93     def unconfig_network(self):
94         for o in reversed(self.net_objs):
95             o.remove_vpp_config()
96         self.net_objs = []
97
98     def config_esp_tun(self, params):
99         addr_type = params.addr_type
100         scapy_tun_sa_id = params.scapy_tun_sa_id
101         scapy_tun_spi = params.scapy_tun_spi
102         vpp_tun_sa_id = params.vpp_tun_sa_id
103         vpp_tun_spi = params.vpp_tun_spi
104         auth_algo_vpp_id = params.auth_algo_vpp_id
105         auth_key = params.auth_key
106         crypt_algo_vpp_id = params.crypt_algo_vpp_id
107         crypt_key = params.crypt_key
108         remote_tun_if_host = params.remote_tun_if_host
109         addr_any = params.addr_any
110         addr_bcast = params.addr_bcast
111         e = VppEnum.vl_api_ipsec_spd_action_t
112         flags = params.flags
113         tun_flags = params.tun_flags
114         salt = params.salt
115         objs = []
116
117         params.tun_sa_in = VppIpsecSA(self, scapy_tun_sa_id, scapy_tun_spi,
118                                       auth_algo_vpp_id, auth_key,
119                                       crypt_algo_vpp_id, crypt_key,
120                                       self.vpp_esp_protocol,
121                                       self.tun_if.local_addr[addr_type],
122                                       self.tun_if.remote_addr[addr_type],
123                                       tun_flags=tun_flags,
124                                       dscp=params.dscp,
125                                       flags=flags,
126                                       salt=salt,
127                                       hop_limit=params.outer_hop_limit)
128         params.tun_sa_out = VppIpsecSA(self, vpp_tun_sa_id, vpp_tun_spi,
129                                        auth_algo_vpp_id, auth_key,
130                                        crypt_algo_vpp_id, crypt_key,
131                                        self.vpp_esp_protocol,
132                                        self.tun_if.remote_addr[addr_type],
133                                        self.tun_if.local_addr[addr_type],
134                                        tun_flags=tun_flags,
135                                        dscp=params.dscp,
136                                        flags=flags,
137                                        salt=salt,
138                                        hop_limit=params.outer_hop_limit)
139         objs.append(params.tun_sa_in)
140         objs.append(params.tun_sa_out)
141
142         params.spd_policy_in_any = VppIpsecSpdEntry(self, self.tun_spd,
143                                                     scapy_tun_sa_id,
144                                                     addr_any, addr_bcast,
145                                                     addr_any, addr_bcast,
146                                                     socket.IPPROTO_ESP)
147         params.spd_policy_out_any = VppIpsecSpdEntry(self, self.tun_spd,
148                                                      scapy_tun_sa_id,
149                                                      addr_any, addr_bcast,
150                                                      addr_any, addr_bcast,
151                                                      socket.IPPROTO_ESP,
152                                                      is_outbound=0)
153         objs.append(params.spd_policy_out_any)
154         objs.append(params.spd_policy_in_any)
155
156         objs.append(VppIpsecSpdEntry(self, self.tun_spd, vpp_tun_sa_id,
157                                      remote_tun_if_host, remote_tun_if_host,
158                                      self.pg1.remote_addr[addr_type],
159                                      self.pg1.remote_addr[addr_type],
160                                      0,
161                                      priority=10,
162                                      policy=e.IPSEC_API_SPD_ACTION_PROTECT,
163                                      is_outbound=0))
164         objs.append(VppIpsecSpdEntry(self, self.tun_spd, scapy_tun_sa_id,
165                                      self.pg1.remote_addr[addr_type],
166                                      self.pg1.remote_addr[addr_type],
167                                      remote_tun_if_host, remote_tun_if_host,
168                                      0,
169                                      policy=e.IPSEC_API_SPD_ACTION_PROTECT,
170                                      priority=10))
171         objs.append(VppIpsecSpdEntry(self, self.tun_spd, vpp_tun_sa_id,
172                                      remote_tun_if_host, remote_tun_if_host,
173                                      self.pg0.local_addr[addr_type],
174                                      self.pg0.local_addr[addr_type],
175                                      0,
176                                      priority=20,
177                                      policy=e.IPSEC_API_SPD_ACTION_PROTECT,
178                                      is_outbound=0))
179         objs.append(VppIpsecSpdEntry(self, self.tun_spd, scapy_tun_sa_id,
180                                      self.pg0.local_addr[addr_type],
181                                      self.pg0.local_addr[addr_type],
182                                      remote_tun_if_host, remote_tun_if_host,
183                                      0,
184                                      policy=e.IPSEC_API_SPD_ACTION_PROTECT,
185                                      priority=20))
186         for o in objs:
187             o.add_vpp_config()
188         self.net_objs = self.net_objs + objs
189
190     def config_esp_tra(self, params):
191         addr_type = params.addr_type
192         scapy_tra_sa_id = params.scapy_tra_sa_id
193         scapy_tra_spi = params.scapy_tra_spi
194         vpp_tra_sa_id = params.vpp_tra_sa_id
195         vpp_tra_spi = params.vpp_tra_spi
196         auth_algo_vpp_id = params.auth_algo_vpp_id
197         auth_key = params.auth_key
198         crypt_algo_vpp_id = params.crypt_algo_vpp_id
199         crypt_key = params.crypt_key
200         addr_any = params.addr_any
201         addr_bcast = params.addr_bcast
202         flags = (VppEnum.vl_api_ipsec_sad_flags_t.
203                  IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY)
204         e = VppEnum.vl_api_ipsec_spd_action_t
205         flags = params.flags | flags
206         salt = params.salt
207         objs = []
208
209         params.tra_sa_in = VppIpsecSA(self, scapy_tra_sa_id, scapy_tra_spi,
210                                       auth_algo_vpp_id, auth_key,
211                                       crypt_algo_vpp_id, crypt_key,
212                                       self.vpp_esp_protocol,
213                                       flags=flags,
214                                       salt=salt)
215         params.tra_sa_out = VppIpsecSA(self, vpp_tra_sa_id, vpp_tra_spi,
216                                        auth_algo_vpp_id, auth_key,
217                                        crypt_algo_vpp_id, crypt_key,
218                                        self.vpp_esp_protocol,
219                                        flags=flags,
220                                        salt=salt)
221         objs.append(params.tra_sa_in)
222         objs.append(params.tra_sa_out)
223
224         objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id,
225                                      addr_any, addr_bcast,
226                                      addr_any, addr_bcast,
227                                      socket.IPPROTO_ESP))
228         objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id,
229                                      addr_any, addr_bcast,
230                                      addr_any, addr_bcast,
231                                      socket.IPPROTO_ESP,
232                                      is_outbound=0))
233         objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id,
234                                      self.tra_if.local_addr[addr_type],
235                                      self.tra_if.local_addr[addr_type],
236                                      self.tra_if.remote_addr[addr_type],
237                                      self.tra_if.remote_addr[addr_type],
238                                      0, priority=10,
239                                      policy=e.IPSEC_API_SPD_ACTION_PROTECT,
240                                      is_outbound=0))
241         objs.append(VppIpsecSpdEntry(self, self.tra_spd, scapy_tra_sa_id,
242                                      self.tra_if.local_addr[addr_type],
243                                      self.tra_if.local_addr[addr_type],
244                                      self.tra_if.remote_addr[addr_type],
245                                      self.tra_if.remote_addr[addr_type],
246                                      0, policy=e.IPSEC_API_SPD_ACTION_PROTECT,
247                                      priority=10))
248         for o in objs:
249             o.add_vpp_config()
250         self.net_objs = self.net_objs + objs
251
252
253 class TemplateIpsecEsp(ConfigIpsecESP):
254     """
255     Basic test for ipsec esp sanity - tunnel and transport modes.
256
257     Below 4 cases are covered as part of this test
258     1) ipsec esp v4 transport basic test  - IPv4 Transport mode
259         scenario using HMAC-SHA1-96 integrity algo
260     2) ipsec esp v4 transport burst test
261         Above test for 257 pkts
262     3) ipsec esp 4o4 tunnel basic test    - IPv4 Tunnel mode
263         scenario using HMAC-SHA1-96 integrity algo
264     4) ipsec esp 4o4 tunnel burst test
265         Above test for 257 pkts
266
267     TRANSPORT MODE:
268
269      ---   encrypt   ---
270     |pg2| <-------> |VPP|
271      ---   decrypt   ---
272
273     TUNNEL MODE:
274
275      ---   encrypt   ---   plain   ---
276     |pg0| <-------  |VPP| <------ |pg1|
277      ---             ---           ---
278
279      ---   decrypt   ---   plain   ---
280     |pg0| ------->  |VPP| ------> |pg1|
281      ---             ---           ---
282     """
283
284     @classmethod
285     def setUpClass(cls):
286         super(TemplateIpsecEsp, cls).setUpClass()
287
288     @classmethod
289     def tearDownClass(cls):
290         super(TemplateIpsecEsp, cls).tearDownClass()
291
292     def setUp(self):
293         super(TemplateIpsecEsp, self).setUp()
294         self.config_network(self.params.values())
295
296     def tearDown(self):
297         self.unconfig_network()
298         super(TemplateIpsecEsp, self).tearDown()
299
300
301 class TestIpsecEsp1(TemplateIpsecEsp, IpsecTra46Tests,
302                     IpsecTun46Tests, IpsecTra6ExtTests):
303     """ Ipsec ESP - TUN & TRA tests """
304
305     @classmethod
306     def setUpClass(cls):
307         super(TestIpsecEsp1, cls).setUpClass()
308
309     @classmethod
310     def tearDownClass(cls):
311         super(TestIpsecEsp1, cls).tearDownClass()
312
313     def setUp(self):
314         super(TestIpsecEsp1, self).setUp()
315
316     def tearDown(self):
317         super(TestIpsecEsp1, self).tearDown()
318
319     def test_tun_46(self):
320         """ ipsec 4o6 tunnel """
321         # add an SPD entry to direct 2.2.2.2 to the v6 tunnel SA
322         p6 = self.ipv6_params
323         p4 = self.ipv4_params
324
325         p6.remote_tun_if_host4 = "2.2.2.2"
326         e = VppEnum.vl_api_ipsec_spd_action_t
327
328         VppIpsecSpdEntry(self,
329                          self.tun_spd,
330                          p6.scapy_tun_sa_id,
331                          self.pg1.remote_addr[p4.addr_type],
332                          self.pg1.remote_addr[p4.addr_type],
333                          p6.remote_tun_if_host4,
334                          p6.remote_tun_if_host4,
335                          0,
336                          priority=10,
337                          policy=e.IPSEC_API_SPD_ACTION_PROTECT,
338                          is_outbound=1).add_vpp_config()
339         VppIpRoute(self,  p6.remote_tun_if_host4, p4.addr_len,
340                    [VppRoutePath(self.tun_if.remote_addr[p4.addr_type],
341                                  0xffffffff)]).add_vpp_config()
342
343         old_name = self.tun6_encrypt_node_name
344         self.tun6_encrypt_node_name = "esp4-encrypt"
345
346         self.verify_tun_46(p6, count=63)
347         self.tun6_encrypt_node_name = old_name
348
349     def test_tun_64(self):
350         """ ipsec 6o4 tunnel """
351         # add an SPD entry to direct 4444::4 to the v4 tunnel SA
352         p6 = self.ipv6_params
353         p4 = self.ipv4_params
354
355         p4.remote_tun_if_host6 = "4444::4"
356         e = VppEnum.vl_api_ipsec_spd_action_t
357
358         VppIpsecSpdEntry(self,
359                          self.tun_spd,
360                          p4.scapy_tun_sa_id,
361                          self.pg1.remote_addr[p6.addr_type],
362                          self.pg1.remote_addr[p6.addr_type],
363                          p4.remote_tun_if_host6,
364                          p4.remote_tun_if_host6,
365                          0,
366                          priority=10,
367                          policy=e.IPSEC_API_SPD_ACTION_PROTECT,
368                          is_outbound=1).add_vpp_config()
369         d = DpoProto.DPO_PROTO_IP6
370         VppIpRoute(self,  p4.remote_tun_if_host6, p6.addr_len,
371                    [VppRoutePath(self.tun_if.remote_addr[p6.addr_type],
372                                  0xffffffff,
373                                  proto=d)]).add_vpp_config()
374
375         old_name = self.tun4_encrypt_node_name
376         self.tun4_encrypt_node_name = "esp6-encrypt"
377         self.verify_tun_64(p4, count=63)
378         self.tun4_encrypt_node_name = old_name
379
380
381 class TestIpsecEspTun(TemplateIpsecEsp, IpsecTun46Tests):
382     """ Ipsec ESP - TUN encap tests """
383
384     def setUp(self):
385         self.ipv4_params = IPsecIPv4Params()
386         self.ipv6_params = IPsecIPv6Params()
387
388         c = (VppEnum.vl_api_tunnel_encap_decap_flags_t.
389              TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
390         c1 = c | (VppEnum.vl_api_tunnel_encap_decap_flags_t.
391                   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
392
393         self.ipv4_params.tun_flags = c
394         self.ipv6_params.tun_flags = c1
395
396         super(TestIpsecEspTun, self).setUp()
397
398     def gen_pkts(self, sw_intf, src, dst, count=1, payload_size=54):
399         # set the DSCP + ECN - flags are set to copy only DSCP
400         return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) /
401                 IP(src=src, dst=dst, tos=5) /
402                 UDP(sport=4444, dport=4444) /
403                 Raw(b'X' * payload_size)
404                 for i in range(count)]
405
406     def gen_pkts6(self, p, sw_intf, src, dst, count=1, payload_size=54):
407         # set the DSCP + ECN - flags are set to copy both
408         return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) /
409                 IPv6(src=src, dst=dst, tc=5) /
410                 UDP(sport=4444, dport=4444) /
411                 Raw(b'X' * payload_size)
412                 for i in range(count)]
413
414     def verify_encrypted(self, p, sa, rxs):
415         # just check that only the DSCP is copied
416         for rx in rxs:
417             self.assertEqual(rx[IP].tos, 4)
418
419     def verify_encrypted6(self, p, sa, rxs):
420         # just check that the DSCP & ECN are copied
421         for rx in rxs:
422             self.assertEqual(rx[IPv6].tc, 5)
423
424
425 class TestIpsecEspTun2(TemplateIpsecEsp, IpsecTun46Tests):
426     """ Ipsec ESP - TUN DSCP tests """
427
428     def setUp(self):
429         self.ipv4_params = IPsecIPv4Params()
430         self.ipv6_params = IPsecIPv6Params()
431
432         self.ipv4_params.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_EF
433         self.ipv6_params.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_AF11
434
435         super(TestIpsecEspTun2, self).setUp()
436
437     def gen_pkts(self, sw_intf, src, dst, count=1, payload_size=54):
438         return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) /
439                 IP(src=src, dst=dst) /
440                 UDP(sport=4444, dport=4444) /
441                 Raw(b'X' * payload_size)
442                 for i in range(count)]
443
444     def gen_pkts6(self, p, sw_intf, src, dst, count=1, payload_size=54):
445         return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) /
446                 IPv6(src=src, dst=dst) /
447                 UDP(sport=4444, dport=4444) /
448                 Raw(b'X' * payload_size)
449                 for i in range(count)]
450
451     def verify_encrypted(self, p, sa, rxs):
452         # just check that only the DSCP is set
453         for rx in rxs:
454             self.assertEqual(rx[IP].tos,
455                              VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_EF << 2)
456
457     def verify_encrypted6(self, p, sa, rxs):
458         # just check that the DSCP is set
459         for rx in rxs:
460             self.assertEqual(rx[IPv6].tc,
461                              VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_AF11 << 2)
462
463
464 class TestIpsecEsp2(TemplateIpsecEsp, IpsecTcpTests):
465     """ Ipsec ESP - TCP tests """
466     pass
467
468
469 class TestIpsecEspHandoff(TemplateIpsecEsp,
470                           IpsecTun6HandoffTests,
471                           IpsecTun4HandoffTests):
472     """ Ipsec ESP - handoff tests """
473     pass
474
475
476 class TemplateIpsecEspUdp(ConfigIpsecESP):
477     """
478     UDP encapped ESP
479     """
480
481     @classmethod
482     def setUpClass(cls):
483         super(TemplateIpsecEspUdp, cls).setUpClass()
484
485     @classmethod
486     def tearDownClass(cls):
487         super(TemplateIpsecEspUdp, cls).tearDownClass()
488
489     def setUp(self):
490         super(TemplateIpsecEspUdp, self).setUp()
491         self.net_objs = []
492         self.tun_if = self.pg0
493         self.tra_if = self.pg2
494         self.logger.info(self.vapi.ppcli("show int addr"))
495
496         p = self.ipv4_params
497         p.flags = (VppEnum.vl_api_ipsec_sad_flags_t.
498                    IPSEC_API_SAD_FLAG_UDP_ENCAP)
499         p.nat_header = UDP(sport=5454, dport=4500)
500
501         self.tra_spd = VppIpsecSpd(self, self.tra_spd_id)
502         self.tra_spd.add_vpp_config()
503         VppIpsecSpdItfBinding(self, self.tra_spd,
504                               self.tra_if).add_vpp_config()
505
506         self.config_esp_tra(p)
507         config_tra_params(p, self.encryption_type)
508
509         self.tun_spd = VppIpsecSpd(self, self.tun_spd_id)
510         self.tun_spd.add_vpp_config()
511         VppIpsecSpdItfBinding(self, self.tun_spd,
512                               self.tun_if).add_vpp_config()
513
514         self.config_esp_tun(p)
515         self.logger.info(self.vapi.ppcli("show ipsec all"))
516
517         d = DpoProto.DPO_PROTO_IP4
518         VppIpRoute(self,  p.remote_tun_if_host, p.addr_len,
519                    [VppRoutePath(self.tun_if.remote_addr[p.addr_type],
520                                  0xffffffff,
521                                  proto=d)]).add_vpp_config()
522
523     def tearDown(self):
524         super(TemplateIpsecEspUdp, self).tearDown()
525
526     def show_commands_at_teardown(self):
527         self.logger.info(self.vapi.cli("show hardware"))
528
529
530 class TestIpsecEspUdp(TemplateIpsecEspUdp, IpsecTra4Tests):
531     """ Ipsec NAT-T ESP UDP tests """
532     pass
533
534
535 class MyParameters():
536     def __init__(self):
537         self.engines = ["ia32", "ipsecmb", "openssl"]
538         flag_esn = VppEnum.vl_api_ipsec_sad_flags_t.IPSEC_API_SAD_FLAG_USE_ESN
539         self.flags = [0, flag_esn]
540         # foreach crypto algorithm
541         self.algos = {
542             'AES-GCM-128/NONE': {
543                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
544                                  IPSEC_API_CRYPTO_ALG_AES_GCM_128),
545                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
546                                 IPSEC_API_INTEG_ALG_NONE),
547                   'scapy-crypto': "AES-GCM",
548                   'scapy-integ': "NULL",
549                   'key': b"JPjyOWBeVEQiMe7h",
550                   'salt': 0},
551             'AES-GCM-192/NONE': {
552                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
553                                  IPSEC_API_CRYPTO_ALG_AES_GCM_192),
554                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
555                                 IPSEC_API_INTEG_ALG_NONE),
556                   'scapy-crypto': "AES-GCM",
557                   'scapy-integ': "NULL",
558                   'key': b"JPjyOWBeVEQiMe7h01234567",
559                   'salt': 1010},
560             'AES-GCM-256/NONE': {
561                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
562                                  IPSEC_API_CRYPTO_ALG_AES_GCM_256),
563                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
564                                 IPSEC_API_INTEG_ALG_NONE),
565                   'scapy-crypto': "AES-GCM",
566                   'scapy-integ': "NULL",
567                   'key': b"JPjyOWBeVEQiMe7h0123456787654321",
568                   'salt': 2020},
569             'AES-CBC-128/MD5-96': {
570                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
571                                  IPSEC_API_CRYPTO_ALG_AES_CBC_128),
572                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
573                                 IPSEC_API_INTEG_ALG_MD5_96),
574                   'scapy-crypto': "AES-CBC",
575                   'scapy-integ': "HMAC-MD5-96",
576                   'salt': 0,
577                   'key': b"JPjyOWBeVEQiMe7h"},
578             'AES-CBC-192/SHA1-96': {
579                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
580                                  IPSEC_API_CRYPTO_ALG_AES_CBC_192),
581                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
582                                 IPSEC_API_INTEG_ALG_SHA1_96),
583                   'scapy-crypto': "AES-CBC",
584                   'scapy-integ': "HMAC-SHA1-96",
585                   'salt': 0,
586                   'key': b"JPjyOWBeVEQiMe7hJPjyOWBe"},
587             'AES-CBC-256/SHA1-96': {
588                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
589                                  IPSEC_API_CRYPTO_ALG_AES_CBC_256),
590                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
591                                 IPSEC_API_INTEG_ALG_SHA1_96),
592                   'scapy-crypto': "AES-CBC",
593                   'scapy-integ': "HMAC-SHA1-96",
594                   'salt': 0,
595                   'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"},
596             '3DES-CBC/SHA1-96': {
597                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
598                                  IPSEC_API_CRYPTO_ALG_3DES_CBC),
599                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
600                                 IPSEC_API_INTEG_ALG_SHA1_96),
601                   'scapy-crypto': "3DES",
602                   'scapy-integ': "HMAC-SHA1-96",
603                   'salt': 0,
604                   'key': b"JPjyOWBeVEQiMe7h00112233"},
605             'NONE/SHA1-96': {
606                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
607                                  IPSEC_API_CRYPTO_ALG_NONE),
608                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
609                                 IPSEC_API_INTEG_ALG_SHA1_96),
610                   'scapy-crypto': "NULL",
611                   'scapy-integ': "HMAC-SHA1-96",
612                   'salt': 0,
613                   'key': b"JPjyOWBeVEQiMe7h00112233"},
614             'AES-CTR-128/SHA1-96': {
615                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
616                                  IPSEC_API_CRYPTO_ALG_AES_CTR_128),
617                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
618                                 IPSEC_API_INTEG_ALG_SHA1_96),
619                   'scapy-crypto': "AES-CTR",
620                   'scapy-integ': "HMAC-SHA1-96",
621                   'salt': 0,
622                   'key': b"JPjyOWBeVEQiMe7h"},
623             'AES-CTR-192/SHA1-96': {
624                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
625                                  IPSEC_API_CRYPTO_ALG_AES_CTR_192),
626                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
627                                 IPSEC_API_INTEG_ALG_SHA1_96),
628                   'scapy-crypto': "AES-CTR",
629                   'scapy-integ': "HMAC-SHA1-96",
630                   'salt': 1010,
631                   'key': b"JPjyOWBeVEQiMe7hJPjyOWBe"},
632             'AES-CTR-256/SHA1-96': {
633                   'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
634                                  IPSEC_API_CRYPTO_ALG_AES_CTR_256),
635                   'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
636                                 IPSEC_API_INTEG_ALG_SHA1_96),
637                   'scapy-crypto': "AES-CTR",
638                   'scapy-integ': "HMAC-SHA1-96",
639                   'salt': 2020,
640                   'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"}}
641
642
643 class RunTestIpsecEspAll(ConfigIpsecESP,
644                          IpsecTra4, IpsecTra6,
645                          IpsecTun4, IpsecTun6):
646     """ Ipsec ESP all Algos """
647
648     @classmethod
649     def setUpConstants(cls):
650         test_args = str.split(cls.__doc__, " ")
651         engine = test_args[0]
652         if engine == "async":
653             cls.worker_config = "workers 2"
654         super(RunTestIpsecEspAll, cls).setUpConstants()
655
656     def setUp(self):
657         super(RunTestIpsecEspAll, self).setUp()
658         test_args = str.split(self.__doc__, " ")
659
660         params = MyParameters()
661         self.engine = test_args[0]
662         self.flag = params.flags[0]
663         if test_args[1] == 'ESN':
664             self.flag = params.flags[1]
665
666         self.algo = params.algos[test_args[2]]
667         self.async_mode = False
668         if self.engine == "async":
669             self.async_mode = True
670
671     def tearDown(self):
672         super(RunTestIpsecEspAll, self).tearDown()
673
674     def run_test(self):
675         self.run_a_test(self.engine, self.flag, self.algo)
676
677     def run_a_test(self, engine, flag, algo, payload_size=None):
678         if self.async_mode:
679             self.vapi.cli("set ipsec async mode on")
680         else:
681             self.vapi.cli("set crypto handler all %s" % engine)
682
683         self.logger.info(self.vapi.cli("show crypto async status"))
684         self.ipv4_params = IPsecIPv4Params()
685         self.ipv6_params = IPsecIPv6Params()
686
687         self.params = {self.ipv4_params.addr_type:
688                        self.ipv4_params,
689                        self.ipv6_params.addr_type:
690                        self.ipv6_params}
691
692         for _, p in self.params.items():
693             p.auth_algo_vpp_id = algo['vpp-integ']
694             p.crypt_algo_vpp_id = algo['vpp-crypto']
695             p.crypt_algo = algo['scapy-crypto']
696             p.auth_algo = algo['scapy-integ']
697             p.crypt_key = algo['key']
698             p.salt = algo['salt']
699             p.flags = p.flags | flag
700             p.outer_flow_label = 243224
701             p.async_mode = self.async_mode
702
703         self.reporter.send_keep_alive(self)
704
705         #
706         # configure the SPDs. SAs, etc
707         #
708         self.config_network(self.params.values())
709
710         #
711         # run some traffic.
712         #  An exhautsive 4o6, 6o4 is not necessary
713         #  for each algo
714         #
715         self.verify_tra_basic6(count=NUM_PKTS)
716         self.verify_tra_basic4(count=NUM_PKTS)
717         self.verify_tun_66(self.params[socket.AF_INET6],
718                            count=NUM_PKTS)
719         #
720         # Use an odd-byte payload size to check for correct padding.
721         #
722         # 49 + 2 == 51 which should pad +1 to 52 for 4 byte alignment, +5
723         # to 56 for 8 byte alignment, and +13 to 64 for 64 byte alignment.
724         # This should catch bugs where the code is incorrectly over-padding
725         # for algorithms that don't require it
726         psz = 49 - len(IP()/ICMP()) if payload_size is None else payload_size
727         self.verify_tun_44(self.params[socket.AF_INET],
728                            count=NUM_PKTS, payload_size=psz)
729
730         LARGE_PKT_SZ = [
731             1970,  # results in 2 chained buffers entering decrypt node
732                    # but leaving as simple buffer due to ICV removal (tra4)
733             2004,  # footer+ICV will be added to 2nd buffer (tun4)
734             4010,  # ICV ends up splitted accross 2 buffers in esp_decrypt
735                    # for transport4; transport6 takes normal path
736             4020,  # same as above but tra4 and tra6 are switched
737         ]
738         if self.engine in engines_supporting_chain_bufs:
739             for sz in LARGE_PKT_SZ:
740                 self.verify_tra_basic4(count=NUM_PKTS, payload_size=sz)
741                 self.verify_tra_basic6(count=NUM_PKTS, payload_size=sz)
742                 self.verify_tun_66(self.params[socket.AF_INET6],
743                                    count=NUM_PKTS, payload_size=sz)
744                 self.verify_tun_44(self.params[socket.AF_INET],
745                                    count=NUM_PKTS, payload_size=sz)
746
747         #
748         # remove the SPDs, SAs, etc
749         #
750         self.unconfig_network()
751
752         #
753         # reconfigure the network and SA to run the
754         # anti replay tests
755         #
756         self.config_network(self.params.values())
757         self.verify_tra_anti_replay()
758         self.unconfig_network()
759
760 #
761 # To generate test classes, do:
762 #   grep '# GEN' test_ipsec_esp.py | sed -e 's/# GEN //g' | bash
763 #
764 # GEN for ENG in native ipsecmb openssl; do \
765 # GEN   for FLG in noESN ESN; do for ALG in AES-GCM-128/NONE \
766 # GEN     AES-GCM-192/NONE AES-GCM-256/NONE AES-CBC-128/MD5-96 \
767 # GEN     AES-CBC-192/SHA1-96 AES-CBC-256/SHA1-96 \
768 # GEN     3DES-CBC/SHA1-96 NONE/SHA1-96 \
769 # GEN     AES-CTR-128/SHA1-96 AES-CTR-192/SHA1-96 AES-CTR-256/SHA1-96; do \
770 # GEN      [[ ${FLG} == "ESN" &&  ${ALG} == *"NONE" ]] && continue
771 # GEN      echo -e "\n\nclass Test_${ENG}_${FLG}_${ALG}(RunTestIpsecEspAll):" |
772 # GEN             sed -e 's/-/_/g' -e 's#/#_#g' ; \
773 # GEN      echo '    """'$ENG $FLG $ALG IPSec test'"""' ;
774 # GEN      echo "    def test_ipsec(self):";
775 # GEN      echo "        self.run_test()";
776 # GEN done; done; done
777 #
778 # GEN   for FLG in noESN ESN; do for ALG in \
779 # GEN     AES-GCM-128/NONE AES-GCM-192/NONE AES-GCM-256/NONE \
780 # GEN     AES-CBC-192/SHA1-96 AES-CBC-256/SHA1-96; do \
781 # GEN      [[ ${FLG} == "ESN" &&  ${ALG} == *"NONE" ]] && continue
782 # GEN      echo -e "\n\nclass Test_async_${FLG}_${ALG}(RunTestIpsecEspAll):" |
783 # GEN             sed -e 's/-/_/g' -e 's#/#_#g' ; \
784 # GEN      echo '    """'async $FLG $ALG IPSec test'"""' ;
785 # GEN      echo "    def test_ipsec(self):";
786 # GEN      echo "        self.run_test()";
787 # GEN done; done;
788
789
790 class Test_native_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
791     """native noESN AES-GCM-128/NONE IPSec test"""
792     def test_ipsec(self):
793         self.run_test()
794
795
796 class Test_native_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
797     """native noESN AES-GCM-192/NONE IPSec test"""
798     def test_ipsec(self):
799         self.run_test()
800
801
802 class Test_native_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
803     """native noESN AES-GCM-256/NONE IPSec test"""
804     def test_ipsec(self):
805         self.run_test()
806
807
808 class Test_native_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
809     """native noESN AES-CBC-128/MD5-96 IPSec test"""
810     def test_ipsec(self):
811         self.run_test()
812
813
814 class Test_native_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
815     """native noESN AES-CBC-192/SHA1-96 IPSec test"""
816     def test_ipsec(self):
817         self.run_test()
818
819
820 class Test_native_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
821     """native noESN AES-CBC-256/SHA1-96 IPSec test"""
822     def test_ipsec(self):
823         self.run_test()
824
825
826 class Test_native_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
827     """native noESN 3DES-CBC/SHA1-96 IPSec test"""
828     def test_ipsec(self):
829         self.run_test()
830
831
832 class Test_native_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
833     """native noESN NONE/SHA1-96 IPSec test"""
834     def test_ipsec(self):
835         self.run_test()
836
837
838 class Test_native_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
839     """native noESN AES-CTR-128/SHA1-96 IPSec test"""
840     def test_ipsec(self):
841         self.run_test()
842
843
844 class Test_native_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
845     """native noESN AES-CTR-192/SHA1-96 IPSec test"""
846     def test_ipsec(self):
847         self.run_test()
848
849
850 class Test_native_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
851     """native noESN AES-CTR-256/SHA1-96 IPSec test"""
852     def test_ipsec(self):
853         self.run_test()
854
855
856 class Test_native_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
857     """native ESN AES-CBC-128/MD5-96 IPSec test"""
858     def test_ipsec(self):
859         self.run_test()
860
861
862 class Test_native_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
863     """native ESN AES-CBC-192/SHA1-96 IPSec test"""
864     def test_ipsec(self):
865         self.run_test()
866
867
868 class Test_native_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
869     """native ESN AES-CBC-256/SHA1-96 IPSec test"""
870     def test_ipsec(self):
871         self.run_test()
872
873
874 class Test_native_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
875     """native ESN 3DES-CBC/SHA1-96 IPSec test"""
876     def test_ipsec(self):
877         self.run_test()
878
879
880 class Test_native_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
881     """native ESN NONE/SHA1-96 IPSec test"""
882     def test_ipsec(self):
883         self.run_test()
884
885
886 class Test_native_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
887     """native ESN AES-CTR-128/SHA1-96 IPSec test"""
888     def test_ipsec(self):
889         self.run_test()
890
891
892 class Test_native_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
893     """native ESN AES-CTR-192/SHA1-96 IPSec test"""
894     def test_ipsec(self):
895         self.run_test()
896
897
898 class Test_native_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
899     """native ESN AES-CTR-256/SHA1-96 IPSec test"""
900     def test_ipsec(self):
901         self.run_test()
902
903
904 class Test_ipsecmb_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
905     """ipsecmb noESN AES-GCM-128/NONE IPSec test"""
906     def test_ipsec(self):
907         self.run_test()
908
909
910 class Test_ipsecmb_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
911     """ipsecmb noESN AES-GCM-192/NONE IPSec test"""
912     def test_ipsec(self):
913         self.run_test()
914
915
916 class Test_ipsecmb_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
917     """ipsecmb noESN AES-GCM-256/NONE IPSec test"""
918     def test_ipsec(self):
919         self.run_test()
920
921
922 class Test_ipsecmb_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
923     """ipsecmb noESN AES-CBC-128/MD5-96 IPSec test"""
924     def test_ipsec(self):
925         self.run_test()
926
927
928 class Test_ipsecmb_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
929     """ipsecmb noESN AES-CBC-192/SHA1-96 IPSec test"""
930     def test_ipsec(self):
931         self.run_test()
932
933
934 class Test_ipsecmb_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
935     """ipsecmb noESN AES-CBC-256/SHA1-96 IPSec test"""
936     def test_ipsec(self):
937         self.run_test()
938
939
940 class Test_ipsecmb_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
941     """ipsecmb noESN 3DES-CBC/SHA1-96 IPSec test"""
942     def test_ipsec(self):
943         self.run_test()
944
945
946 class Test_ipsecmb_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
947     """ipsecmb noESN NONE/SHA1-96 IPSec test"""
948     def test_ipsec(self):
949         self.run_test()
950
951
952 class Test_ipsecmb_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
953     """ipsecmb noESN AES-CTR-128/SHA1-96 IPSec test"""
954     def test_ipsec(self):
955         self.run_test()
956
957
958 class Test_ipsecmb_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
959     """ipsecmb noESN AES-CTR-192/SHA1-96 IPSec test"""
960     def test_ipsec(self):
961         self.run_test()
962
963
964 class Test_ipsecmb_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
965     """ipsecmb noESN AES-CTR-256/SHA1-96 IPSec test"""
966     def test_ipsec(self):
967         self.run_test()
968
969
970 class Test_ipsecmb_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
971     """ipsecmb ESN AES-CBC-128/MD5-96 IPSec test"""
972     def test_ipsec(self):
973         self.run_test()
974
975
976 class Test_ipsecmb_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
977     """ipsecmb ESN AES-CBC-192/SHA1-96 IPSec test"""
978     def test_ipsec(self):
979         self.run_test()
980
981
982 class Test_ipsecmb_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
983     """ipsecmb ESN AES-CBC-256/SHA1-96 IPSec test"""
984     def test_ipsec(self):
985         self.run_test()
986
987
988 class Test_ipsecmb_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
989     """ipsecmb ESN 3DES-CBC/SHA1-96 IPSec test"""
990     def test_ipsec(self):
991         self.run_test()
992
993
994 class Test_ipsecmb_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
995     """ipsecmb ESN NONE/SHA1-96 IPSec test"""
996     def test_ipsec(self):
997         self.run_test()
998
999
1000 class Test_ipsecmb_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
1001     """ipsecmb ESN AES-CTR-128/SHA1-96 IPSec test"""
1002     def test_ipsec(self):
1003         self.run_test()
1004
1005
1006 class Test_ipsecmb_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
1007     """ipsecmb ESN AES-CTR-192/SHA1-96 IPSec test"""
1008     def test_ipsec(self):
1009         self.run_test()
1010
1011
1012 class Test_ipsecmb_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
1013     """ipsecmb ESN AES-CTR-256/SHA1-96 IPSec test"""
1014     def test_ipsec(self):
1015         self.run_test()
1016
1017
1018 class Test_openssl_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
1019     """openssl noESN AES-GCM-128/NONE IPSec test"""
1020     def test_ipsec(self):
1021         self.run_test()
1022
1023
1024 class Test_openssl_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
1025     """openssl noESN AES-GCM-192/NONE IPSec test"""
1026     def test_ipsec(self):
1027         self.run_test()
1028
1029
1030 class Test_openssl_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
1031     """openssl noESN AES-GCM-256/NONE IPSec test"""
1032     def test_ipsec(self):
1033         self.run_test()
1034
1035
1036 class Test_openssl_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
1037     """openssl noESN AES-CBC-128/MD5-96 IPSec test"""
1038     def test_ipsec(self):
1039         self.run_test()
1040
1041
1042 class Test_openssl_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
1043     """openssl noESN AES-CBC-192/SHA1-96 IPSec test"""
1044     def test_ipsec(self):
1045         self.run_test()
1046
1047
1048 class Test_openssl_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
1049     """openssl noESN AES-CBC-256/SHA1-96 IPSec test"""
1050     def test_ipsec(self):
1051         self.run_test()
1052
1053
1054 class Test_openssl_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
1055     """openssl noESN 3DES-CBC/SHA1-96 IPSec test"""
1056     def test_ipsec(self):
1057         self.run_test()
1058
1059
1060 class Test_openssl_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
1061     """openssl noESN NONE/SHA1-96 IPSec test"""
1062     def test_ipsec(self):
1063         self.run_test()
1064
1065
1066 class Test_openssl_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
1067     """openssl noESN AES-CTR-128/SHA1-96 IPSec test"""
1068     def test_ipsec(self):
1069         self.run_test()
1070
1071
1072 class Test_openssl_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
1073     """openssl noESN AES-CTR-192/SHA1-96 IPSec test"""
1074     def test_ipsec(self):
1075         self.run_test()
1076
1077
1078 class Test_openssl_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
1079     """openssl noESN AES-CTR-256/SHA1-96 IPSec test"""
1080     def test_ipsec(self):
1081         self.run_test()
1082
1083
1084 class Test_openssl_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
1085     """openssl ESN AES-CBC-128/MD5-96 IPSec test"""
1086     def test_ipsec(self):
1087         self.run_test()
1088
1089
1090 class Test_openssl_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
1091     """openssl ESN AES-CBC-192/SHA1-96 IPSec test"""
1092     def test_ipsec(self):
1093         self.run_test()
1094
1095
1096 class Test_openssl_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
1097     """openssl ESN AES-CBC-256/SHA1-96 IPSec test"""
1098     def test_ipsec(self):
1099         self.run_test()
1100
1101
1102 class Test_openssl_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
1103     """openssl ESN 3DES-CBC/SHA1-96 IPSec test"""
1104     def test_ipsec(self):
1105         self.run_test()
1106
1107
1108 class Test_openssl_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
1109     """openssl ESN NONE/SHA1-96 IPSec test"""
1110     def test_ipsec(self):
1111         self.run_test()
1112
1113
1114 class Test_openssl_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
1115     """openssl ESN AES-CTR-128/SHA1-96 IPSec test"""
1116     def test_ipsec(self):
1117         self.run_test()
1118
1119
1120 class Test_openssl_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
1121     """openssl ESN AES-CTR-192/SHA1-96 IPSec test"""
1122     def test_ipsec(self):
1123         self.run_test()
1124
1125
1126 class Test_openssl_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
1127     """openssl ESN AES-CTR-256/SHA1-96 IPSec test"""
1128     def test_ipsec(self):
1129         self.run_test()
1130
1131
1132 class Test_async_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
1133     """async noESN AES-GCM-128/NONE IPSec test"""
1134     def test_ipsec(self):
1135         self.run_test()
1136
1137
1138 class Test_async_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
1139     """async noESN AES-GCM-192/NONE IPSec test"""
1140     def test_ipsec(self):
1141         self.run_test()
1142
1143
1144 class Test_async_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
1145     """async noESN AES-GCM-256/NONE IPSec test"""
1146     def test_ipsec(self):
1147         self.run_test()
1148
1149
1150 class Test_async_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
1151     """async noESN AES-CBC-192/SHA1-96 IPSec test"""
1152     def test_ipsec(self):
1153         self.run_test()
1154
1155
1156 class Test_async_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
1157     """async noESN AES-CBC-256/SHA1-96 IPSec test"""
1158     def test_ipsec(self):
1159         self.run_test()
1160
1161
1162 class Test_async_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
1163     """async ESN AES-CBC-192/SHA1-96 IPSec test"""
1164     def test_ipsec(self):
1165         self.run_test()
1166
1167
1168 class Test_async_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
1169     """async ESN AES-CBC-256/SHA1-96 IPSec test"""
1170     def test_ipsec(self):
1171         self.run_test()