test suite reviews and discussions
 help / color / Atom feed
* [dts] [PATCH V1 1/3] add fips environment variable
@ 2019-10-08  5:29 yaobing
  2019-10-08  5:29 ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev yaobing
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: yaobing @ 2019-10-08  5:29 UTC (permalink / raw)
  To: dts; +Cc: yaobing

add fips_cryptodev environment variable

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 tests/cryptodev_common.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/cryptodev_common.py b/tests/cryptodev_common.py
index 2e86bca..f521fbe 100644
--- a/tests/cryptodev_common.py
+++ b/tests/cryptodev_common.py
@@ -44,12 +44,30 @@ def build_dpdk_with_cryptodev(test_case):
     if "kasumi_lib_path" in test_case.get_suite_cfg():
         kasumi_lib_path = test_case.get_suite_cfg()["kasumi_lib_path"]
 
+    fip_cflags_path = "'-I/opt/openssl-fips-2.0.16/include/'"
+    if "fip_cflags_path" in test_case.get_suite_cfg():
+        fip_cflags_path = test_case.get_suite_cfg()["fip_cflags_path"]
+
+    fip_ldflags_path = "'-L/opt/openssl-fips-2.0.16/'"
+    if "fip_ldflags_path" in test_case.get_suite_cfg():
+        fip_cflags_path = test_case.get_suite_cfg()["fip_ldflags_path"]
+
+    fip_library_path = "/opt/openssl-fips-2.0.16/"
+    if "fip_library_path" in test_case.get_suite_cfg():
+        fip_cflags_path = test_case.get_suite_cfg()["fip_library_path"]
+
     test_case.dut.send_expect(
         "export LIBSSO_SNOW3G_PATH={}".format(snow3g_lib_path), "#")
     test_case.dut.send_expect(
         "export LIBSSO_ZUC_PATH={}".format(zuc_lib_path), "#")
     test_case.dut.send_expect(
         "export LIBSSO_KASUMI_PATH={}".format(kasumi_lib_path), "#")
+    test_case.dut.send_expect(
+        "export EXTRA_CFLAGS={}".format(fip_cflags_path), "#")
+    test_case.dut.send_expect(
+        "export EXTRA_LDFLAGS={}".format(fip_ldflags_path), "#")
+    test_case.dut.send_expect(
+        "export LD_LIBRARY_PATH={}".format(fip_library_path), "#")
 
     test_case.dut.send_expect(
         "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y/' config/common_base", "# ")
-- 
2.17.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dts] [PATCH V1 2/3] add case suite fips_cryptodev
  2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
@ 2019-10-08  5:29 ` yaobing
  2019-10-09  0:51   ` Chen, Zhaoyan
  2019-10-10  5:36   ` Yao, BingX Y
  2019-10-08  5:29 ` [dts] [PATCH V1 3/3] add fips_cryptodev config yaobing
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: yaobing @ 2019-10-08  5:29 UTC (permalink / raw)
  To: dts; +Cc: yaobing

add case suite fips_cryptodev

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dts] [PATCH V1 3/3] add fips_cryptodev config
  2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
  2019-10-08  5:29 ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev yaobing
@ 2019-10-08  5:29 ` yaobing
  2019-10-09  0:50   ` Chen, Zhaoyan
  2019-10-10  5:36   ` Yao, BingX Y
  2019-10-09  0:51 ` [dts] [PATCH V1 1/3] add fips environment variable Chen, Zhaoyan
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: yaobing @ 2019-10-08  5:29 UTC (permalink / raw)
  To: dts; +Cc: yaobing

add fips_cryptodev config

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 conf/fips_cryptodev.cfg | 102 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 conf/fips_cryptodev.cfg

