From 92e93844826fc080ea7f3495ba3e06de3f4d03f1 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Mon, 8 Apr 2019 07:36:50 +0000 Subject: crypto: Intel IPSEC-MB engine A plugin to use Intel IPSec MB library as a VPP crypto engine This changes uses concepts from: https://gerrit.fd.io/r/#/c/17301/ hence that author's work is acknowledge below Change-Id: I2bf3beeb10f3c9706fa5efbdc9bc023e310f5a92 Signed-off-by: Neale Ranns Signed-off-by: Klement Sekera --- test/test_ipsec_ah.py | 86 +++++++++++++++++++++++++++----------------------- test/test_ipsec_esp.py | 4 +-- 2 files changed, 49 insertions(+), 41 deletions(-) (limited to 'test') diff --git a/test/test_ipsec_ah.py b/test/test_ipsec_ah.py index ec0c5586c2b..38d97d584c5 100644 --- a/test/test_ipsec_ah.py +++ b/test/test_ipsec_ah.py @@ -313,7 +313,10 @@ class TestIpsecAhAll(ConfigIpsecAH, super(TestIpsecAhAll, self).tearDown() def test_integ_algs(self): - """SHA1_96, SHA256, SHA394, SHA512 w/ & w/o ESN""" + """All Engines SHA[1_96, 256, 394, 512] w/ & w/o ESN""" + # foreach VPP crypto engine + engines = ["ia32", "ipsecmb", "openssl"] + algos = [{'vpp': VppEnum.vl_api_ipsec_integ_alg_t. IPSEC_API_INTEG_ALG_SHA1_96, 'scapy': "HMAC-SHA1-96"}, @@ -331,45 +334,50 @@ class TestIpsecAhAll(ConfigIpsecAH, IPSEC_API_SAD_FLAG_USE_ESN)] # - # loop through each of the algorithms + # loop through the VPP engines # - for algo in algos: - # with self.subTest(algo=algo['scapy']): - for flag in flags: - # - # setup up the config paramters - # - self.ipv4_params = IPsecIPv4Params() - self.ipv6_params = IPsecIPv6Params() - - self.params = {self.ipv4_params.addr_type: - self.ipv4_params, - self.ipv6_params.addr_type: - self.ipv6_params} - - for _, p in self.params.items(): - p.auth_algo_vpp_id = algo['vpp'] - p.auth_algo = algo['scapy'] - p.flags = p.flags | flag - - # - # configure the SPDs. SAs, etc - # - self.config_network(self.params.values()) - - # - # run some traffic. - # An exhautsive 4o6, 6o4 is not necessary for each algo - # - self.verify_tra_basic6(count=17) - self.verify_tra_basic4(count=17) - self.verify_tun_66(self.params[socket.AF_INET6], count=17) - self.verify_tun_44(self.params[socket.AF_INET], count=17) - - # - # remove the SPDs, SAs, etc - # - self.unconfig_network() + for engine in engines: + self.vapi.cli("set crypto engine all %s" % engine) + # + # loop through each of the algorithms + # + for algo in algos: + # with self.subTest(algo=algo['scapy']): + for flag in flags: + # + # setup up the config paramters + # + self.ipv4_params = IPsecIPv4Params() + self.ipv6_params = IPsecIPv6Params() + + self.params = {self.ipv4_params.addr_type: + self.ipv4_params, + self.ipv6_params.addr_type: + self.ipv6_params} + + for _, p in self.params.items(): + p.auth_algo_vpp_id = algo['vpp'] + p.auth_algo = algo['scapy'] + p.flags = p.flags | flag + + # + # configure the SPDs. SAs, etc + # + self.config_network(self.params.values()) + + # + # run some traffic. + # An exhautsive 4o6, 6o4 is not necessary for each algo + # + self.verify_tra_basic6(count=17) + self.verify_tra_basic4(count=17) + self.verify_tun_66(self.params[socket.AF_INET6], count=17) + self.verify_tun_44(self.params[socket.AF_INET], count=17) + + # + # remove the SPDs, SAs, etc + # + self.unconfig_network() if __name__ == '__main__': diff --git a/test/test_ipsec_esp.py b/test/test_ipsec_esp.py index 283914071ca..a8b28c53ee6 100644 --- a/test/test_ipsec_esp.py +++ b/test/test_ipsec_esp.py @@ -322,7 +322,7 @@ class TemplateIpsecEspUdp(ConfigIpsecESP): self.tun_if).add_vpp_config() self.config_esp_tun(p) - self.logger.info(self.vapi.ppcli("show ipsec")) + self.logger.info(self.vapi.ppcli("show ipsec all")) d = DpoProto.DPO_PROTO_IP4 VppIpRoute(self, p.remote_tun_if_host, p.addr_len, @@ -356,7 +356,7 @@ class TestIpsecEspAll(ConfigIpsecESP, """All engines AES-CBC-[128, 192, 256] w/o ESN""" # foreach VPP crypto engine - engines = ["ia32", "openssl"] + engines = ["ia32", "ipsecmb", "openssl"] # foreach crypto algorithm algos = [{'vpp': VppEnum.vl_api_ipsec_crypto_alg_t. -- cgit 1.2.3-korg