From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 717C7A2F6B for ; Tue, 8 Oct 2019 07:26:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 959501BF24; Tue, 8 Oct 2019 07:26:19 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1D1A32AB for ; Tue, 8 Oct 2019 07:26:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 22:26:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,269,1566889200"; d="scan'208";a="223134710" Received: from unknown (HELO dpdk-wenjielx-dtspatch135.sh.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 07 Oct 2019 22:26:16 -0700 From: yaobing To: dts@dpdk.org Cc: yaobing Date: Tue, 8 Oct 2019 13:29:28 +0800 Message-Id: <1570512569-17999-2-git-send-email-bingx.y.yao@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1570512569-17999-1-git-send-email-bingx.y.yao@intel.com> References: <1570512569-17999-1-git-send-email-bingx.y.yao@intel.com> Subject: [dts] [PATCH V1 2/3] add case suite fips_cryptodev 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" add case suite fips_cryptodev Signed-off-by: yaobing --- tests/TestSuite_fips_cryptodev.py | 190 ++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 tests/TestSuite_fips_cryptodev.py diff --git a/tests/TestSuite_fips_cryptodev.py b/tests/TestSuite_fips_cryptodev.py new file mode 100644 index 0000000..1165ad8 --- /dev/null +++ b/tests/TestSuite_fips_cryptodev.py @@ -0,0 +1,190 @@ +# BSD LICENSE +# +# Copyright (c) <2019> Intel Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import utils +from test_case import TestCase +import cryptodev_common as cc +import re + +class FipCryptodev(TestCase): + + def set_up_all(self): + if not cc.is_build_skip(self): + cc.build_dpdk_with_cryptodev(self) + out = self.dut.build_dpdk_apps("./examples/fips_validation") + self.verify("Error"not in out,"Compilation error") + self.verify("No such"not in out,"Compilation error") + self.vf_driver = self.get_suite_cfg()['vf_driver'] + cc.bind_qat_device(self, "vfio-pci") + self._app_path = "./examples/fips_validation/build/fips_validation" + self._default_fips_opts = { + "req-file": None, + "rsp-file": None, + "cryptodev": None, + "path-is-folder": "", + "cryptodev-id": 0, + "self-test":"", + } + self.FIP_path = "/root/FIPS" + + def set_up(self): + pass + + def tear_down(self): + self.dut.kill_all() + + def tear_down_all(self): + cc.clear_dpdk_config(self) + + # Private functions + def _get_fips_opt_str(self): + return cc.get_opt_str(self, self._default_fips_opts,{}) + + def _run_fips(self, eal_opt_str, fips_opt_str): + cmd_str = cc.get_dpdk_app_cmd_str(self._app_path, + eal_opt_str, + fips_opt_str) + self.logger.info(cmd_str) + try: + out = self.dut.send_expect(cmd_str, "#", 600) + except Exception, ex: + self.logger.error(ex) + raise ex + return out + + def compare_resp_file(self,eal_opt_str,fips_opt_str): + out = self._run_fips(eal_opt_str, fips_opt_str) + check_out = out[out.index("Done"):] + self.verify("Error" not in check_out," req file error") + rep_list = re.findall(r"FIPS/(.*)/req/(.*).req", out) + + for alog_name, file_name in rep_list: + out = self.dut.send_expect("diff %s/%s/resp/%s.rsp %s/%s/fax/%s.rsp | grep -v '#' | grep -v '\---'" % ( + self.FIP_path, alog_name, file_name, self.FIP_path, alog_name, file_name), "#") + lines = re.split('\r\n', out) + self.verify(len(lines) <= 2, "%s.req file comparison failed!"%file_name) + + def test_fips_aesni_mb_aes(self): + eal_opt_str = cc.get_eal_opt_str(self) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str,fips_opt_str) + + def test_fips_aesni_mb_3des(self): + eal_opt_str = cc.get_eal_opt_str(self) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str,fips_opt_str) + + def test_fips_aesni_mb_hmac(self): + eal_opt_str = cc.get_eal_opt_str(self) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_aesni_mb_ccm(self): + eal_opt_str = cc.get_eal_opt_str(self) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_aesni_mb_cmac(self): + eal_opt_str = cc.get_eal_opt_str(self) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_qat_gcm(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_qat_aes(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_qat_3des(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_qat_hmac(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_qat_ccm(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_qat_cmac(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_openssl_gcm(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_openssl_aes(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_openssl_3des(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_openssl_hmac(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_openssl_ccm(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_aesni_gcm_gcm(self): + eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_aesni_gcm_pmd_1"}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_self_test(self): + eal_opt_str = cc.get_eal_opt_str(self,{"l":None,"n":None,}) + fips_opt_str = self._get_fips_opt_str() + self.compare_resp_file(eal_opt_str, fips_opt_str) + + def test_fips_broken_test(self): + eal_opt_str = cc.get_eal_opt_str(self,{"l":None,"n":None,}) + fips_opt_str = cc.get_opt_str(self, self._default_fips_opts,{"cryptodev-id":None, "broken-test-id":15, "broken-test-dir":"dec"}) + out = self._run_fips(eal_opt_str, fips_opt_str) + self.verify("Failed init" in out, "test Failed!") -- 2.17.2