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 87E82A2E8C for ; Thu, 5 Sep 2019 17:02:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1DFD41EFF4; Thu, 5 Sep 2019 17:02:23 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 733AF1EFF2 for ; Thu, 5 Sep 2019 17:02:22 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2DC4D1A04C5; Thu, 5 Sep 2019 17:02:22 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2FF991A02A4; Thu, 5 Sep 2019 17:02:18 +0200 (CEST) Received: from GDB1.ap.freescale.net (GDB1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 17BD7402FB; Thu, 5 Sep 2019 23:02:13 +0800 (SGT) From: Akhil Goyal To: dev@dpdk.org Cc: hemant.agrawal@nxp.com, anoobj@marvell.com, jerinj@marvell.com, declan.doherty@intel.com, konstantin.ananyev@intel.com, vakul.garg@nxp.com, Akhil Goyal Date: Thu, 5 Sep 2019 20:17:49 +0530 Message-Id: <20190905144754.10188-3-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190905144754.10188-1-akhil.goyal@nxp.com> References: <20190903164911.32091-1-akhil.goyal@nxp.com> <20190905144754.10188-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/7] test/crypto: Add PDCP cplane decap cases X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch add test cases for control plane PDCP 5 and 12 bit SN test cases for decapsulation of cipher+integrity for all algo combinations Test vectors are reused from the encap cases by swapping the input and output data. The case are added to DPAA_SEC and DPAA2_SEC testsuite. Signed-off-by: Akhil Goyal Signed-off-by: Vakul Garg Signed-off-by: Hemant Agrawal --- app/test/test_cryptodev.c | 18 +++ app/test/test_cryptodev_security_pdcp.c | 105 ++++++++++++++++++ .../test_cryptodev_security_pdcp_test_func.h | 2 + 3 files changed, 125 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 852ca5cbe..14a090667 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -7218,6 +7218,18 @@ test_pdcp_proto_cplane_encap(int i) pdcp_test_data_in_len[i]+4); } +int +test_pdcp_proto_cplane_decap(int i) +{ + return test_pdcp_proto(i, 0, + RTE_CRYPTO_CIPHER_OP_DECRYPT, + RTE_CRYPTO_AUTH_OP_VERIFY, + pdcp_test_data_out[i], + pdcp_test_data_in_len[i] + 4, + pdcp_test_data_in[i], + pdcp_test_data_in_len[i]); +} + #endif static int @@ -11635,6 +11647,9 @@ static struct unit_test_suite cryptodev_dpaa_sec_testsuite = { #ifdef RTE_LIBRTE_SECURITY TEST_CASE_ST(ut_setup, ut_teardown, test_PDCP_PROTO_cplane_encap_all), + + TEST_CASE_ST(ut_setup, ut_teardown, + test_PDCP_PROTO_cplane_decap_all), #endif /** AES GCM Authenticated Encryption */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -11744,6 +11759,9 @@ static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = { #ifdef RTE_LIBRTE_SECURITY TEST_CASE_ST(ut_setup, ut_teardown, test_PDCP_PROTO_cplane_encap_all), + + TEST_CASE_ST(ut_setup, ut_teardown, + test_PDCP_PROTO_cplane_decap_all), #endif /** AES GCM Authenticated Encryption */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_security_pdcp.c b/app/test/test_cryptodev_security_pdcp.c index d79dd9055..f69a4db69 100644 --- a/app/test/test_cryptodev_security_pdcp.c +++ b/app/test/test_cryptodev_security_pdcp.c @@ -48,6 +48,31 @@ static int cplane_encap(uint32_t sn_size, uint8_t dir, return test_pdcp_proto_cplane_encap(i); } +static int +cplane_decap(uint32_t sn_size, uint8_t dir, + enum enc_alg_off enc_alg_off, + enum auth_alg_off auth_alg_off) +{ + int i = 0; + + switch (sn_size) { + case 5: + i = PDCP_CPLANE_OFFSET + enc_alg_off + + auth_alg_off + ((dir == 0) ? + UPLINK : DOWNLINK); + break; + case 12: + i = PDCP_CPLANE_LONG_SN_OFFSET + enc_alg_off + + auth_alg_off + ((dir == 0) ? + UPLINK : DOWNLINK); + break; + default: + printf("\nInvalid SN: %u for %s\n", sn_size, __func__); + } + + return test_pdcp_proto_cplane_decap(i); +} + #define TEST_PDCP_COUNT(func) do { \ if (func == TEST_SUCCESS) { \ printf("\t%d)", n++); \ @@ -139,3 +164,83 @@ test_PDCP_PROTO_cplane_encap_all(void) return n - i; }; +int +test_PDCP_PROTO_cplane_decap_all(void) +{ + int i = 0, n = 0; + + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, NULL_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, NULL_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, NULL_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, NULL_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, NULL_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, NULL_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, NULL_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, NULL_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, SNOW_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, SNOW_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, SNOW_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, SNOW_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, SNOW_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, SNOW_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, SNOW_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, SNOW_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, AES_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, AES_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, AES_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, AES_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, AES_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, AES_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, AES_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, AES_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, ZUC_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, ZUC_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, ZUC_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, ZUC_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, ZUC_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, ZUC_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, UPLINK, ZUC_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(5, DOWNLINK, ZUC_ENC, ZUC_AUTH)); + + /* C-plane 12-bit */ + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, NULL_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, NULL_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, NULL_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, NULL_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, NULL_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, NULL_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, NULL_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, NULL_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, SNOW_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, SNOW_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, SNOW_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, SNOW_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, SNOW_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, SNOW_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, SNOW_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, SNOW_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, AES_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, AES_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, AES_ENC, SNOW_AUTH)); + + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, AES_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, AES_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, AES_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, AES_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, AES_ENC, ZUC_AUTH)); + + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, ZUC_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, ZUC_ENC, NULL_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, ZUC_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, ZUC_ENC, SNOW_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, ZUC_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, ZUC_ENC, AES_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, UPLINK, ZUC_ENC, ZUC_AUTH)); + TEST_PDCP_COUNT(cplane_decap(12, DOWNLINK, ZUC_ENC, ZUC_AUTH)); + + if (n - i) + printf("## %s: %d passed out of %d\n", __func__, i, n); + + return n - i; +}; + diff --git a/app/test/test_cryptodev_security_pdcp_test_func.h b/app/test/test_cryptodev_security_pdcp_test_func.h index ad1e7c70a..21a6e8a48 100644 --- a/app/test/test_cryptodev_security_pdcp_test_func.h +++ b/app/test/test_cryptodev_security_pdcp_test_func.h @@ -30,7 +30,9 @@ enum auth_alg_off { }; int test_pdcp_proto_cplane_encap(int i); +int test_pdcp_proto_cplane_decap(int i); int test_PDCP_PROTO_cplane_encap_all(void); +int test_PDCP_PROTO_cplane_decap_all(void); #endif /* SECURITY_PDCP_TEST_FUNC_H_ */ -- 2.17.1