blob: 11d44049aebc6149c287d2c78c9064dc9782f6f1 [file] [log] [blame]
“mystarrocks”23f0c452017-12-11 07:11:51 -08001import socket
Klement Sekera28fb03f2018-04-17 11:36:55 +02002import unittest
Klement Sekera31da2e32018-06-24 22:49:55 +02003from scapy.layers.ipsec import ESP
Christian Hoppsfb7e7ed2019-11-03 07:02:15 -05004from scapy.layers.inet import IP, ICMP, UDP
Neale Ranns041add72020-01-02 04:06:10 +00005from scapy.layers.inet6 import IPv6
6from scapy.layers.l2 import Ether
7from scapy.packet import Raw
“mystarrocks”23f0c452017-12-11 07:11:51 -08008
Neale Ranns00625a62019-07-31 00:13:18 -07009from parameterized import parameterized
juraj.linkes11057662019-07-08 10:22:55 +020010from framework import VppTestRunner
Neale Ranns53f526b2019-02-25 14:32:02 +000011from template_ipsec import IpsecTra46Tests, IpsecTun46Tests, TemplateIpsec, \
Neale Ranns4f33c802019-04-10 12:39:10 +000012 IpsecTcpTests, IpsecTun4Tests, IpsecTra4Tests, config_tra_params, \
Neale Ranns12989b52019-09-26 16:20:19 +000013 config_tun_params, IPsecIPv4Params, IPsecIPv6Params, \
Neale Ranns4a56f4e2019-12-23 04:10:25 +000014 IpsecTra4, IpsecTun4, IpsecTra6, IpsecTun6, \
Neale Ranns02950402019-12-20 00:54:57 +000015 IpsecTun6HandoffTests, IpsecTun4HandoffTests, \
Filip Tehlarefcad1a2020-02-04 09:36:04 +000016 IpsecTra6ExtTests
Klement Sekerabf613952019-01-29 11:38:08 +010017from vpp_ipsec import VppIpsecSpd, VppIpsecSpdEntry, VppIpsecSA,\
Neale Ranns4f33c802019-04-10 12:39:10 +000018 VppIpsecSpdItfBinding
Neale Ranns311124e2019-01-24 04:52:25 -080019from vpp_ip_route import VppIpRoute, VppRoutePath
20from vpp_ip import DpoProto
Neale Ranns17dcec02019-01-09 21:22:20 -080021from vpp_papi import VppEnum
“mystarrocks”23f0c452017-12-11 07:11:51 -080022
Neale Rannsc87b66c2019-02-07 07:26:12 -080023NUM_PKTS = 67
Filip Tehlarefcad1a2020-02-04 09:36:04 +000024engines_supporting_chain_bufs = ["openssl"]
Neale Rannsc87b66c2019-02-07 07:26:12 -080025
“mystarrocks”23f0c452017-12-11 07:11:51 -080026
Neale Ranns4f33c802019-04-10 12:39:10 +000027class ConfigIpsecESP(TemplateIpsec):
28 encryption_type = ESP
29 tra4_encrypt_node_name = "esp4-encrypt"
30 tra4_decrypt_node_name = "esp4-decrypt"
31 tra6_encrypt_node_name = "esp6-encrypt"
32 tra6_decrypt_node_name = "esp6-decrypt"
33 tun4_encrypt_node_name = "esp4-encrypt"
34 tun4_decrypt_node_name = "esp4-decrypt"
35 tun6_encrypt_node_name = "esp6-encrypt"
36 tun6_decrypt_node_name = "esp6-decrypt"
Neale Ranns53f526b2019-02-25 14:32:02 +000037
Neale Ranns4f33c802019-04-10 12:39:10 +000038 @classmethod
39 def setUpClass(cls):
40 super(ConfigIpsecESP, cls).setUpClass()
Neale Ranns53f526b2019-02-25 14:32:02 +000041
Neale Ranns4f33c802019-04-10 12:39:10 +000042 @classmethod
43 def tearDownClass(cls):
44 super(ConfigIpsecESP, cls).tearDownClass()
Neale Ranns53f526b2019-02-25 14:32:02 +000045
Neale Ranns4f33c802019-04-10 12:39:10 +000046 def setUp(self):
47 super(ConfigIpsecESP, self).setUp()
Neale Ranns53f526b2019-02-25 14:32:02 +000048
Neale Ranns4f33c802019-04-10 12:39:10 +000049 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)
Neale Ranns12989b52019-09-26 16:20:19 +000080 config_tun_params(p, self.encryption_type, self.tun_if)
Neale Ranns4f33c802019-04-10 12:39:10 +000081
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,
Neale Ranns097fa662018-05-01 05:17:55 -070087 proto=d)])
Neale Ranns4f33c802019-04-10 12:39:10 +000088 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
Neale Ranns49e7ef62019-04-10 17:24:29 +0000112 flags = params.flags
Neale Ranns041add72020-01-02 04:06:10 +0000113 tun_flags = params.tun_flags
Neale Ranns80f6fd52019-04-16 02:41:34 +0000114 salt = params.salt
Neale Ranns4f33c802019-04-10 12:39:10 +0000115 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],
Neale Ranns49e7ef62019-04-10 17:24:29 +0000122 self.tun_if.remote_addr[addr_type],
Neale Ranns041add72020-01-02 04:06:10 +0000123 tun_flags=tun_flags,
124 dscp=params.dscp,
Neale Ranns80f6fd52019-04-16 02:41:34 +0000125 flags=flags,
Neale Ranns9ec846c2021-02-09 14:04:02 +0000126 salt=salt,
127 hop_limit=params.outer_hop_limit)
Neale Ranns4f33c802019-04-10 12:39:10 +0000128 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],
Neale Ranns49e7ef62019-04-10 17:24:29 +0000133 self.tun_if.local_addr[addr_type],
Neale Ranns041add72020-01-02 04:06:10 +0000134 tun_flags=tun_flags,
135 dscp=params.dscp,
Neale Ranns80f6fd52019-04-16 02:41:34 +0000136 flags=flags,
Neale Ranns9ec846c2021-02-09 14:04:02 +0000137 salt=salt,
138 hop_limit=params.outer_hop_limit)
Neale Ranns4f33c802019-04-10 12:39:10 +0000139 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
Neale Ranns80f6fd52019-04-16 02:41:34 +0000206 salt = params.salt
Neale Ranns4f33c802019-04-10 12:39:10 +0000207 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,
Neale Ranns80f6fd52019-04-16 02:41:34 +0000213 flags=flags,
214 salt=salt)
Neale Ranns4f33c802019-04-10 12:39:10 +0000215 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,
Neale Ranns80f6fd52019-04-16 02:41:34 +0000219 flags=flags,
220 salt=salt)
Neale Ranns4f33c802019-04-10 12:39:10 +0000221 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
Neale Ranns53f526b2019-02-25 14:32:02 +0000251
252
Neale Ranns4f33c802019-04-10 12:39:10 +0000253class TemplateIpsecEsp(ConfigIpsecESP):
“mystarrocks”23f0c452017-12-11 07:11:51 -0800254 """
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
Paul Vinciguerra8feeaff2019-03-27 11:25:48 -0700259 scenario using HMAC-SHA1-96 integrity algo
“mystarrocks”23f0c452017-12-11 07:11:51 -0800260 2) ipsec esp v4 transport burst test
261 Above test for 257 pkts
262 3) ipsec esp 4o4 tunnel basic test - IPv4 Tunnel mode
Paul Vinciguerra8feeaff2019-03-27 11:25:48 -0700263 scenario using HMAC-SHA1-96 integrity algo
“mystarrocks”23f0c452017-12-11 07:11:51 -0800264 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 ---
Klement Sekera4b089f22018-04-17 18:04:57 +0200276 |pg0| <------- |VPP| <------ |pg1|
“mystarrocks”23f0c452017-12-11 07:11:51 -0800277 --- --- ---
278
279 --- decrypt --- plain ---
Klement Sekera4b089f22018-04-17 18:04:57 +0200280 |pg0| -------> |VPP| ------> |pg1|
“mystarrocks”23f0c452017-12-11 07:11:51 -0800281 --- --- ---
“mystarrocks”23f0c452017-12-11 07:11:51 -0800282 """
283
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -0700284 @classmethod
285 def setUpClass(cls):
286 super(TemplateIpsecEsp, cls).setUpClass()
287
288 @classmethod
289 def tearDownClass(cls):
290 super(TemplateIpsecEsp, cls).tearDownClass()
291
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800292 def setUp(self):
293 super(TemplateIpsecEsp, self).setUp()
Neale Ranns4f33c802019-04-10 12:39:10 +0000294 self.config_network(self.params.values())
Klement Sekera611864f2018-09-26 11:19:00 +0200295
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800296 def tearDown(self):
Neale Ranns4f33c802019-04-10 12:39:10 +0000297 self.unconfig_network()
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800298 super(TemplateIpsecEsp, self).tearDown()
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800299
Klement Sekera611864f2018-09-26 11:19:00 +0200300
Neale Ranns02950402019-12-20 00:54:57 +0000301class TestIpsecEsp1(TemplateIpsecEsp, IpsecTra46Tests,
Filip Tehlarefcad1a2020-02-04 09:36:04 +0000302 IpsecTun46Tests, IpsecTra6ExtTests):
Klement Sekera31da2e32018-06-24 22:49:55 +0200303 """ Ipsec ESP - TUN & TRA tests """
Neale Rannsb1fd80f2020-05-12 13:33:56 +0000304
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
“mystarrocks”23f0c452017-12-11 07:11:51 -0800379
“mystarrocks”23f0c452017-12-11 07:11:51 -0800380
Neale Ranns041add72020-01-02 04:06:10 +0000381class 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
Neale Ranns9ec846c2021-02-09 14:04:02 +0000406 def gen_pkts6(self, p, sw_intf, src, dst, count=1, payload_size=54):
Neale Ranns041add72020-01-02 04:06:10 +0000407 # 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
425class 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):
Neale Ranns041add72020-01-02 04:06:10 +0000438 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
Neale Ranns9ec846c2021-02-09 14:04:02 +0000444 def gen_pkts6(self, p, sw_intf, src, dst, count=1, payload_size=54):
Neale Ranns041add72020-01-02 04:06:10 +0000445 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):
Neale Ranns9ec846c2021-02-09 14:04:02 +0000452 # just check that only the DSCP is set
Neale Ranns041add72020-01-02 04:06:10 +0000453 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):
Neale Ranns9ec846c2021-02-09 14:04:02 +0000458 # just check that the DSCP is set
Neale Ranns041add72020-01-02 04:06:10 +0000459 for rx in rxs:
460 self.assertEqual(rx[IPv6].tc,
461 VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_AF11 << 2)
462
463
Klement Sekera31da2e32018-06-24 22:49:55 +0200464class TestIpsecEsp2(TemplateIpsecEsp, IpsecTcpTests):
465 """ Ipsec ESP - TCP tests """
466 pass
“mystarrocks”23f0c452017-12-11 07:11:51 -0800467
468
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000469class TestIpsecEspHandoff(TemplateIpsecEsp,
470 IpsecTun6HandoffTests,
471 IpsecTun4HandoffTests):
472 """ Ipsec ESP - handoff tests """
473 pass
474
475
Neale Ranns4f33c802019-04-10 12:39:10 +0000476class TemplateIpsecEspUdp(ConfigIpsecESP):
Neale Ranns53f526b2019-02-25 14:32:02 +0000477 """
478 UDP encapped ESP
479 """
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -0700480
481 @classmethod
482 def setUpClass(cls):
483 super(TemplateIpsecEspUdp, cls).setUpClass()
484
485 @classmethod
486 def tearDownClass(cls):
487 super(TemplateIpsecEspUdp, cls).tearDownClass()
488
Neale Ranns53f526b2019-02-25 14:32:02 +0000489 def setUp(self):
490 super(TemplateIpsecEspUdp, self).setUp()
Neale Ranns4f33c802019-04-10 12:39:10 +0000491 self.net_objs = []
Neale Ranns53f526b2019-02-25 14:32:02 +0000492 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
Neale Ranns4f33c802019-04-10 12:39:10 +0000506 self.config_esp_tra(p)
Neale Ranns2ac885c2019-03-20 18:24:43 +0000507 config_tra_params(p, self.encryption_type)
Neale Ranns53f526b2019-02-25 14:32:02 +0000508
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
Neale Ranns4f33c802019-04-10 12:39:10 +0000514 self.config_esp_tun(p)
Neale Ranns92e93842019-04-08 07:36:50 +0000515 self.logger.info(self.vapi.ppcli("show ipsec all"))
Neale Ranns53f526b2019-02-25 14:32:02 +0000516
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()
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700525
526 def show_commands_at_teardown(self):
527 self.logger.info(self.vapi.cli("show hardware"))
Neale Ranns53f526b2019-02-25 14:32:02 +0000528
529
Neale Ranns49e7ef62019-04-10 17:24:29 +0000530class TestIpsecEspUdp(TemplateIpsecEspUdp, IpsecTra4Tests):
Neale Ranns53f526b2019-02-25 14:32:02 +0000531 """ Ipsec NAT-T ESP UDP tests """
Neale Ranns53f526b2019-02-25 14:32:02 +0000532 pass
533
534
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000535class 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]
Neale Ranns4f33c802019-04-10 12:39:10 +0000540 # foreach crypto algorithm
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000541 self.algos = {
542 'AES-GCM-128/NONE': {
543 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns47feb112019-04-11 15:14:07 +0000544 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",
Ole Troan64e978b2019-10-17 21:40:36 +0200549 'key': b"JPjyOWBeVEQiMe7h",
Neale Ranns80f6fd52019-04-16 02:41:34 +0000550 'salt': 0},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000551 'AES-GCM-192/NONE': {
552 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns80f6fd52019-04-16 02:41:34 +0000553 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",
Ole Troan64e978b2019-10-17 21:40:36 +0200558 'key': b"JPjyOWBeVEQiMe7h01234567",
Neale Ranns80f6fd52019-04-16 02:41:34 +0000559 'salt': 1010},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000560 'AES-GCM-256/NONE': {
561 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns47feb112019-04-11 15:14:07 +0000562 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",
Ole Troan64e978b2019-10-17 21:40:36 +0200567 'key': b"JPjyOWBeVEQiMe7h0123456787654321",
Neale Ranns80f6fd52019-04-16 02:41:34 +0000568 'salt': 2020},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000569 'AES-CBC-128/MD5-96': {
570 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns47feb112019-04-11 15:14:07 +0000571 IPSEC_API_CRYPTO_ALG_AES_CBC_128),
572 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
Dmitry Vakhrushev77cc14a2019-08-14 00:12:33 -0400573 IPSEC_API_INTEG_ALG_MD5_96),
Neale Ranns47feb112019-04-11 15:14:07 +0000574 'scapy-crypto': "AES-CBC",
Dmitry Vakhrushev77cc14a2019-08-14 00:12:33 -0400575 'scapy-integ': "HMAC-MD5-96",
Neale Ranns80f6fd52019-04-16 02:41:34 +0000576 'salt': 0,
Ole Troan64e978b2019-10-17 21:40:36 +0200577 'key': b"JPjyOWBeVEQiMe7h"},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000578 'AES-CBC-192/SHA1-96': {
579 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns47feb112019-04-11 15:14:07 +0000580 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",
Neale Ranns80f6fd52019-04-16 02:41:34 +0000585 'salt': 0,
Ole Troan64e978b2019-10-17 21:40:36 +0200586 'key': b"JPjyOWBeVEQiMe7hJPjyOWBe"},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000587 'AES-CBC-256/SHA1-96': {
588 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns47feb112019-04-11 15:14:07 +0000589 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",
Neale Ranns80f6fd52019-04-16 02:41:34 +0000594 'salt': 0,
Ole Troan64e978b2019-10-17 21:40:36 +0200595 'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000596 '3DES-CBC/SHA1-96': {
597 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Vladimir Ratnikovf4805072019-05-17 09:17:59 -0400598 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,
Ole Troan64e978b2019-10-17 21:40:36 +0200604 'key': b"JPjyOWBeVEQiMe7h00112233"},
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000605 'NONE/SHA1-96': {
606 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
Neale Ranns2cdcd0c2019-08-27 12:26:14 +0000607 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,
Benoît Ganne490b9272021-01-22 18:03:09 +0100613 '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"}}
Neale Ranns4f33c802019-04-10 12:39:10 +0000641
Neale Ranns4f33c802019-04-10 12:39:10 +0000642
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000643class RunTestIpsecEspAll(ConfigIpsecESP,
644 IpsecTra4, IpsecTra6,
645 IpsecTun4, IpsecTun6):
646 """ Ipsec ESP all Algos """
647
648 def setUp(self):
649 super(RunTestIpsecEspAll, self).setUp()
650 test_args = str.split(self.__doc__, " ")
651
652 params = MyParameters()
653 self.engine = test_args[0]
654 self.flag = params.flags[0]
655 if test_args[1] == 'ESN':
656 self.flag = params.flags[1]
657
658 self.algo = params.algos[test_args[2]]
659
660 def tearDown(self):
661 super(RunTestIpsecEspAll, self).tearDown()
662
663 def run_test(self):
664 self.run_a_test(self.engine, self.flag, self.algo)
665
Filip Tehlarefcad1a2020-02-04 09:36:04 +0000666 def run_a_test(self, engine, flag, algo, payload_size=None):
Christian Hoppsfb7e7ed2019-11-03 07:02:15 -0500667 if engine == "ia32":
668 engine = "native"
Neale Ranns00625a62019-07-31 00:13:18 -0700669 self.vapi.cli("set crypto handler all %s" % engine)
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000670
671 self.ipv4_params = IPsecIPv4Params()
672 self.ipv6_params = IPsecIPv6Params()
673
674 self.params = {self.ipv4_params.addr_type:
675 self.ipv4_params,
676 self.ipv6_params.addr_type:
677 self.ipv6_params}
678
679 for _, p in self.params.items():
680 p.auth_algo_vpp_id = algo['vpp-integ']
681 p.crypt_algo_vpp_id = algo['vpp-crypto']
682 p.crypt_algo = algo['scapy-crypto']
683 p.auth_algo = algo['scapy-integ']
684 p.crypt_key = algo['key']
685 p.salt = algo['salt']
686 p.flags = p.flags | flag
Neale Ranns9ec846c2021-02-09 14:04:02 +0000687 p.outer_flow_label = 243224
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000688
689 self.reporter.send_keep_alive(self)
690
Neale Ranns4f33c802019-04-10 12:39:10 +0000691 #
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000692 # configure the SPDs. SAs, etc
Neale Ranns4f33c802019-04-10 12:39:10 +0000693 #
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000694 self.config_network(self.params.values())
Neale Ranns4f33c802019-04-10 12:39:10 +0000695
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000696 #
697 # run some traffic.
698 # An exhautsive 4o6, 6o4 is not necessary
699 # for each algo
700 #
701 self.verify_tra_basic6(count=NUM_PKTS)
702 self.verify_tra_basic4(count=NUM_PKTS)
703 self.verify_tun_66(self.params[socket.AF_INET6],
704 count=NUM_PKTS)
Christian Hoppsfb7e7ed2019-11-03 07:02:15 -0500705 #
706 # Use an odd-byte payload size to check for correct padding.
707 #
708 # 49 + 2 == 51 which should pad +1 to 52 for 4 byte alignment, +5
709 # to 56 for 8 byte alignment, and +13 to 64 for 64 byte alignment.
710 # This should catch bugs where the code is incorrectly over-padding
711 # for algorithms that don't require it
712 psz = 49 - len(IP()/ICMP()) if payload_size is None else payload_size
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000713 self.verify_tun_44(self.params[socket.AF_INET],
Christian Hoppsfb7e7ed2019-11-03 07:02:15 -0500714 count=NUM_PKTS, payload_size=psz)
Neale Ranns4f33c802019-04-10 12:39:10 +0000715
Filip Tehlarefcad1a2020-02-04 09:36:04 +0000716 LARGE_PKT_SZ = [
Filip Tehlare4e8c6b2020-02-13 07:49:30 +0000717 1970, # results in 2 chained buffers entering decrypt node
718 # but leaving as simple buffer due to ICV removal (tra4)
PiotrX Kleskifdca4dd2020-05-05 14:14:22 +0200719 2004, # footer+ICV will be added to 2nd buffer (tun4)
Filip Tehlarefcad1a2020-02-04 09:36:04 +0000720 4010, # ICV ends up splitted accross 2 buffers in esp_decrypt
721 # for transport4; transport6 takes normal path
Filip Tehlarefcad1a2020-02-04 09:36:04 +0000722 4020, # same as above but tra4 and tra6 are switched
723 ]
724 if self.engine in engines_supporting_chain_bufs:
725 for sz in LARGE_PKT_SZ:
726 self.verify_tra_basic4(count=NUM_PKTS, payload_size=sz)
727 self.verify_tra_basic6(count=NUM_PKTS, payload_size=sz)
728 self.verify_tun_66(self.params[socket.AF_INET6],
729 count=NUM_PKTS, payload_size=sz)
730 self.verify_tun_44(self.params[socket.AF_INET],
731 count=NUM_PKTS, payload_size=sz)
732
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000733 #
734 # remove the SPDs, SAs, etc
735 #
736 self.unconfig_network()
Neale Ranns4f33c802019-04-10 12:39:10 +0000737
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000738 #
739 # reconfigure the network and SA to run the
740 # anti replay tests
741 #
742 self.config_network(self.params.values())
743 self.verify_tra_anti_replay()
744 self.unconfig_network()
juraj.linkes11057662019-07-08 10:22:55 +0200745
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000746#
747# To generate test classes, do:
748# grep '# GEN' test_ipsec_esp.py | sed -e 's/# GEN //g' | bash
749#
750# GEN for ENG in ia32 ipsecmb openssl; do \
751# GEN for FLG in noESN ESN; do for ALG in AES-GCM-128/NONE \
752# GEN AES-GCM-192/NONE AES-GCM-256/NONE AES-CBC-128/MD5-96 \
753# GEN AES-CBC-192/SHA1-96 AES-CBC-256/SHA1-96 \
Benoît Ganne490b9272021-01-22 18:03:09 +0100754# GEN 3DES-CBC/SHA1-96 NONE/SHA1-96 \
755# GEN AES-CTR-128/SHA1-96 AES-CTR-192/SHA1-96 AES-CTR-256/SHA1-96; do \
Filip Tehlar39cf40a2020-03-25 04:08:55 +0000756# GEN [[ ${FLG} == "ESN" && ${ALG} == *"NONE" ]] && continue
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000757# GEN echo -e "\n\nclass Test_${ENG}_${FLG}_${ALG}(RunTestIpsecEspAll):" |
758# GEN sed -e 's/-/_/g' -e 's#/#_#g' ; \
759# GEN echo ' """'$ENG $FLG $ALG IPSec test'"""' ;
760# GEN echo " def test_ipsec(self):";
761# GEN echo " self.run_test()";
762# GEN done; done; done
Neale Ranns4f33c802019-04-10 12:39:10 +0000763
Neale Ranns4f33c802019-04-10 12:39:10 +0000764
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000765class Test_ia32_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
766 """ia32 noESN AES-GCM-128/NONE IPSec test"""
767 def test_ipsec(self):
768 self.run_test()
Neale Ranns4f33c802019-04-10 12:39:10 +0000769
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000770
771class Test_ia32_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
772 """ia32 noESN AES-GCM-192/NONE IPSec test"""
773 def test_ipsec(self):
774 self.run_test()
775
776
777class Test_ia32_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
778 """ia32 noESN AES-GCM-256/NONE IPSec test"""
779 def test_ipsec(self):
780 self.run_test()
781
782
783class Test_ia32_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
784 """ia32 noESN AES-CBC-128/MD5-96 IPSec test"""
785 def test_ipsec(self):
786 self.run_test()
787
788
789class Test_ia32_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
790 """ia32 noESN AES-CBC-192/SHA1-96 IPSec test"""
791 def test_ipsec(self):
792 self.run_test()
793
794
795class Test_ia32_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
796 """ia32 noESN AES-CBC-256/SHA1-96 IPSec test"""
797 def test_ipsec(self):
798 self.run_test()
799
800
801class Test_ia32_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
802 """ia32 noESN 3DES-CBC/SHA1-96 IPSec test"""
803 def test_ipsec(self):
804 self.run_test()
805
806
807class Test_ia32_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
808 """ia32 noESN NONE/SHA1-96 IPSec test"""
809 def test_ipsec(self):
810 self.run_test()
811
812
Benoît Ganne490b9272021-01-22 18:03:09 +0100813class Test_ia32_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
814 """ia32 noESN AES-CTR-128/SHA1-96 IPSec test"""
815 def test_ipsec(self):
816 self.run_test()
817
818
819class Test_ia32_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
820 """ia32 noESN AES-CTR-192/SHA1-96 IPSec test"""
821 def test_ipsec(self):
822 self.run_test()
823
824
825class Test_ia32_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
826 """ia32 noESN AES-CTR-256/SHA1-96 IPSec test"""
827 def test_ipsec(self):
828 self.run_test()
829
830
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000831class Test_ia32_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
832 """ia32 ESN AES-CBC-128/MD5-96 IPSec test"""
833 def test_ipsec(self):
834 self.run_test()
835
836
837class Test_ia32_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
838 """ia32 ESN AES-CBC-192/SHA1-96 IPSec test"""
839 def test_ipsec(self):
840 self.run_test()
841
842
843class Test_ia32_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
844 """ia32 ESN AES-CBC-256/SHA1-96 IPSec test"""
845 def test_ipsec(self):
846 self.run_test()
847
848
849class Test_ia32_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
850 """ia32 ESN 3DES-CBC/SHA1-96 IPSec test"""
851 def test_ipsec(self):
852 self.run_test()
853
854
855class Test_ia32_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
856 """ia32 ESN NONE/SHA1-96 IPSec test"""
857 def test_ipsec(self):
858 self.run_test()
859
860
Benoît Ganne490b9272021-01-22 18:03:09 +0100861class Test_ia32_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
862 """ia32 ESN AES-CTR-128/SHA1-96 IPSec test"""
863 def test_ipsec(self):
864 self.run_test()
865
866
867class Test_ia32_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
868 """ia32 ESN AES-CTR-192/SHA1-96 IPSec test"""
869 def test_ipsec(self):
870 self.run_test()
871
872
873class Test_ia32_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
874 """ia32 ESN AES-CTR-256/SHA1-96 IPSec test"""
875 def test_ipsec(self):
876 self.run_test()
877
878
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000879class Test_ipsecmb_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
880 """ipsecmb noESN AES-GCM-128/NONE IPSec test"""
881 def test_ipsec(self):
882 self.run_test()
883
884
885class Test_ipsecmb_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
886 """ipsecmb noESN AES-GCM-192/NONE IPSec test"""
887 def test_ipsec(self):
888 self.run_test()
889
890
891class Test_ipsecmb_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
892 """ipsecmb noESN AES-GCM-256/NONE IPSec test"""
893 def test_ipsec(self):
894 self.run_test()
895
896
897class Test_ipsecmb_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
898 """ipsecmb noESN AES-CBC-128/MD5-96 IPSec test"""
899 def test_ipsec(self):
900 self.run_test()
901
902
903class Test_ipsecmb_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
904 """ipsecmb noESN AES-CBC-192/SHA1-96 IPSec test"""
905 def test_ipsec(self):
906 self.run_test()
907
908
909class Test_ipsecmb_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
910 """ipsecmb noESN AES-CBC-256/SHA1-96 IPSec test"""
911 def test_ipsec(self):
912 self.run_test()
913
914
915class Test_ipsecmb_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
916 """ipsecmb noESN 3DES-CBC/SHA1-96 IPSec test"""
917 def test_ipsec(self):
918 self.run_test()
919
920
921class Test_ipsecmb_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
922 """ipsecmb noESN NONE/SHA1-96 IPSec test"""
923 def test_ipsec(self):
924 self.run_test()
925
926
Benoît Ganne490b9272021-01-22 18:03:09 +0100927class Test_ipsecmb_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
928 """ipsecmb noESN AES-CTR-128/SHA1-96 IPSec test"""
929 def test_ipsec(self):
930 self.run_test()
931
932
933class Test_ipsecmb_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
934 """ipsecmb noESN AES-CTR-192/SHA1-96 IPSec test"""
935 def test_ipsec(self):
936 self.run_test()
937
938
939class Test_ipsecmb_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
940 """ipsecmb noESN AES-CTR-256/SHA1-96 IPSec test"""
941 def test_ipsec(self):
942 self.run_test()
943
944
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000945class Test_ipsecmb_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
946 """ipsecmb ESN AES-CBC-128/MD5-96 IPSec test"""
947 def test_ipsec(self):
948 self.run_test()
949
950
951class Test_ipsecmb_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
952 """ipsecmb ESN AES-CBC-192/SHA1-96 IPSec test"""
953 def test_ipsec(self):
954 self.run_test()
955
956
957class Test_ipsecmb_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
958 """ipsecmb ESN AES-CBC-256/SHA1-96 IPSec test"""
959 def test_ipsec(self):
960 self.run_test()
961
962
963class Test_ipsecmb_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
964 """ipsecmb ESN 3DES-CBC/SHA1-96 IPSec test"""
965 def test_ipsec(self):
966 self.run_test()
967
968
969class Test_ipsecmb_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
970 """ipsecmb ESN NONE/SHA1-96 IPSec test"""
971 def test_ipsec(self):
972 self.run_test()
973
974
Benoît Ganne490b9272021-01-22 18:03:09 +0100975class Test_ipsecmb_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
976 """ipsecmb ESN AES-CTR-128/SHA1-96 IPSec test"""
977 def test_ipsec(self):
978 self.run_test()
979
980
981class Test_ipsecmb_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
982 """ipsecmb ESN AES-CTR-192/SHA1-96 IPSec test"""
983 def test_ipsec(self):
984 self.run_test()
985
986
987class Test_ipsecmb_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
988 """ipsecmb ESN AES-CTR-256/SHA1-96 IPSec test"""
989 def test_ipsec(self):
990 self.run_test()
991
992
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +0000993class Test_openssl_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
994 """openssl noESN AES-GCM-128/NONE IPSec test"""
995 def test_ipsec(self):
996 self.run_test()
997
998
999class Test_openssl_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
1000 """openssl noESN AES-GCM-192/NONE IPSec test"""
1001 def test_ipsec(self):
1002 self.run_test()
1003
1004
1005class Test_openssl_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
1006 """openssl noESN AES-GCM-256/NONE IPSec test"""
1007 def test_ipsec(self):
1008 self.run_test()
1009
1010
1011class Test_openssl_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
1012 """openssl noESN AES-CBC-128/MD5-96 IPSec test"""
1013 def test_ipsec(self):
1014 self.run_test()
1015
1016
1017class Test_openssl_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
1018 """openssl noESN AES-CBC-192/SHA1-96 IPSec test"""
1019 def test_ipsec(self):
1020 self.run_test()
1021
1022
1023class Test_openssl_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
1024 """openssl noESN AES-CBC-256/SHA1-96 IPSec test"""
1025 def test_ipsec(self):
1026 self.run_test()
1027
1028
1029class Test_openssl_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
1030 """openssl noESN 3DES-CBC/SHA1-96 IPSec test"""
1031 def test_ipsec(self):
1032 self.run_test()
1033
1034
1035class Test_openssl_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
1036 """openssl noESN NONE/SHA1-96 IPSec test"""
1037 def test_ipsec(self):
1038 self.run_test()
1039
1040
Benoît Ganne490b9272021-01-22 18:03:09 +01001041class Test_openssl_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
1042 """openssl noESN AES-CTR-128/SHA1-96 IPSec test"""
1043 def test_ipsec(self):
1044 self.run_test()
1045
1046
1047class Test_openssl_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
1048 """openssl noESN AES-CTR-192/SHA1-96 IPSec test"""
1049 def test_ipsec(self):
1050 self.run_test()
1051
1052
1053class Test_openssl_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
1054 """openssl noESN AES-CTR-256/SHA1-96 IPSec test"""
1055 def test_ipsec(self):
1056 self.run_test()
1057
1058
Andrew Yourtchenkofbc38892019-09-09 11:14:59 +00001059class Test_openssl_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
1060 """openssl ESN AES-CBC-128/MD5-96 IPSec test"""
1061 def test_ipsec(self):
1062 self.run_test()
1063
1064
1065class Test_openssl_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
1066 """openssl ESN AES-CBC-192/SHA1-96 IPSec test"""
1067 def test_ipsec(self):
1068 self.run_test()
1069
1070
1071class Test_openssl_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
1072 """openssl ESN AES-CBC-256/SHA1-96 IPSec test"""
1073 def test_ipsec(self):
1074 self.run_test()
1075
1076
1077class Test_openssl_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
1078 """openssl ESN 3DES-CBC/SHA1-96 IPSec test"""
1079 def test_ipsec(self):
1080 self.run_test()
1081
1082
1083class Test_openssl_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
1084 """openssl ESN NONE/SHA1-96 IPSec test"""
1085 def test_ipsec(self):
1086 self.run_test()
Neale Ranns6afaae12019-07-17 15:07:14 +00001087
Neale Ranns4f33c802019-04-10 12:39:10 +00001088
Benoît Ganne490b9272021-01-22 18:03:09 +01001089class Test_openssl_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
1090 """openssl ESN AES-CTR-128/SHA1-96 IPSec test"""
1091 def test_ipsec(self):
1092 self.run_test()
1093
1094
1095class Test_openssl_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
1096 """openssl ESN AES-CTR-192/SHA1-96 IPSec test"""
1097 def test_ipsec(self):
1098 self.run_test()
1099
1100
1101class Test_openssl_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
1102 """openssl ESN AES-CTR-256/SHA1-96 IPSec test"""
1103 def test_ipsec(self):
1104 self.run_test()
1105
1106
“mystarrocks”23f0c452017-12-11 07:11:51 -08001107if __name__ == '__main__':
1108 unittest.main(testRunner=VppTestRunner)