diff --git a/conf/fips_cryptodev.cfg b/conf/fips_cryptodev.cfg
new file mode 100644
index 0000000..b3fd6b5
--- /dev/null
+++ b/conf/fips_cryptodev.cfg
@@ -0,0 +1,102 @@
+[suite]
+# Cryptodev common options qat device idcrypto_dev_id="37c9"
+crypto_dev_id="37c9"
+
+l="9,10,66"
+socket-mem="2048,2048 --legacy-mem"
+n=6
+
+vdev="crypto_aesni_mb_pmd_1"
+
+[test_fips_aesni_gcm_gcm]
+w="0000:af:00.0"
+req-file="/root/FIPS/GCM/req"
+rsp-file="/root/FIPS/GCM/resp"
+cryptodev="crypto_aesni_gcm_pmd_1"
+
+[test_fips_aesni_mb_3des]
+w="0000:af:00.0"
+req-file="/root/FIPS/TDES/req"
+rsp-file="/root/FIPS/TDES/resp"
+cryptodev="crypto_aesni_mb_pmd_1"
+
+[test_fips_aesni_mb_aes]
+w="0000:af:00.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+cryptodev="crypto_aesni_mb_pmd_1"
+
+[test_fips_aesni_mb_ccm]
+w="0000:af:00.0"
+req-file="/root/FIPS/CCM/req"
+rsp-file="/root/FIPS/CCM/resp"
+
+[test_fips_aesni_mb_cmac]
+w="0000:af:00.0"
+req-file="/root/FIPS/CMAC/req"
+rsp-file="/root/FIPS/CMAC/resp"
+
+[test_fips_aesni_mb_hmac]
+w="0000:af:00.0"
+req-file="/root/FIPS/HMAC/req"
+rsp-file="/root/FIPS/HMAC/resp"
+
+[test_fips_broken_test]
+w="0000:1a:01.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+
+[test_fips_openssl_3des]
+req-file="/root/FIPS/TDES/req"
+rsp-file="/root/FIPS/TDES/resp"
+
+[test_fips_openssl_aes]
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+
+[test_fips_openssl_ccm]
+req-file="/root/FIPS/CCM/req"
+rsp-file="/root/FIPS/CCM/resp"
+
+[test_fips_openssl_gcm]
+req-file="/root/FIPS/GCM/req"
+rsp-file="/root/FIPS/GCM/resp"
+
+[test_fips_openssl_hmac]
+req-file="/root/FIPS/HMAC/req"
+rsp-file="/root/FIPS/HMAC/resp"
+
+[test_fips_qat_3des]
+w="0000:1a:01.0"
+req-file="/root/FIPS/TDES/req"
+rsp-file="/root/FIPS/TDES/resp"
+
+[test_fips_qat_aes]
+w="0000:1a:01.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+
+[test_fips_qat_ccm]
+w="0000:1a:01.0"
+req-file="/root/FIPS/CCM/req"
+rsp-file="/root/FIPS/CCM/resp"
+
+[test_fips_qat_cmac]
+w="0000:1a:01.0"
+req-file="/root/FIPS/CMAC/req"
+rsp-file="/root/FIPS/CMAC/resp"
+
+[test_fips_qat_gcm]
+w="0000:1a:01.0"
+req-file="/root/FIPS/GCM/req"
+rsp-file="/root/FIPS/GCM/resp"
+
+[test_fips_qat_hmac]
+w="0000:1a:01.0"
+req-file="/root/FIPS/HMAC/req"
+rsp-file="/root/FIPS/HMAC/resp"
+
+[test_fips_self_test]
+w="0000:1a:01.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
-- 
2.17.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 3/3] add fips_cryptodev config
  2019-10-08  5:29 ` [dts] [PATCH V1 3/3] add fips_cryptodev config yaobing
@ 2019-10-09  0:50   ` Chen, Zhaoyan
  2019-10-10  5:36   ` Yao, BingX Y
  1 sibling, 0 replies; 10+ messages in thread
From: Chen, Zhaoyan @ 2019-10-09  0:50 UTC (permalink / raw)
  To: Yao, BingX Y, dts; +Cc: Yao, BingX Y, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yaobing
> Sent: Tuesday, October 8, 2019 1:29 PM
> To: dts@dpdk.org
> Cc: Yao, BingX Y <bingx.y.yao@intel.com>
> Subject: [dts] [PATCH V1 3/3] add fips_cryptodev config
> 
> add fips_cryptodev config
> 
> Signed-off-by: yaobing <bingx.y.yao@intel.com>
> ---
>  conf/fips_cryptodev.cfg | 102 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 102 insertions(+)
>  create mode 100644 conf/fips_cryptodev.cfg
> 
> diff --git a/conf/fips_cryptodev.cfg b/conf/fips_cryptodev.cfg new file mode 100644
> index 0000000..b3fd6b5
> --- /dev/null
> +++ b/conf/fips_cryptodev.cfg
> @@ -0,0 +1,102 @@
> +[suite]
> +# Cryptodev common options qat device idcrypto_dev_id="37c9"
> +crypto_dev_id="37c9"
> +
> +l="9,10,66"
> +socket-mem="2048,2048 --legacy-mem"
> +n=6
> +
> +vdev="crypto_aesni_mb_pmd_1"
> +
> +[test_fips_aesni_gcm_gcm]
> +w="0000:af:00.0"
> +req-file="/root/FIPS/GCM/req"
> +rsp-file="/root/FIPS/GCM/resp"
> +cryptodev="crypto_aesni_gcm_pmd_1"
> +
> +[test_fips_aesni_mb_3des]
> +w="0000:af:00.0"
> +req-file="/root/FIPS/TDES/req"
> +rsp-file="/root/FIPS/TDES/resp"
> +cryptodev="crypto_aesni_mb_pmd_1"
> +
> +[test_fips_aesni_mb_aes]
> +w="0000:af:00.0"
> +req-file="/root/FIPS/AES/req"
> +rsp-file="/root/FIPS/AES/resp"
> +cryptodev="crypto_aesni_mb_pmd_1"
> +
> +[test_fips_aesni_mb_ccm]
> +w="0000:af:00.0"
> +req-file="/root/FIPS/CCM/req"
> +rsp-file="/root/FIPS/CCM/resp"
> +
> +[test_fips_aesni_mb_cmac]
> +w="0000:af:00.0"
> +req-file="/root/FIPS/CMAC/req"
> +rsp-file="/root/FIPS/CMAC/resp"
> +
> +[test_fips_aesni_mb_hmac]
> +w="0000:af:00.0"
> +req-file="/root/FIPS/HMAC/req"
> +rsp-file="/root/FIPS/HMAC/resp"
> +
> +[test_fips_broken_test]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/AES/req"
> +rsp-file="/root/FIPS/AES/resp"
> +
> +[test_fips_openssl_3des]
> +req-file="/root/FIPS/TDES/req"
> +rsp-file="/root/FIPS/TDES/resp"
> +
> +[test_fips_openssl_aes]
> +req-file="/root/FIPS/AES/req"
> +rsp-file="/root/FIPS/AES/resp"
> +
> +[test_fips_openssl_ccm]
> +req-file="/root/FIPS/CCM/req"
> +rsp-file="/root/FIPS/CCM/resp"
> +
> +[test_fips_openssl_gcm]
> +req-file="/root/FIPS/GCM/req"
> +rsp-file="/root/FIPS/GCM/resp"
> +
> +[test_fips_openssl_hmac]
> +req-file="/root/FIPS/HMAC/req"
> +rsp-file="/root/FIPS/HMAC/resp"
> +
> +[test_fips_qat_3des]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/TDES/req"
> +rsp-file="/root/FIPS/TDES/resp"
> +
> +[test_fips_qat_aes]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/AES/req"
> +rsp-file="/root/FIPS/AES/resp"
> +
> +[test_fips_qat_ccm]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/CCM/req"
> +rsp-file="/root/FIPS/CCM/resp"
> +
> +[test_fips_qat_cmac]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/CMAC/req"
> +rsp-file="/root/FIPS/CMAC/resp"
> +
> +[test_fips_qat_gcm]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/GCM/req"
> +rsp-file="/root/FIPS/GCM/resp"
> +
> +[test_fips_qat_hmac]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/HMAC/req"
> +rsp-file="/root/FIPS/HMAC/resp"
> +
> +[test_fips_self_test]
> +w="0000:1a:01.0"
> +req-file="/root/FIPS/AES/req"
> +rsp-file="/root/FIPS/AES/resp"
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 2/3] add case suite fips_cryptodev
  2019-10-08  5:29 ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev yaobing
@ 2019-10-09  0:51   ` Chen, Zhaoyan
  2019-10-10  5:36   ` Yao, BingX Y
  1 sibling, 0 replies; 10+ messages in thread
From: Chen, Zhaoyan @ 2019-10-09  0:51 UTC (permalink / raw)
  To: Yao, BingX Y, dts; +Cc: Yao, BingX Y, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yaobing
> Sent: Tuesday, October 8, 2019 1:29 PM
> To: dts@dpdk.org
> Cc: Yao, BingX Y <bingx.y.yao@intel.com>
> Subject: [dts] [PATCH V1 2/3] add case suite fips_cryptodev
> 
> add case suite fips_cryptodev
> 
> Signed-off-by: yaobing <bingx.y.yao@intel.com>
> ---
>  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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 1/3] add fips environment variable
  2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
  2019-10-08  5:29 ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev yaobing
  2019-10-08  5:29 ` [dts] [PATCH V1 3/3] add fips_cryptodev config yaobing
