From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 2A755475D for ; Sun, 18 Sep 2016 08:00:34 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 17 Sep 2016 23:00:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,355,1470726000"; d="scan'208";a="1032503930" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 17 Sep 2016 23:00:33 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sat, 17 Sep 2016 23:00:32 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.150]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.91]) with mapi id 14.03.0248.002; Sun, 18 Sep 2016 14:00:29 +0800 From: "Chen, Zhaoyan" To: "dts@dpdk.org" Thread-Topic: [dts] [PATCH] tests l2fwd_crypto: add md5 hmac algorithm check Thread-Index: AQHSEVvl8CwlvlxLREiWr1nK/RRHQqB+wLTg Date: Sun, 18 Sep 2016 06:00:29 +0000 Message-ID: <9DEEADBC57E43F4DA73B571777FECECA3A58EDBA@shsmsx102.ccr.corp.intel.com> References: <1474168932-6913-1-git-send-email-yong.liu@intel.com> In-Reply-To: <1474168932-6913-1-git-send-email-yong.liu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzdjZDQwNGItNmRlOC00Yjk2LWI1N2YtYjdkZDQ3OTYxZWQ5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkJZRWhIUnpIXC8rd2ZxMmw1UXU5NFRQdkRTdDNYWEV6aGpcL0IwVmpvV1hNcz0ifQ== x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH] tests l2fwd_crypto: add md5 hmac algorithm check X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2016 06:00:34 -0000 > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Marvin Liu > Sent: Sunday, September 18, 2016 11:22 AM > To: dts@dpdk.org > Cc: Liu, Yong > Subject: [dts] [PATCH] tests l2fwd_crypto: add md5 hmac algorithm check >=20 > Support md5 hmac algorithm output hash value check. > Reduce dut port requirement to only one port. > When md5 hmac value is None, calculate it by hmac library. >=20 > Signed-off-by: Marvin Liu >=20 > diff --git a/tests/TestSuite_l2fwd_crypto.py > b/tests/TestSuite_l2fwd_crypto.py index 0d6a52a..76f60ba 100644 > --- a/tests/TestSuite_l2fwd_crypto.py > +++ b/tests/TestSuite_l2fwd_crypto.py > @@ -29,6 +29,10 @@ > # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > SUCH DAMAGE. >=20 > +import hmac > +import hashlib > +import binascii > + > import dts > import time >=20 > @@ -39,8 +43,8 @@ class TestL2fwdCrypto(TestCase): >=20 > def set_up_all(self): >=20 > - self.core_config =3D "1S/4C/1T" > - self.number_of_ports =3D 2 > + self.core_config =3D "1S/2C/1T" > + self.number_of_ports =3D 1 > self.dut_ports =3D self.dut.get_ports(self.nic) > self.verify(len(self.dut_ports) >=3D self.number_of_ports, > "Not enough ports for " + self.nic) @@ -54,11 +58,10= @@ class > TestL2fwdCrypto(TestCase): > self.core_mask =3D dts.create_mask(self.dut.get_core_list( > self.core_config, > socket=3Dself.ports_socket)) > - self.port_mask =3D dts.create_mask([self.dut_ports[0], > - self.dut_ports[1]]) > + self.port_mask =3D dts.create_mask([self.dut_ports[0]]) >=20 > self.tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > - self.rx_port =3D self.tester.get_local_port(self.dut_ports[1]) > + self.rx_port =3D self.tester.get_local_port(self.dut_ports[0]) >=20 > self.tx_interface =3D self.tester.get_interface(self.tx_port) > self.rx_interface =3D self.tester.get_interface(self.rx_port) > @@ -77,6 +80,7 @@ class TestL2fwdCrypto(TestCase): > self.dut.send_expect("sed -i > 's/CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=3Dn$/CONFIG_RTE_LIBRTE_PMD > _NULL_CRYPTO=3Dy/' config/common_base", "# ") > self.dut.send_expect("sed -i > 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dn$/CONFIG_RTE_LIBRTE_PMD_SN > OW3G=3Dy/' config/common_base", "# ") > self.dut.send_expect("sed -i > 's/CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dn$/CONFIG_RTE_LIBRTE_PMD_KAS > UMI=3Dy/' config/common_base", "# ") > + self.dut.skip_setup =3D False > self.dut.build_install_dpdk(self.dut.target) >=20 > # l2fwd-crypto compile > @@ -117,6 +121,28 @@ class TestL2fwdCrypto(TestCase): >=20 > self.verify(result, True) >=20 > + def test_qat_MD5(self): > + """ > + Validate MD5 HMAC digest with Intel QuickAssist device > + """ > + > + result =3D True > + > + self.logger.info("Test qat_h_MD5_HMAC_01") > + > + # if output_hash not existed, calculate it automatically > + vector =3D test_vectors['qat_h_MD5_HMAC_01'] > + if not vector['output_hash']: > + key =3D binascii.a2b_hex(vector['auth_key']) > + msg =3D binascii.a2b_hex(vector['input']) > + digest =3D hmac.new(key, msg, hashlib.md5).digest() > + vector['output_hash'] =3D binascii.b2a_hex(digest) > + > + if not self.__execute_l2fwd_crypto_test( > + test_vectors, "qat_h_MD5_HMAC_01"): > + result =3D False > + self.verify(result, True) > + > def test_qat_SHA(self): >=20 > result =3D True > @@ -246,7 +272,7 @@ class TestL2fwdCrypto(TestCase): > self.dut.send_expect(cmd_str, "=3D=3D", 30) >=20 > self.tester.send_expect("rm -rf %s.pcap" % (self.rx_interface), = "#") > - self.tester.send_expect("tcpdump -w %s.pcap -i %s &" % > (self.rx_interface, self.rx_interface), "#") > + self.tester.send_expect("tcpdump -P in -w %s.pcap -i %s &" % > + (self.rx_interface, self.rx_interface), "#") > # Wait 5 sec for tcpdump stable > time.sleep(5) >=20 > @@ -483,6 +509,25 @@ test_vectors =3D { > "output_hash": "", > }, >=20 > + "qat_h_MD5_HMAC_01": { > + "vdev": "", > + "chain": "HASH_ONLY", > + "cdev_type": "ANY", > + "cipher_algo": "", > + "cipher_op": "", > + "cipher_key": "", > + "iv": "", > + "auth_algo": "MD5_HMAC", > + "auth_op": "GENERATE", > + "auth_key": "000102030405060708090a0b0c0d0e0f", > + "auth_key_random_size": "", > + "aad": "", > + "aad_random_size": "", > + "input": > "111111111111111111111111111111111111111111111111111111111111111111 > 11111111111111111111111111111100000000000000000000000000000000", > + "output_cipher": "", > + "output_hash": None > + }, > + > "qat_h_SHA1_HMAC_01": { > "vdev": "", > "chain": "HASH_ONLY", > -- > 1.9.3 Acked-by: Zhaoyan Chen