“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 1 | import socket |
Klement Sekera | 28fb03f | 2018-04-17 11:36:55 +0200 | [diff] [blame] | 2 | import unittest |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 3 | from scapy.layers.ipsec import ESP |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 4 | from scapy.layers.inet import IP, ICMP, UDP |
Neale Ranns | 041add7 | 2020-01-02 04:06:10 +0000 | [diff] [blame] | 5 | from scapy.layers.inet6 import IPv6 |
| 6 | from scapy.layers.l2 import Ether |
| 7 | from scapy.packet import Raw |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 8 | |
Neale Ranns | 00625a6 | 2019-07-31 00:13:18 -0700 | [diff] [blame] | 9 | from parameterized import parameterized |
juraj.linkes | 1105766 | 2019-07-08 10:22:55 +0200 | [diff] [blame] | 10 | from framework import VppTestRunner |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 11 | from template_ipsec import IpsecTra46Tests, IpsecTun46Tests, TemplateIpsec, \ |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 12 | IpsecTcpTests, IpsecTun4Tests, IpsecTra4Tests, config_tra_params, \ |
Neale Ranns | 12989b5 | 2019-09-26 16:20:19 +0000 | [diff] [blame] | 13 | config_tun_params, IPsecIPv4Params, IPsecIPv6Params, \ |
Neale Ranns | 4a56f4e | 2019-12-23 04:10:25 +0000 | [diff] [blame] | 14 | IpsecTra4, IpsecTun4, IpsecTra6, IpsecTun6, \ |
Neale Ranns | 0295040 | 2019-12-20 00:54:57 +0000 | [diff] [blame] | 15 | IpsecTun6HandoffTests, IpsecTun4HandoffTests, \ |
Filip Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 16 | IpsecTra6ExtTests |
Klement Sekera | bf61395 | 2019-01-29 11:38:08 +0100 | [diff] [blame] | 17 | from vpp_ipsec import VppIpsecSpd, VppIpsecSpdEntry, VppIpsecSA,\ |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 18 | VppIpsecSpdItfBinding |
Neale Ranns | 311124e | 2019-01-24 04:52:25 -0800 | [diff] [blame] | 19 | from vpp_ip_route import VppIpRoute, VppRoutePath |
| 20 | from vpp_ip import DpoProto |
Neale Ranns | 17dcec0 | 2019-01-09 21:22:20 -0800 | [diff] [blame] | 21 | from vpp_papi import VppEnum |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 22 | |
Neale Ranns | c87b66c | 2019-02-07 07:26:12 -0800 | [diff] [blame] | 23 | NUM_PKTS = 67 |
Filip Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 24 | engines_supporting_chain_bufs = ["openssl"] |
Neale Ranns | c87b66c | 2019-02-07 07:26:12 -0800 | [diff] [blame] | 25 | |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 26 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 27 | class 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 Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 37 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 38 | @classmethod |
| 39 | def setUpClass(cls): |
| 40 | super(ConfigIpsecESP, cls).setUpClass() |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 41 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 42 | @classmethod |
| 43 | def tearDownClass(cls): |
| 44 | super(ConfigIpsecESP, cls).tearDownClass() |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 45 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 46 | def setUp(self): |
| 47 | super(ConfigIpsecESP, self).setUp() |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 48 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 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) |
Neale Ranns | 12989b5 | 2019-09-26 16:20:19 +0000 | [diff] [blame] | 80 | config_tun_params(p, self.encryption_type, self.tun_if) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 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, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 87 | proto=d)]) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 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 |
Neale Ranns | 49e7ef6 | 2019-04-10 17:24:29 +0000 | [diff] [blame] | 112 | flags = params.flags |
Neale Ranns | 041add7 | 2020-01-02 04:06:10 +0000 | [diff] [blame] | 113 | tun_flags = params.tun_flags |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 114 | salt = params.salt |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 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], |
Neale Ranns | 49e7ef6 | 2019-04-10 17:24:29 +0000 | [diff] [blame] | 122 | self.tun_if.remote_addr[addr_type], |
Neale Ranns | 041add7 | 2020-01-02 04:06:10 +0000 | [diff] [blame] | 123 | tun_flags=tun_flags, |
| 124 | dscp=params.dscp, |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 125 | flags=flags, |
| 126 | salt=salt) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 127 | params.tun_sa_out = VppIpsecSA(self, vpp_tun_sa_id, vpp_tun_spi, |
| 128 | auth_algo_vpp_id, auth_key, |
| 129 | crypt_algo_vpp_id, crypt_key, |
| 130 | self.vpp_esp_protocol, |
| 131 | self.tun_if.remote_addr[addr_type], |
Neale Ranns | 49e7ef6 | 2019-04-10 17:24:29 +0000 | [diff] [blame] | 132 | self.tun_if.local_addr[addr_type], |
Neale Ranns | 041add7 | 2020-01-02 04:06:10 +0000 | [diff] [blame] | 133 | tun_flags=tun_flags, |
| 134 | dscp=params.dscp, |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 135 | flags=flags, |
| 136 | salt=salt) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 137 | objs.append(params.tun_sa_in) |
| 138 | objs.append(params.tun_sa_out) |
| 139 | |
| 140 | params.spd_policy_in_any = VppIpsecSpdEntry(self, self.tun_spd, |
| 141 | scapy_tun_sa_id, |
| 142 | addr_any, addr_bcast, |
| 143 | addr_any, addr_bcast, |
| 144 | socket.IPPROTO_ESP) |
| 145 | params.spd_policy_out_any = VppIpsecSpdEntry(self, self.tun_spd, |
| 146 | scapy_tun_sa_id, |
| 147 | addr_any, addr_bcast, |
| 148 | addr_any, addr_bcast, |
| 149 | socket.IPPROTO_ESP, |
| 150 | is_outbound=0) |
| 151 | objs.append(params.spd_policy_out_any) |
| 152 | objs.append(params.spd_policy_in_any) |
| 153 | |
| 154 | objs.append(VppIpsecSpdEntry(self, self.tun_spd, vpp_tun_sa_id, |
| 155 | remote_tun_if_host, remote_tun_if_host, |
| 156 | self.pg1.remote_addr[addr_type], |
| 157 | self.pg1.remote_addr[addr_type], |
| 158 | 0, |
| 159 | priority=10, |
| 160 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 161 | is_outbound=0)) |
| 162 | objs.append(VppIpsecSpdEntry(self, self.tun_spd, scapy_tun_sa_id, |
| 163 | self.pg1.remote_addr[addr_type], |
| 164 | self.pg1.remote_addr[addr_type], |
| 165 | remote_tun_if_host, remote_tun_if_host, |
| 166 | 0, |
| 167 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 168 | priority=10)) |
| 169 | objs.append(VppIpsecSpdEntry(self, self.tun_spd, vpp_tun_sa_id, |
| 170 | remote_tun_if_host, remote_tun_if_host, |
| 171 | self.pg0.local_addr[addr_type], |
| 172 | self.pg0.local_addr[addr_type], |
| 173 | 0, |
| 174 | priority=20, |
| 175 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 176 | is_outbound=0)) |
| 177 | objs.append(VppIpsecSpdEntry(self, self.tun_spd, scapy_tun_sa_id, |
| 178 | self.pg0.local_addr[addr_type], |
| 179 | self.pg0.local_addr[addr_type], |
| 180 | remote_tun_if_host, remote_tun_if_host, |
| 181 | 0, |
| 182 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 183 | priority=20)) |
| 184 | for o in objs: |
| 185 | o.add_vpp_config() |
| 186 | self.net_objs = self.net_objs + objs |
| 187 | |
| 188 | def config_esp_tra(self, params): |
| 189 | addr_type = params.addr_type |
| 190 | scapy_tra_sa_id = params.scapy_tra_sa_id |
| 191 | scapy_tra_spi = params.scapy_tra_spi |
| 192 | vpp_tra_sa_id = params.vpp_tra_sa_id |
| 193 | vpp_tra_spi = params.vpp_tra_spi |
| 194 | auth_algo_vpp_id = params.auth_algo_vpp_id |
| 195 | auth_key = params.auth_key |
| 196 | crypt_algo_vpp_id = params.crypt_algo_vpp_id |
| 197 | crypt_key = params.crypt_key |
| 198 | addr_any = params.addr_any |
| 199 | addr_bcast = params.addr_bcast |
| 200 | flags = (VppEnum.vl_api_ipsec_sad_flags_t. |
| 201 | IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY) |
| 202 | e = VppEnum.vl_api_ipsec_spd_action_t |
| 203 | flags = params.flags | flags |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 204 | salt = params.salt |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 205 | objs = [] |
| 206 | |
| 207 | params.tra_sa_in = VppIpsecSA(self, scapy_tra_sa_id, scapy_tra_spi, |
| 208 | auth_algo_vpp_id, auth_key, |
| 209 | crypt_algo_vpp_id, crypt_key, |
| 210 | self.vpp_esp_protocol, |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 211 | flags=flags, |
| 212 | salt=salt) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 213 | params.tra_sa_out = VppIpsecSA(self, vpp_tra_sa_id, vpp_tra_spi, |
| 214 | auth_algo_vpp_id, auth_key, |
| 215 | crypt_algo_vpp_id, crypt_key, |
| 216 | self.vpp_esp_protocol, |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 217 | flags=flags, |
| 218 | salt=salt) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 219 | objs.append(params.tra_sa_in) |
| 220 | objs.append(params.tra_sa_out) |
| 221 | |
| 222 | objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id, |
| 223 | addr_any, addr_bcast, |
| 224 | addr_any, addr_bcast, |
| 225 | socket.IPPROTO_ESP)) |
| 226 | objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id, |
| 227 | addr_any, addr_bcast, |
| 228 | addr_any, addr_bcast, |
| 229 | socket.IPPROTO_ESP, |
| 230 | is_outbound=0)) |
| 231 | objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id, |
| 232 | self.tra_if.local_addr[addr_type], |
| 233 | self.tra_if.local_addr[addr_type], |
| 234 | self.tra_if.remote_addr[addr_type], |
| 235 | self.tra_if.remote_addr[addr_type], |
| 236 | 0, priority=10, |
| 237 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 238 | is_outbound=0)) |
| 239 | objs.append(VppIpsecSpdEntry(self, self.tra_spd, scapy_tra_sa_id, |
| 240 | self.tra_if.local_addr[addr_type], |
| 241 | self.tra_if.local_addr[addr_type], |
| 242 | self.tra_if.remote_addr[addr_type], |
| 243 | self.tra_if.remote_addr[addr_type], |
| 244 | 0, policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 245 | priority=10)) |
| 246 | for o in objs: |
| 247 | o.add_vpp_config() |
| 248 | self.net_objs = self.net_objs + objs |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 249 | |
| 250 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 251 | class TemplateIpsecEsp(ConfigIpsecESP): |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 252 | """ |
| 253 | Basic test for ipsec esp sanity - tunnel and transport modes. |
| 254 | |
| 255 | Below 4 cases are covered as part of this test |
| 256 | 1) ipsec esp v4 transport basic test - IPv4 Transport mode |
Paul Vinciguerra | 8feeaff | 2019-03-27 11:25:48 -0700 | [diff] [blame] | 257 | scenario using HMAC-SHA1-96 integrity algo |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 258 | 2) ipsec esp v4 transport burst test |
| 259 | Above test for 257 pkts |
| 260 | 3) ipsec esp 4o4 tunnel basic test - IPv4 Tunnel mode |
Paul Vinciguerra | 8feeaff | 2019-03-27 11:25:48 -0700 | [diff] [blame] | 261 | scenario using HMAC-SHA1-96 integrity algo |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 262 | 4) ipsec esp 4o4 tunnel burst test |
| 263 | Above test for 257 pkts |
| 264 | |
| 265 | TRANSPORT MODE: |
| 266 | |
| 267 | --- encrypt --- |
| 268 | |pg2| <-------> |VPP| |
| 269 | --- decrypt --- |
| 270 | |
| 271 | TUNNEL MODE: |
| 272 | |
| 273 | --- encrypt --- plain --- |
Klement Sekera | 4b089f2 | 2018-04-17 18:04:57 +0200 | [diff] [blame] | 274 | |pg0| <------- |VPP| <------ |pg1| |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 275 | --- --- --- |
| 276 | |
| 277 | --- decrypt --- plain --- |
Klement Sekera | 4b089f2 | 2018-04-17 18:04:57 +0200 | [diff] [blame] | 278 | |pg0| -------> |VPP| ------> |pg1| |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 279 | --- --- --- |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 280 | """ |
| 281 | |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 282 | @classmethod |
| 283 | def setUpClass(cls): |
| 284 | super(TemplateIpsecEsp, cls).setUpClass() |
| 285 | |
| 286 | @classmethod |
| 287 | def tearDownClass(cls): |
| 288 | super(TemplateIpsecEsp, cls).tearDownClass() |
| 289 | |
Neale Ranns | 8e4a89b | 2019-01-23 08:16:17 -0800 | [diff] [blame] | 290 | def setUp(self): |
| 291 | super(TemplateIpsecEsp, self).setUp() |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 292 | self.config_network(self.params.values()) |
Klement Sekera | 611864f | 2018-09-26 11:19:00 +0200 | [diff] [blame] | 293 | |
Neale Ranns | 8e4a89b | 2019-01-23 08:16:17 -0800 | [diff] [blame] | 294 | def tearDown(self): |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 295 | self.unconfig_network() |
Neale Ranns | 8e4a89b | 2019-01-23 08:16:17 -0800 | [diff] [blame] | 296 | super(TemplateIpsecEsp, self).tearDown() |
Neale Ranns | 8e4a89b | 2019-01-23 08:16:17 -0800 | [diff] [blame] | 297 | |
Klement Sekera | 611864f | 2018-09-26 11:19:00 +0200 | [diff] [blame] | 298 | |
Neale Ranns | 0295040 | 2019-12-20 00:54:57 +0000 | [diff] [blame] | 299 | class TestIpsecEsp1(TemplateIpsecEsp, IpsecTra46Tests, |
Filip Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 300 | IpsecTun46Tests, IpsecTra6ExtTests): |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 301 | """ Ipsec ESP - TUN & TRA tests """ |
Neale Ranns | b1fd80f | 2020-05-12 13:33:56 +0000 | [diff] [blame] | 302 | |
| 303 | @classmethod |
| 304 | def setUpClass(cls): |
| 305 | super(TestIpsecEsp1, cls).setUpClass() |
| 306 | |
| 307 | @classmethod |
| 308 | def tearDownClass(cls): |
| 309 | super(TestIpsecEsp1, cls).tearDownClass() |
| 310 | |
| 311 | def setUp(self): |
| 312 | super(TestIpsecEsp1, self).setUp() |
| 313 | |
| 314 | def tearDown(self): |
| 315 | super(TestIpsecEsp1, self).tearDown() |
| 316 | |
| 317 | def test_tun_46(self): |
| 318 | """ ipsec 4o6 tunnel """ |
| 319 | # add an SPD entry to direct 2.2.2.2 to the v6 tunnel SA |
| 320 | p6 = self.ipv6_params |
| 321 | p4 = self.ipv4_params |
| 322 | |
| 323 | p6.remote_tun_if_host4 = "2.2.2.2" |
| 324 | e = VppEnum.vl_api_ipsec_spd_action_t |
| 325 | |
| 326 | VppIpsecSpdEntry(self, |
| 327 | self.tun_spd, |
| 328 | p6.scapy_tun_sa_id, |
| 329 | self.pg1.remote_addr[p4.addr_type], |
| 330 | self.pg1.remote_addr[p4.addr_type], |
| 331 | p6.remote_tun_if_host4, |
| 332 | p6.remote_tun_if_host4, |
| 333 | 0, |
| 334 | priority=10, |
| 335 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 336 | is_outbound=1).add_vpp_config() |
| 337 | VppIpRoute(self, p6.remote_tun_if_host4, p4.addr_len, |
| 338 | [VppRoutePath(self.tun_if.remote_addr[p4.addr_type], |
| 339 | 0xffffffff)]).add_vpp_config() |
| 340 | |
| 341 | old_name = self.tun6_encrypt_node_name |
| 342 | self.tun6_encrypt_node_name = "esp4-encrypt" |
| 343 | |
| 344 | self.verify_tun_46(p6, count=63) |
| 345 | self.tun6_encrypt_node_name = old_name |
| 346 | |
| 347 | def test_tun_64(self): |
| 348 | """ ipsec 6o4 tunnel """ |
| 349 | # add an SPD entry to direct 4444::4 to the v4 tunnel SA |
| 350 | p6 = self.ipv6_params |
| 351 | p4 = self.ipv4_params |
| 352 | |
| 353 | p4.remote_tun_if_host6 = "4444::4" |
| 354 | e = VppEnum.vl_api_ipsec_spd_action_t |
| 355 | |
| 356 | VppIpsecSpdEntry(self, |
| 357 | self.tun_spd, |
| 358 | p4.scapy_tun_sa_id, |
| 359 | self.pg1.remote_addr[p6.addr_type], |
| 360 | self.pg1.remote_addr[p6.addr_type], |
| 361 | p4.remote_tun_if_host6, |
| 362 | p4.remote_tun_if_host6, |
| 363 | 0, |
| 364 | priority=10, |
| 365 | policy=e.IPSEC_API_SPD_ACTION_PROTECT, |
| 366 | is_outbound=1).add_vpp_config() |
| 367 | d = DpoProto.DPO_PROTO_IP6 |
| 368 | VppIpRoute(self, p4.remote_tun_if_host6, p6.addr_len, |
| 369 | [VppRoutePath(self.tun_if.remote_addr[p6.addr_type], |
| 370 | 0xffffffff, |
| 371 | proto=d)]).add_vpp_config() |
| 372 | |
| 373 | old_name = self.tun4_encrypt_node_name |
| 374 | self.tun4_encrypt_node_name = "esp6-encrypt" |
| 375 | self.verify_tun_64(p4, count=63) |
| 376 | self.tun4_encrypt_node_name = old_name |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 377 | |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 378 | |
Neale Ranns | 041add7 | 2020-01-02 04:06:10 +0000 | [diff] [blame] | 379 | class TestIpsecEspTun(TemplateIpsecEsp, IpsecTun46Tests): |
| 380 | """ Ipsec ESP - TUN encap tests """ |
| 381 | |
| 382 | def setUp(self): |
| 383 | self.ipv4_params = IPsecIPv4Params() |
| 384 | self.ipv6_params = IPsecIPv6Params() |
| 385 | |
| 386 | c = (VppEnum.vl_api_tunnel_encap_decap_flags_t. |
| 387 | TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP) |
| 388 | c1 = c | (VppEnum.vl_api_tunnel_encap_decap_flags_t. |
| 389 | TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN) |
| 390 | |
| 391 | self.ipv4_params.tun_flags = c |
| 392 | self.ipv6_params.tun_flags = c1 |
| 393 | |
| 394 | super(TestIpsecEspTun, self).setUp() |
| 395 | |
| 396 | def gen_pkts(self, sw_intf, src, dst, count=1, payload_size=54): |
| 397 | # set the DSCP + ECN - flags are set to copy only DSCP |
| 398 | return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) / |
| 399 | IP(src=src, dst=dst, tos=5) / |
| 400 | UDP(sport=4444, dport=4444) / |
| 401 | Raw(b'X' * payload_size) |
| 402 | for i in range(count)] |
| 403 | |
| 404 | def gen_pkts6(self, sw_intf, src, dst, count=1, payload_size=54): |
| 405 | # set the DSCP + ECN - flags are set to copy both |
| 406 | return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) / |
| 407 | IPv6(src=src, dst=dst, tc=5) / |
| 408 | UDP(sport=4444, dport=4444) / |
| 409 | Raw(b'X' * payload_size) |
| 410 | for i in range(count)] |
| 411 | |
| 412 | def verify_encrypted(self, p, sa, rxs): |
| 413 | # just check that only the DSCP is copied |
| 414 | for rx in rxs: |
| 415 | self.assertEqual(rx[IP].tos, 4) |
| 416 | |
| 417 | def verify_encrypted6(self, p, sa, rxs): |
| 418 | # just check that the DSCP & ECN are copied |
| 419 | for rx in rxs: |
| 420 | self.assertEqual(rx[IPv6].tc, 5) |
| 421 | |
| 422 | |
| 423 | class TestIpsecEspTun2(TemplateIpsecEsp, IpsecTun46Tests): |
| 424 | """ Ipsec ESP - TUN DSCP tests """ |
| 425 | |
| 426 | def setUp(self): |
| 427 | self.ipv4_params = IPsecIPv4Params() |
| 428 | self.ipv6_params = IPsecIPv6Params() |
| 429 | |
| 430 | self.ipv4_params.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_EF |
| 431 | self.ipv6_params.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_AF11 |
| 432 | |
| 433 | super(TestIpsecEspTun2, self).setUp() |
| 434 | |
| 435 | def gen_pkts(self, sw_intf, src, dst, count=1, payload_size=54): |
| 436 | # set the DSCP + ECN - flags are set to copy only DSCP |
| 437 | return [Ether(src=sw_intf.remote_mac, dst=sw_intf.local_mac) / |
| 438 | IP(src=src, dst=dst) / |
| 439 | UDP(sport=4444, dport=4444) / |
| 440 | Raw(b'X' * payload_size) |
| 441 | for i in range(count)] |
| 442 | |
| 443 | def gen_pkts6(self, sw_intf, src, dst, count=1, payload_size=54): |
| 444 | # set the DSCP + ECN - flags are set to copy both |
| 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 copied |
| 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 & ECN are copied |
| 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 | |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 464 | class TestIpsecEsp2(TemplateIpsecEsp, IpsecTcpTests): |
| 465 | """ Ipsec ESP - TCP tests """ |
| 466 | pass |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 467 | |
| 468 | |
Neale Ranns | 4a56f4e | 2019-12-23 04:10:25 +0000 | [diff] [blame] | 469 | class TestIpsecEspHandoff(TemplateIpsecEsp, |
| 470 | IpsecTun6HandoffTests, |
| 471 | IpsecTun4HandoffTests): |
| 472 | """ Ipsec ESP - handoff tests """ |
| 473 | pass |
| 474 | |
| 475 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 476 | class TemplateIpsecEspUdp(ConfigIpsecESP): |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 477 | """ |
| 478 | UDP encapped ESP |
| 479 | """ |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 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 | |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 489 | def setUp(self): |
| 490 | super(TemplateIpsecEspUdp, self).setUp() |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 491 | self.net_objs = [] |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 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 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 506 | self.config_esp_tra(p) |
Neale Ranns | 2ac885c | 2019-03-20 18:24:43 +0000 | [diff] [blame] | 507 | config_tra_params(p, self.encryption_type) |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 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 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 514 | self.config_esp_tun(p) |
Neale Ranns | 92e9384 | 2019-04-08 07:36:50 +0000 | [diff] [blame] | 515 | self.logger.info(self.vapi.ppcli("show ipsec all")) |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 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() |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 525 | |
| 526 | def show_commands_at_teardown(self): |
| 527 | self.logger.info(self.vapi.cli("show hardware")) |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 528 | |
| 529 | |
Neale Ranns | 49e7ef6 | 2019-04-10 17:24:29 +0000 | [diff] [blame] | 530 | class TestIpsecEspUdp(TemplateIpsecEspUdp, IpsecTra4Tests): |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 531 | """ Ipsec NAT-T ESP UDP tests """ |
Neale Ranns | 53f526b | 2019-02-25 14:32:02 +0000 | [diff] [blame] | 532 | pass |
| 533 | |
| 534 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 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] |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 540 | # foreach crypto algorithm |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 541 | self.algos = { |
| 542 | 'AES-GCM-128/NONE': { |
| 543 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 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", |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 549 | 'key': b"JPjyOWBeVEQiMe7h", |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 550 | 'salt': 0}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 551 | 'AES-GCM-192/NONE': { |
| 552 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 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", |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 558 | 'key': b"JPjyOWBeVEQiMe7h01234567", |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 559 | 'salt': 1010}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 560 | 'AES-GCM-256/NONE': { |
| 561 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 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", |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 567 | 'key': b"JPjyOWBeVEQiMe7h0123456787654321", |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 568 | 'salt': 2020}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 569 | 'AES-CBC-128/MD5-96': { |
| 570 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 571 | IPSEC_API_CRYPTO_ALG_AES_CBC_128), |
| 572 | 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t. |
Dmitry Vakhrushev | 77cc14a | 2019-08-14 00:12:33 -0400 | [diff] [blame] | 573 | IPSEC_API_INTEG_ALG_MD5_96), |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 574 | 'scapy-crypto': "AES-CBC", |
Dmitry Vakhrushev | 77cc14a | 2019-08-14 00:12:33 -0400 | [diff] [blame] | 575 | 'scapy-integ': "HMAC-MD5-96", |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 576 | 'salt': 0, |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 577 | 'key': b"JPjyOWBeVEQiMe7h"}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 578 | 'AES-CBC-192/SHA1-96': { |
| 579 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 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", |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 585 | 'salt': 0, |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 586 | 'key': b"JPjyOWBeVEQiMe7hJPjyOWBe"}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 587 | 'AES-CBC-256/SHA1-96': { |
| 588 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 47feb11 | 2019-04-11 15:14:07 +0000 | [diff] [blame] | 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", |
Neale Ranns | 80f6fd5 | 2019-04-16 02:41:34 +0000 | [diff] [blame] | 594 | 'salt': 0, |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 595 | 'key': b"JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 596 | '3DES-CBC/SHA1-96': { |
| 597 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Vladimir Ratnikov | f480507 | 2019-05-17 09:17:59 -0400 | [diff] [blame] | 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, |
Ole Troan | 64e978b | 2019-10-17 21:40:36 +0200 | [diff] [blame] | 604 | 'key': b"JPjyOWBeVEQiMe7h00112233"}, |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 605 | 'NONE/SHA1-96': { |
| 606 | 'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t. |
Neale Ranns | 2cdcd0c | 2019-08-27 12:26:14 +0000 | [diff] [blame] | 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, |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 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"}} |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 641 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 642 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 643 | class 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 Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 666 | def run_a_test(self, engine, flag, algo, payload_size=None): |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 667 | if engine == "ia32": |
| 668 | engine = "native" |
Neale Ranns | 00625a6 | 2019-07-31 00:13:18 -0700 | [diff] [blame] | 669 | self.vapi.cli("set crypto handler all %s" % engine) |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 670 | |
| 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 |
| 687 | |
| 688 | self.reporter.send_keep_alive(self) |
| 689 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 690 | # |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 691 | # configure the SPDs. SAs, etc |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 692 | # |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 693 | self.config_network(self.params.values()) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 694 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 695 | # |
| 696 | # run some traffic. |
| 697 | # An exhautsive 4o6, 6o4 is not necessary |
| 698 | # for each algo |
| 699 | # |
| 700 | self.verify_tra_basic6(count=NUM_PKTS) |
| 701 | self.verify_tra_basic4(count=NUM_PKTS) |
| 702 | self.verify_tun_66(self.params[socket.AF_INET6], |
| 703 | count=NUM_PKTS) |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 704 | # |
| 705 | # Use an odd-byte payload size to check for correct padding. |
| 706 | # |
| 707 | # 49 + 2 == 51 which should pad +1 to 52 for 4 byte alignment, +5 |
| 708 | # to 56 for 8 byte alignment, and +13 to 64 for 64 byte alignment. |
| 709 | # This should catch bugs where the code is incorrectly over-padding |
| 710 | # for algorithms that don't require it |
| 711 | psz = 49 - len(IP()/ICMP()) if payload_size is None else payload_size |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 712 | self.verify_tun_44(self.params[socket.AF_INET], |
Christian Hopps | fb7e7ed | 2019-11-03 07:02:15 -0500 | [diff] [blame] | 713 | count=NUM_PKTS, payload_size=psz) |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 714 | |
Filip Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 715 | LARGE_PKT_SZ = [ |
Filip Tehlar | e4e8c6b | 2020-02-13 07:49:30 +0000 | [diff] [blame] | 716 | 1970, # results in 2 chained buffers entering decrypt node |
| 717 | # but leaving as simple buffer due to ICV removal (tra4) |
PiotrX Kleski | fdca4dd | 2020-05-05 14:14:22 +0200 | [diff] [blame] | 718 | 2004, # footer+ICV will be added to 2nd buffer (tun4) |
Filip Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 719 | 4010, # ICV ends up splitted accross 2 buffers in esp_decrypt |
| 720 | # for transport4; transport6 takes normal path |
Filip Tehlar | efcad1a | 2020-02-04 09:36:04 +0000 | [diff] [blame] | 721 | 4020, # same as above but tra4 and tra6 are switched |
| 722 | ] |
| 723 | if self.engine in engines_supporting_chain_bufs: |
| 724 | for sz in LARGE_PKT_SZ: |
| 725 | self.verify_tra_basic4(count=NUM_PKTS, payload_size=sz) |
| 726 | self.verify_tra_basic6(count=NUM_PKTS, payload_size=sz) |
| 727 | self.verify_tun_66(self.params[socket.AF_INET6], |
| 728 | count=NUM_PKTS, payload_size=sz) |
| 729 | self.verify_tun_44(self.params[socket.AF_INET], |
| 730 | count=NUM_PKTS, payload_size=sz) |
| 731 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 732 | # |
| 733 | # remove the SPDs, SAs, etc |
| 734 | # |
| 735 | self.unconfig_network() |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 736 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 737 | # |
| 738 | # reconfigure the network and SA to run the |
| 739 | # anti replay tests |
| 740 | # |
| 741 | self.config_network(self.params.values()) |
| 742 | self.verify_tra_anti_replay() |
| 743 | self.unconfig_network() |
juraj.linkes | 1105766 | 2019-07-08 10:22:55 +0200 | [diff] [blame] | 744 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 745 | # |
| 746 | # To generate test classes, do: |
| 747 | # grep '# GEN' test_ipsec_esp.py | sed -e 's/# GEN //g' | bash |
| 748 | # |
| 749 | # GEN for ENG in ia32 ipsecmb openssl; do \ |
| 750 | # GEN for FLG in noESN ESN; do for ALG in AES-GCM-128/NONE \ |
| 751 | # GEN AES-GCM-192/NONE AES-GCM-256/NONE AES-CBC-128/MD5-96 \ |
| 752 | # GEN AES-CBC-192/SHA1-96 AES-CBC-256/SHA1-96 \ |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 753 | # GEN 3DES-CBC/SHA1-96 NONE/SHA1-96 \ |
| 754 | # GEN AES-CTR-128/SHA1-96 AES-CTR-192/SHA1-96 AES-CTR-256/SHA1-96; do \ |
Filip Tehlar | 39cf40a | 2020-03-25 04:08:55 +0000 | [diff] [blame] | 755 | # GEN [[ ${FLG} == "ESN" && ${ALG} == *"NONE" ]] && continue |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 756 | # GEN echo -e "\n\nclass Test_${ENG}_${FLG}_${ALG}(RunTestIpsecEspAll):" | |
| 757 | # GEN sed -e 's/-/_/g' -e 's#/#_#g' ; \ |
| 758 | # GEN echo ' """'$ENG $FLG $ALG IPSec test'"""' ; |
| 759 | # GEN echo " def test_ipsec(self):"; |
| 760 | # GEN echo " self.run_test()"; |
| 761 | # GEN done; done; done |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 762 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 763 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 764 | class Test_ia32_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll): |
| 765 | """ia32 noESN AES-GCM-128/NONE IPSec test""" |
| 766 | def test_ipsec(self): |
| 767 | self.run_test() |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 768 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 769 | |
| 770 | class Test_ia32_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll): |
| 771 | """ia32 noESN AES-GCM-192/NONE IPSec test""" |
| 772 | def test_ipsec(self): |
| 773 | self.run_test() |
| 774 | |
| 775 | |
| 776 | class Test_ia32_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll): |
| 777 | """ia32 noESN AES-GCM-256/NONE IPSec test""" |
| 778 | def test_ipsec(self): |
| 779 | self.run_test() |
| 780 | |
| 781 | |
| 782 | class Test_ia32_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll): |
| 783 | """ia32 noESN AES-CBC-128/MD5-96 IPSec test""" |
| 784 | def test_ipsec(self): |
| 785 | self.run_test() |
| 786 | |
| 787 | |
| 788 | class Test_ia32_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll): |
| 789 | """ia32 noESN AES-CBC-192/SHA1-96 IPSec test""" |
| 790 | def test_ipsec(self): |
| 791 | self.run_test() |
| 792 | |
| 793 | |
| 794 | class Test_ia32_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll): |
| 795 | """ia32 noESN AES-CBC-256/SHA1-96 IPSec test""" |
| 796 | def test_ipsec(self): |
| 797 | self.run_test() |
| 798 | |
| 799 | |
| 800 | class Test_ia32_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll): |
| 801 | """ia32 noESN 3DES-CBC/SHA1-96 IPSec test""" |
| 802 | def test_ipsec(self): |
| 803 | self.run_test() |
| 804 | |
| 805 | |
| 806 | class Test_ia32_noESN_NONE_SHA1_96(RunTestIpsecEspAll): |
| 807 | """ia32 noESN NONE/SHA1-96 IPSec test""" |
| 808 | def test_ipsec(self): |
| 809 | self.run_test() |
| 810 | |
| 811 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 812 | class Test_ia32_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll): |
| 813 | """ia32 noESN AES-CTR-128/SHA1-96 IPSec test""" |
| 814 | def test_ipsec(self): |
| 815 | self.run_test() |
| 816 | |
| 817 | |
| 818 | class Test_ia32_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll): |
| 819 | """ia32 noESN AES-CTR-192/SHA1-96 IPSec test""" |
| 820 | def test_ipsec(self): |
| 821 | self.run_test() |
| 822 | |
| 823 | |
| 824 | class Test_ia32_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll): |
| 825 | """ia32 noESN AES-CTR-256/SHA1-96 IPSec test""" |
| 826 | def test_ipsec(self): |
| 827 | self.run_test() |
| 828 | |
| 829 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 830 | class Test_ia32_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll): |
| 831 | """ia32 ESN AES-CBC-128/MD5-96 IPSec test""" |
| 832 | def test_ipsec(self): |
| 833 | self.run_test() |
| 834 | |
| 835 | |
| 836 | class Test_ia32_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll): |
| 837 | """ia32 ESN AES-CBC-192/SHA1-96 IPSec test""" |
| 838 | def test_ipsec(self): |
| 839 | self.run_test() |
| 840 | |
| 841 | |
| 842 | class Test_ia32_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll): |
| 843 | """ia32 ESN AES-CBC-256/SHA1-96 IPSec test""" |
| 844 | def test_ipsec(self): |
| 845 | self.run_test() |
| 846 | |
| 847 | |
| 848 | class Test_ia32_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll): |
| 849 | """ia32 ESN 3DES-CBC/SHA1-96 IPSec test""" |
| 850 | def test_ipsec(self): |
| 851 | self.run_test() |
| 852 | |
| 853 | |
| 854 | class Test_ia32_ESN_NONE_SHA1_96(RunTestIpsecEspAll): |
| 855 | """ia32 ESN NONE/SHA1-96 IPSec test""" |
| 856 | def test_ipsec(self): |
| 857 | self.run_test() |
| 858 | |
| 859 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 860 | class Test_ia32_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll): |
| 861 | """ia32 ESN AES-CTR-128/SHA1-96 IPSec test""" |
| 862 | def test_ipsec(self): |
| 863 | self.run_test() |
| 864 | |
| 865 | |
| 866 | class Test_ia32_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll): |
| 867 | """ia32 ESN AES-CTR-192/SHA1-96 IPSec test""" |
| 868 | def test_ipsec(self): |
| 869 | self.run_test() |
| 870 | |
| 871 | |
| 872 | class Test_ia32_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll): |
| 873 | """ia32 ESN AES-CTR-256/SHA1-96 IPSec test""" |
| 874 | def test_ipsec(self): |
| 875 | self.run_test() |
| 876 | |
| 877 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 878 | class Test_ipsecmb_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll): |
| 879 | """ipsecmb noESN AES-GCM-128/NONE IPSec test""" |
| 880 | def test_ipsec(self): |
| 881 | self.run_test() |
| 882 | |
| 883 | |
| 884 | class Test_ipsecmb_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll): |
| 885 | """ipsecmb noESN AES-GCM-192/NONE IPSec test""" |
| 886 | def test_ipsec(self): |
| 887 | self.run_test() |
| 888 | |
| 889 | |
| 890 | class Test_ipsecmb_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll): |
| 891 | """ipsecmb noESN AES-GCM-256/NONE IPSec test""" |
| 892 | def test_ipsec(self): |
| 893 | self.run_test() |
| 894 | |
| 895 | |
| 896 | class Test_ipsecmb_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll): |
| 897 | """ipsecmb noESN AES-CBC-128/MD5-96 IPSec test""" |
| 898 | def test_ipsec(self): |
| 899 | self.run_test() |
| 900 | |
| 901 | |
| 902 | class Test_ipsecmb_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll): |
| 903 | """ipsecmb noESN AES-CBC-192/SHA1-96 IPSec test""" |
| 904 | def test_ipsec(self): |
| 905 | self.run_test() |
| 906 | |
| 907 | |
| 908 | class Test_ipsecmb_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll): |
| 909 | """ipsecmb noESN AES-CBC-256/SHA1-96 IPSec test""" |
| 910 | def test_ipsec(self): |
| 911 | self.run_test() |
| 912 | |
| 913 | |
| 914 | class Test_ipsecmb_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll): |
| 915 | """ipsecmb noESN 3DES-CBC/SHA1-96 IPSec test""" |
| 916 | def test_ipsec(self): |
| 917 | self.run_test() |
| 918 | |
| 919 | |
| 920 | class Test_ipsecmb_noESN_NONE_SHA1_96(RunTestIpsecEspAll): |
| 921 | """ipsecmb noESN NONE/SHA1-96 IPSec test""" |
| 922 | def test_ipsec(self): |
| 923 | self.run_test() |
| 924 | |
| 925 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 926 | class Test_ipsecmb_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll): |
| 927 | """ipsecmb noESN AES-CTR-128/SHA1-96 IPSec test""" |
| 928 | def test_ipsec(self): |
| 929 | self.run_test() |
| 930 | |
| 931 | |
| 932 | class Test_ipsecmb_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll): |
| 933 | """ipsecmb noESN AES-CTR-192/SHA1-96 IPSec test""" |
| 934 | def test_ipsec(self): |
| 935 | self.run_test() |
| 936 | |
| 937 | |
| 938 | class Test_ipsecmb_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll): |
| 939 | """ipsecmb noESN AES-CTR-256/SHA1-96 IPSec test""" |
| 940 | def test_ipsec(self): |
| 941 | self.run_test() |
| 942 | |
| 943 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 944 | class Test_ipsecmb_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll): |
| 945 | """ipsecmb ESN AES-CBC-128/MD5-96 IPSec test""" |
| 946 | def test_ipsec(self): |
| 947 | self.run_test() |
| 948 | |
| 949 | |
| 950 | class Test_ipsecmb_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll): |
| 951 | """ipsecmb ESN AES-CBC-192/SHA1-96 IPSec test""" |
| 952 | def test_ipsec(self): |
| 953 | self.run_test() |
| 954 | |
| 955 | |
| 956 | class Test_ipsecmb_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll): |
| 957 | """ipsecmb ESN AES-CBC-256/SHA1-96 IPSec test""" |
| 958 | def test_ipsec(self): |
| 959 | self.run_test() |
| 960 | |
| 961 | |
| 962 | class Test_ipsecmb_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll): |
| 963 | """ipsecmb ESN 3DES-CBC/SHA1-96 IPSec test""" |
| 964 | def test_ipsec(self): |
| 965 | self.run_test() |
| 966 | |
| 967 | |
| 968 | class Test_ipsecmb_ESN_NONE_SHA1_96(RunTestIpsecEspAll): |
| 969 | """ipsecmb ESN NONE/SHA1-96 IPSec test""" |
| 970 | def test_ipsec(self): |
| 971 | self.run_test() |
| 972 | |
| 973 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 974 | class Test_ipsecmb_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll): |
| 975 | """ipsecmb ESN AES-CTR-128/SHA1-96 IPSec test""" |
| 976 | def test_ipsec(self): |
| 977 | self.run_test() |
| 978 | |
| 979 | |
| 980 | class Test_ipsecmb_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll): |
| 981 | """ipsecmb ESN AES-CTR-192/SHA1-96 IPSec test""" |
| 982 | def test_ipsec(self): |
| 983 | self.run_test() |
| 984 | |
| 985 | |
| 986 | class Test_ipsecmb_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll): |
| 987 | """ipsecmb ESN AES-CTR-256/SHA1-96 IPSec test""" |
| 988 | def test_ipsec(self): |
| 989 | self.run_test() |
| 990 | |
| 991 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 992 | class Test_openssl_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll): |
| 993 | """openssl noESN AES-GCM-128/NONE IPSec test""" |
| 994 | def test_ipsec(self): |
| 995 | self.run_test() |
| 996 | |
| 997 | |
| 998 | class Test_openssl_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll): |
| 999 | """openssl noESN AES-GCM-192/NONE IPSec test""" |
| 1000 | def test_ipsec(self): |
| 1001 | self.run_test() |
| 1002 | |
| 1003 | |
| 1004 | class Test_openssl_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll): |
| 1005 | """openssl noESN AES-GCM-256/NONE IPSec test""" |
| 1006 | def test_ipsec(self): |
| 1007 | self.run_test() |
| 1008 | |
| 1009 | |
| 1010 | class Test_openssl_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll): |
| 1011 | """openssl noESN AES-CBC-128/MD5-96 IPSec test""" |
| 1012 | def test_ipsec(self): |
| 1013 | self.run_test() |
| 1014 | |
| 1015 | |
| 1016 | class Test_openssl_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll): |
| 1017 | """openssl noESN AES-CBC-192/SHA1-96 IPSec test""" |
| 1018 | def test_ipsec(self): |
| 1019 | self.run_test() |
| 1020 | |
| 1021 | |
| 1022 | class Test_openssl_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll): |
| 1023 | """openssl noESN AES-CBC-256/SHA1-96 IPSec test""" |
| 1024 | def test_ipsec(self): |
| 1025 | self.run_test() |
| 1026 | |
| 1027 | |
| 1028 | class Test_openssl_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll): |
| 1029 | """openssl noESN 3DES-CBC/SHA1-96 IPSec test""" |
| 1030 | def test_ipsec(self): |
| 1031 | self.run_test() |
| 1032 | |
| 1033 | |
| 1034 | class Test_openssl_noESN_NONE_SHA1_96(RunTestIpsecEspAll): |
| 1035 | """openssl noESN NONE/SHA1-96 IPSec test""" |
| 1036 | def test_ipsec(self): |
| 1037 | self.run_test() |
| 1038 | |
| 1039 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 1040 | class Test_openssl_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll): |
| 1041 | """openssl noESN AES-CTR-128/SHA1-96 IPSec test""" |
| 1042 | def test_ipsec(self): |
| 1043 | self.run_test() |
| 1044 | |
| 1045 | |
| 1046 | class Test_openssl_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll): |
| 1047 | """openssl noESN AES-CTR-192/SHA1-96 IPSec test""" |
| 1048 | def test_ipsec(self): |
| 1049 | self.run_test() |
| 1050 | |
| 1051 | |
| 1052 | class Test_openssl_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll): |
| 1053 | """openssl noESN AES-CTR-256/SHA1-96 IPSec test""" |
| 1054 | def test_ipsec(self): |
| 1055 | self.run_test() |
| 1056 | |
| 1057 | |
Andrew Yourtchenko | fbc3889 | 2019-09-09 11:14:59 +0000 | [diff] [blame] | 1058 | class Test_openssl_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll): |
| 1059 | """openssl ESN AES-CBC-128/MD5-96 IPSec test""" |
| 1060 | def test_ipsec(self): |
| 1061 | self.run_test() |
| 1062 | |
| 1063 | |
| 1064 | class Test_openssl_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll): |
| 1065 | """openssl ESN AES-CBC-192/SHA1-96 IPSec test""" |
| 1066 | def test_ipsec(self): |
| 1067 | self.run_test() |
| 1068 | |
| 1069 | |
| 1070 | class Test_openssl_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll): |
| 1071 | """openssl ESN AES-CBC-256/SHA1-96 IPSec test""" |
| 1072 | def test_ipsec(self): |
| 1073 | self.run_test() |
| 1074 | |
| 1075 | |
| 1076 | class Test_openssl_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll): |
| 1077 | """openssl ESN 3DES-CBC/SHA1-96 IPSec test""" |
| 1078 | def test_ipsec(self): |
| 1079 | self.run_test() |
| 1080 | |
| 1081 | |
| 1082 | class Test_openssl_ESN_NONE_SHA1_96(RunTestIpsecEspAll): |
| 1083 | """openssl ESN NONE/SHA1-96 IPSec test""" |
| 1084 | def test_ipsec(self): |
| 1085 | self.run_test() |
Neale Ranns | 6afaae1 | 2019-07-17 15:07:14 +0000 | [diff] [blame] | 1086 | |
Neale Ranns | 4f33c80 | 2019-04-10 12:39:10 +0000 | [diff] [blame] | 1087 | |
Benoît Ganne | 490b927 | 2021-01-22 18:03:09 +0100 | [diff] [blame^] | 1088 | class Test_openssl_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll): |
| 1089 | """openssl ESN AES-CTR-128/SHA1-96 IPSec test""" |
| 1090 | def test_ipsec(self): |
| 1091 | self.run_test() |
| 1092 | |
| 1093 | |
| 1094 | class Test_openssl_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll): |
| 1095 | """openssl ESN AES-CTR-192/SHA1-96 IPSec test""" |
| 1096 | def test_ipsec(self): |
| 1097 | self.run_test() |
| 1098 | |
| 1099 | |
| 1100 | class Test_openssl_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll): |
| 1101 | """openssl ESN AES-CTR-256/SHA1-96 IPSec test""" |
| 1102 | def test_ipsec(self): |
| 1103 | self.run_test() |
| 1104 | |
| 1105 | |
“mystarrocks” | 23f0c45 | 2017-12-11 07:11:51 -0800 | [diff] [blame] | 1106 | if __name__ == '__main__': |
| 1107 | unittest.main(testRunner=VppTestRunner) |