@ 2019-10-09  0:51 ` Chen, Zhaoyan
  2019-10-10  5:36 ` Yao, BingX Y
  2019-10-12  5:42 ` Tu, Lijuan
  4 siblings, 0 replies; 10+ messages in thread
From: Chen, Zhaoyan @ 2019-10-09  0:51 UTC (permalink / raw)
  To: Yao, BingX Y, dts; +Cc: Yao, BingX Y, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yaobing
> Sent: Tuesday, October 8, 2019 1:29 PM
> To: dts@dpdk.org
> Cc: Yao, BingX Y <bingx.y.yao@intel.com>
> Subject: [dts] [PATCH V1 1/3] add fips environment variable
> 
> add fips_cryptodev environment variable
> 
> Signed-off-by: yaobing <bingx.y.yao@intel.com>
> ---
>  tests/cryptodev_common.py | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/tests/cryptodev_common.py b/tests/cryptodev_common.py index
> 2e86bca..f521fbe 100644
> --- a/tests/cryptodev_common.py
> +++ b/tests/cryptodev_common.py
> @@ -44,12 +44,30 @@ def build_dpdk_with_cryptodev(test_case):
>      if "kasumi_lib_path" in test_case.get_suite_cfg():
>          kasumi_lib_path = test_case.get_suite_cfg()["kasumi_lib_path"]
> 
> +    fip_cflags_path = "'-I/opt/openssl-fips-2.0.16/include/'"
> +    if "fip_cflags_path" in test_case.get_suite_cfg():
> +        fip_cflags_path = test_case.get_suite_cfg()["fip_cflags_path"]
> +
> +    fip_ldflags_path = "'-L/opt/openssl-fips-2.0.16/'"
> +    if "fip_ldflags_path" in test_case.get_suite_cfg():
> +        fip_cflags_path = test_case.get_suite_cfg()["fip_ldflags_path"]
> +
> +    fip_library_path = "/opt/openssl-fips-2.0.16/"
> +    if "fip_library_path" in test_case.get_suite_cfg():
> +        fip_cflags_path = test_case.get_suite_cfg()["fip_library_path"]
> +
>      test_case.dut.send_expect(
>          "export LIBSSO_SNOW3G_PATH={}".format(snow3g_lib_path), "#")
>      test_case.dut.send_expect(
>          "export LIBSSO_ZUC_PATH={}".format(zuc_lib_path), "#")
>      test_case.dut.send_expect(
>          "export LIBSSO_KASUMI_PATH={}".format(kasumi_lib_path), "#")
> +    test_case.dut.send_expect(
> +        "export EXTRA_CFLAGS={}".format(fip_cflags_path), "#")
> +    test_case.dut.send_expect(
> +        "export EXTRA_LDFLAGS={}".format(fip_ldflags_path), "#")
> +    test_case.dut.send_expect(
> +        "export LD_LIBRARY_PATH={}".format(fip_library_path), "#")
> 
>      test_case.dut.send_expect(
>          "sed -i
> 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AESNI_MB
> =y/' config/common_base", "# ")
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 3/3] add fips_cryptodev config
  2019-10-08  5:29 ` [dts] [PATCH V1 3/3] add fips_cryptodev config yaobing
  2019-10-09  0:50   ` Chen, Zhaoyan
@ 2019-10-10  5:36   ` Yao, BingX Y
  1 sibling, 0 replies; 10+ messages in thread
From: Yao, BingX Y @ 2019-10-10  5:36 UTC (permalink / raw)
  To: dts

[-- Attachment #1: Type: text/plain, Size: 3040 bytes --]

Tested-by: Yao, BingX Y <bingx.y.yao@intel.com>

-----Original Message-----
From: Yao, BingX Y 
Sent: Tuesday, October 8, 2019 1:29 PM
To: dts@dpdk.org
Cc: Yao, BingX Y <bingx.y.yao@intel.com>
Subject: [dts][PATCH V1 3/3] add fips_cryptodev config

add fips_cryptodev config

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 conf/fips_cryptodev.cfg | 102 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 conf/fips_cryptodev.cfg

diff --git a/conf/fips_cryptodev.cfg b/conf/fips_cryptodev.cfg new file mode 100644 index 0000000..b3fd6b5
--- /dev/null
+++ b/conf/fips_cryptodev.cfg
@@ -0,0 +1,102 @@
+[suite]
+# Cryptodev common options qat device idcrypto_dev_id="37c9"
+crypto_dev_id="37c9"
+
+l="9,10,66"
+socket-mem="2048,2048 --legacy-mem"
+n=6
+
+vdev="crypto_aesni_mb_pmd_1"
+
+[test_fips_aesni_gcm_gcm]
+w="0000:af:00.0"
+req-file="/root/FIPS/GCM/req"
+rsp-file="/root/FIPS/GCM/resp"
+cryptodev="crypto_aesni_gcm_pmd_1"
+
+[test_fips_aesni_mb_3des]
+w="0000:af:00.0"
+req-file="/root/FIPS/TDES/req"
+rsp-file="/root/FIPS/TDES/resp"
+cryptodev="crypto_aesni_mb_pmd_1"
+
+[test_fips_aesni_mb_aes]
+w="0000:af:00.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+cryptodev="crypto_aesni_mb_pmd_1"
+
+[test_fips_aesni_mb_ccm]
+w="0000:af:00.0"
+req-file="/root/FIPS/CCM/req"
+rsp-file="/root/FIPS/CCM/resp"
+
+[test_fips_aesni_mb_cmac]
+w="0000:af:00.0"
+req-file="/root/FIPS/CMAC/req"
+rsp-file="/root/FIPS/CMAC/resp"
+
+[test_fips_aesni_mb_hmac]
+w="0000:af:00.0"
+req-file="/root/FIPS/HMAC/req"
+rsp-file="/root/FIPS/HMAC/resp"
+
+[test_fips_broken_test]
+w="0000:1a:01.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+
+[test_fips_openssl_3des]
+req-file="/root/FIPS/TDES/req"
+rsp-file="/root/FIPS/TDES/resp"
+
+[test_fips_openssl_aes]
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+
+[test_fips_openssl_ccm]
+req-file="/root/FIPS/CCM/req"
+rsp-file="/root/FIPS/CCM/resp"
+
+[test_fips_openssl_gcm]
+req-file="/root/FIPS/GCM/req"
+rsp-file="/root/FIPS/GCM/resp"
+
+[test_fips_openssl_hmac]
+req-file="/root/FIPS/HMAC/req"
+rsp-file="/root/FIPS/HMAC/resp"
+
+[test_fips_qat_3des]
+w="0000:1a:01.0"
+req-file="/root/FIPS/TDES/req"
+rsp-file="/root/FIPS/TDES/resp"
+
+[test_fips_qat_aes]
+w="0000:1a:01.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
+
+[test_fips_qat_ccm]
+w="0000:1a:01.0"
+req-file="/root/FIPS/CCM/req"
+rsp-file="/root/FIPS/CCM/resp"
+
+[test_fips_qat_cmac]
+w="0000:1a:01.0"
+req-file="/root/FIPS/CMAC/req"
+rsp-file="/root/FIPS/CMAC/resp"
+
+[test_fips_qat_gcm]
+w="0000:1a:01.0"
+req-file="/root/FIPS/GCM/req"
+rsp-file="/root/FIPS/GCM/resp"
+
+[test_fips_qat_hmac]
+w="0000:1a:01.0"
+req-file="/root/FIPS/HMAC/req"
+rsp-file="/root/FIPS/HMAC/resp"
+
+[test_fips_self_test]
+w="0000:1a:01.0"
+req-file="/root/FIPS/AES/req"
+rsp-file="/root/FIPS/AES/resp"
--
2.17.2


[-- Attachment #2: FipCryptodev.log --]
[-- Type: application/octet-stream, Size: 831602 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 1/3] add fips environment variable
  2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
                   ` (2 preceding siblings ...)
  2019-10-09  0:51 ` [dts] [PATCH V1 1/3] add fips environment variable Chen, Zhaoyan
@ 2019-10-10  5:36 ` Yao, BingX Y
  2019-10-12  5:42 ` Tu, Lijuan
  4 siblings, 0 replies; 10+ messages in thread
From: Yao, BingX Y @ 2019-10-10  5:36 UTC (permalink / raw)
  To: dts

[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]

Tested-by: Yao, BingX Y <bingx.y.yao@intel.com>

-----Original Message-----
From: Yao, BingX Y 
Sent: Tuesday, October 8, 2019 1:29 PM
To: dts@dpdk.org
Cc: Yao, BingX Y <bingx.y.yao@intel.com>
Subject: [dts][PATCH V1 1/3] add fips environment variable

add fips_cryptodev environment variable

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 tests/cryptodev_common.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/cryptodev_common.py b/tests/cryptodev_common.py index 2e86bca..f521fbe 100644
--- a/tests/cryptodev_common.py
+++ b/tests/cryptodev_common.py
@@ -44,12 +44,30 @@ def build_dpdk_with_cryptodev(test_case):
     if "kasumi_lib_path" in test_case.get_suite_cfg():
         kasumi_lib_path = test_case.get_suite_cfg()["kasumi_lib_path"]
 
+    fip_cflags_path = "'-I/opt/openssl-fips-2.0.16/include/'"
+    if "fip_cflags_path" in test_case.get_suite_cfg():
+        fip_cflags_path = test_case.get_suite_cfg()["fip_cflags_path"]
+
+    fip_ldflags_path = "'-L/opt/openssl-fips-2.0.16/'"
+    if "fip_ldflags_path" in test_case.get_suite_cfg():
+        fip_cflags_path = test_case.get_suite_cfg()["fip_ldflags_path"]
+
+    fip_library_path = "/opt/openssl-fips-2.0.16/"
+    if "fip_library_path" in test_case.get_suite_cfg():
+        fip_cflags_path = test_case.get_suite_cfg()["fip_library_path"]
+
     test_case.dut.send_expect(
         "export LIBSSO_SNOW3G_PATH={}".format(snow3g_lib_path), "#")
     test_case.dut.send_expect(
         "export LIBSSO_ZUC_PATH={}".format(zuc_lib_path), "#")
     test_case.dut.send_expect(
         "export LIBSSO_KASUMI_PATH={}".format(kasumi_lib_path), "#")
+    test_case.dut.send_expect(
+        "export EXTRA_CFLAGS={}".format(fip_cflags_path), "#")
+    test_case.dut.send_expect(
+        "export EXTRA_LDFLAGS={}".format(fip_ldflags_path), "#")
+    test_case.dut.send_expect(
+        "export LD_LIBRARY_PATH={}".format(fip_library_path), "#")
 
     test_case.dut.send_expect(
         "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y/' config/common_base", "# ")
--
2.17.2


[-- Attachment #2: FipCryptodev.log --]
[-- Type: application/octet-stream, Size: 831602 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 2/3] add case suite fips_cryptodev
  2019-10-08  5:29 ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev yaobing
  2019-10-09  0:51   ` Chen, Zhaoyan
@ 2019-10-10  5:36   ` Yao, BingX Y
  1 sibling, 0 replies; 10+ messages in thread
From: Yao, BingX Y @ 2019-10-10  5:36 UTC (permalink / raw)
  To: dts

[-- Attachment #1: Type: text/plain, Size: 9029 bytes --]

Tested-by: Yao, BingX Y <bingx.y.yao@intel.com>

-----Original Message-----
From: Yao, BingX Y 
Sent: Tuesday, October 8, 2019 1:29 PM
To: dts@dpdk.org
Cc: Yao, BingX Y <bingx.y.yao@intel.com>
Subject: [dts][PATCH V1 2/3] add case suite fips_cryptodev

add case suite fips_cryptodev

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 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


[-- Attachment #2: FipCryptodev.log --]
[-- Type: application/octet-stream, Size: 831602 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dts] [PATCH V1 1/3] add fips environment variable
  2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
                   ` (3 preceding siblings ...)
  2019-10-10  5:36 ` Yao, BingX Y
@ 2019-10-12  5:42 ` Tu, Lijuan
  4 siblings, 0 replies; 10+ messages in thread
From: Tu, Lijuan @ 2019-10-12  5:42 UTC (permalink / raw)
  To: Yao, BingX Y, dts; +Cc: Yao, BingX Y

Applied the series, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yaobing
> Sent: Tuesday, October 8, 2019 1:29 PM
> To: dts@dpdk.org
> Cc: Yao, BingX Y <bingx.y.yao@intel.com>
> Subject: [dts] [PATCH V1 1/3] add fips environment variable
> 
> add fips_cryptodev environment variable
> 
> Signed-off-by: yaobing <bingx.y.yao@intel.com>
> ---
>  tests/cryptodev_common.py | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/tests/cryptodev_common.py b/tests/cryptodev_common.py index
> 2e86bca..f521fbe 100644
> --- a/tests/cryptodev_common.py
> +++ b/tests/cryptodev_common.py
> @@ -44,12 +44,30 @@ def build_dpdk_with_cryptodev(test_case):
>      if "kasumi_lib_path" in test_case.get_suite_cfg():
>          kasumi_lib_path = test_case.get_suite_cfg()["kasumi_lib_path"]
> 
> +    fip_cflags_path = "'-I/opt/openssl-fips-2.0.16/include/'"
> +    if "fip_cflags_path" in test_case.get_suite_cfg():
> +        fip_cflags_path = test_case.get_suite_cfg()["fip_cflags_path"]
> +
> +    fip_ldflags_path = "'-L/opt/openssl-fips-2.0.16/'"
> +    if "fip_ldflags_path" in test_case.get_suite_cfg():
> +        fip_cflags_path = test_case.get_suite_cfg()["fip_ldflags_path"]
> +
> +    fip_library_path = "/opt/openssl-fips-2.0.16/"
> +    if "fip_library_path" in test_case.get_suite_cfg():
> +        fip_cflags_path = test_case.get_suite_cfg()["fip_library_path"]
> +
>      test_case.dut.send_expect(
>          "export LIBSSO_SNOW3G_PATH={}".format(snow3g_lib_path), "#")
>      test_case.dut.send_expect(
>          "export LIBSSO_ZUC_PATH={}".format(zuc_lib_path), "#")
>      test_case.dut.send_expect(
>          "export LIBSSO_KASUMI_PATH={}".format(kasumi_lib_path), "#")
> +    test_case.dut.send_expect(
> +        "export EXTRA_CFLAGS={}".format(fip_cflags_path), "#")
> +    test_case.dut.send_expect(
> +        "export EXTRA_LDFLAGS={}".format(fip_ldflags_path), "#")
> +    test_case.dut.send_expect(
> +        "export LD_LIBRARY_PATH={}".format(fip_library_path), "#")
> 
>      test_case.dut.send_expect(
>          "sed -i
> 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n$/CONFIG_RTE_LIBRTE_PMD_AES
> NI_MB=y/' config/common_base", "# ")
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, back to index

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
2019-10-08  5:29 ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev yaobing
2019-10-09  0:51   ` Chen, Zhaoyan
2019-10-10  5:36   ` Yao, BingX Y
2019-10-08  5:29 ` [dts] [PATCH V1 3/3] add fips_cryptodev config yaobing
2019-10-09  0:50   ` Chen, Zhaoyan
2019-10-10  5:36   ` Yao, BingX Y
2019-10-09  0:51 ` [dts] [PATCH V1 1/3] add fips environment variable Chen, Zhaoyan
2019-10-10  5:36 ` Yao, BingX Y
2019-10-12  5:42 ` Tu, Lijuan

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox