From: Akhil Goyal <akhil.goyal@nxp.com>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, anoobj@marvell.com,
konstantin.ananyev@intel.com, Akhil Goyal <akhil.goyal@nxp.com>,
Vakul Garg <vakul.garg@nxp.com>
Subject: [dpdk-dev] [PATCH v2 5/7] test/crypto: add PDCP uplane decap cases
Date: Tue, 1 Oct 2019 00:57:44 +0530 [thread overview]
Message-ID: <20190930192746.16815-6-akhil.goyal@nxp.com> (raw)
In-Reply-To: <20190930192746.16815-1-akhil.goyal@nxp.com>
This patch add test cases for user plane PDCP
5/7/12/15/18 bit SN test cases for decapsulation of
cipher only and 12/18 bit for 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 <akhil.goyal@nxp.com>
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
---
app/test/test_cryptodev.c | 30 +++
app/test/test_cryptodev_security_pdcp.c | 173 ++++++++++++++++++
.../test_cryptodev_security_pdcp_test_func.h | 3 +
3 files changed, 206 insertions(+)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 4666317aa..afc296bf9 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -7252,6 +7252,30 @@ test_pdcp_proto_cplane_decap(int i)
pdcp_test_data_in_len[i]);
}
+int
+test_pdcp_proto_uplane_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],
+ pdcp_test_data_in[i],
+ pdcp_test_data_in_len[i]);
+}
+
+int
+test_pdcp_proto_uplane_decap_with_int(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
@@ -11675,6 +11699,9 @@ static struct unit_test_suite cryptodev_dpaa_sec_testsuite = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_PDCP_PROTO_uplane_encap_all),
+
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_PDCP_PROTO_uplane_decap_all),
#endif
/** AES GCM Authenticated Encryption */
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -11790,6 +11817,9 @@ static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_PDCP_PROTO_uplane_encap_all),
+
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_PDCP_PROTO_uplane_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 e1ba2bf6e..30f3eb892 100644
--- a/app/test/test_cryptodev_security_pdcp.c
+++ b/app/test/test_cryptodev_security_pdcp.c
@@ -99,6 +99,33 @@ static int uplane_encap_no_integrity(uint32_t sn_size, uint8_t dir,
return test_pdcp_proto_uplane_encap(i);
}
+static int
+uplane_decap_no_integrity(uint32_t sn_size, uint8_t dir,
+ enum enc_alg_off enc_alg_off)
+{
+ int i = PDCP_UPLANE_OFFSET + ((dir == 0) ? UPLINK : DOWNLINK) +
+ enc_alg_off;
+
+ switch (sn_size) {
+ case 7:
+ i += SHORT_SEQ_NUM_OFFSET;
+ break;
+ case 15:
+ i += FIFTEEN_BIT_SEQ_NUM_OFFSET;
+ break;
+ case 12:
+ i += LONG_SEQ_NUM_OFFSET;
+ break;
+ case 18:
+ i += EIGHTEEN_BIT_SEQ_NUM_OFFSET;
+ break;
+ default:
+ printf("\nInvalid SN: %u\n", sn_size);
+ }
+
+ return test_pdcp_proto_uplane_decap(i);
+}
+
static int
uplane_encap_with_integrity(uint32_t sn_size, uint8_t dir,
enum enc_alg_off enc_alg_off,
@@ -124,6 +151,31 @@ uplane_encap_with_integrity(uint32_t sn_size, uint8_t dir,
return test_pdcp_proto_uplane_encap_with_int(i);
}
+static int
+uplane_decap_with_integrity(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 12:
+ i = PDCP_UPLANE_12BIT_OFFSET + enc_alg_off +
+ auth_alg_off + ((dir == 0) ?
+ UPLINK : DOWNLINK);
+ break;
+ case 18:
+ i = PDCP_UPLANE_18BIT_OFFSET + enc_alg_off +
+ auth_alg_off + ((dir == 0) ?
+ UPLINK : DOWNLINK);
+ break;
+ default:
+ printf("\nInvalid SN: %u\n", sn_size);
+ }
+
+ return test_pdcp_proto_uplane_decap_with_int(i);
+}
+
#define TEST_PDCP_COUNT(func) do { \
if (func == TEST_SUCCESS) { \
printf("\t%d)", n++); \
@@ -415,3 +467,124 @@ test_PDCP_PROTO_uplane_encap_all(void)
return n - i;
};
+
+int
+test_PDCP_PROTO_uplane_decap_all(void)
+{
+ int i = 0, n = 0;
+
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, UPLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, DOWNLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, UPLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, DOWNLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, UPLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, DOWNLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, UPLINK, NULL_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, DOWNLINK, NULL_ENC));
+
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, UPLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, DOWNLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, UPLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, DOWNLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, UPLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, DOWNLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, UPLINK, SNOW_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, DOWNLINK, SNOW_ENC));
+
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, UPLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, DOWNLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, UPLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, DOWNLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, UPLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, DOWNLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, UPLINK, AES_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, DOWNLINK, AES_ENC));
+
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, UPLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(12, DOWNLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, UPLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(7, DOWNLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, UPLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(15, DOWNLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, UPLINK, ZUC_ENC));
+ TEST_PDCP_COUNT(uplane_decap_no_integrity(18, DOWNLINK, ZUC_ENC));
+
+ /* u-plane 12-bit with integrity */
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, NULL_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, NULL_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, NULL_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, NULL_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, NULL_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, NULL_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, NULL_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, NULL_ENC, ZUC_AUTH));
+
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, SNOW_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, SNOW_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, SNOW_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, SNOW_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, SNOW_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, SNOW_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, SNOW_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, SNOW_ENC, ZUC_AUTH));
+
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, AES_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, AES_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, AES_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, AES_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, AES_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, AES_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, AES_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, AES_ENC, ZUC_AUTH));
+
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, ZUC_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, ZUC_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, ZUC_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, ZUC_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, ZUC_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, ZUC_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, UPLINK, ZUC_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(12, DOWNLINK, ZUC_ENC, ZUC_AUTH));
+
+ /* u-plane 18-bit with integrity */
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, NULL_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, NULL_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, NULL_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, NULL_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, NULL_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, NULL_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, NULL_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, NULL_ENC, ZUC_AUTH));
+
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, SNOW_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, SNOW_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, SNOW_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, SNOW_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, SNOW_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, SNOW_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, SNOW_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, SNOW_ENC, ZUC_AUTH));
+
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, AES_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, AES_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, AES_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, AES_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, AES_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, AES_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, AES_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, AES_ENC, ZUC_AUTH));
+
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, ZUC_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, ZUC_ENC, NULL_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, ZUC_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, ZUC_ENC, SNOW_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, ZUC_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, DOWNLINK, ZUC_ENC, AES_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, UPLINK, ZUC_ENC, ZUC_AUTH));
+ TEST_PDCP_COUNT(uplane_decap_with_integrity(18, 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 473cdaecc..f3dc93e2f 100644
--- a/app/test/test_cryptodev_security_pdcp_test_func.h
+++ b/app/test/test_cryptodev_security_pdcp_test_func.h
@@ -37,9 +37,12 @@ int test_pdcp_proto_cplane_encap(int i);
int test_pdcp_proto_uplane_encap(int i);
int test_pdcp_proto_uplane_encap_with_int(int i);
int test_pdcp_proto_cplane_decap(int i);
+int test_pdcp_proto_uplane_decap(int i);
+int test_pdcp_proto_uplane_decap_with_int(int i);
int test_PDCP_PROTO_cplane_encap_all(void);
int test_PDCP_PROTO_cplane_decap_all(void);
int test_PDCP_PROTO_uplane_encap_all(void);
+int test_PDCP_PROTO_uplane_decap_all(void);
#endif /* SECURITY_PDCP_TEST_FUNC_H_ */
--
2.17.1
next prev parent reply other threads:[~2019-09-30 19:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-03 16:49 [dpdk-dev] [PATCH] test/crypto: add PDCP vectors and cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 0/7] Add PDCP test cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 1/7] test/crypto: Add PDCP cplane encap cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 2/7] test/crypto: Add PDCP cplane decap cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 3/7] test/crypto: Add PDCP uplane encap cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 4/7] test/crypto: Add PDCP uplane encap with integrity cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 5/7] test/crypto: Add PDCP uplane decap cases Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 6/7] test/crypto: Add PDCP cases for scatter gather bufs Akhil Goyal
2019-09-05 14:47 ` [dpdk-dev] [PATCH 7/7] test/crypto: support wireless algos for dpaa2_sec Akhil Goyal
2019-09-19 15:23 ` [dpdk-dev] [PATCH 0/7] Add PDCP test cases Akhil Goyal
2019-09-30 10:44 ` Nipun Gupta
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 " Akhil Goyal
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 1/7] test/crypto: add PDCP cplane encap cases Akhil Goyal
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 2/7] test/crypto: add PDCP cplane decap cases Akhil Goyal
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 3/7] test/crypto: add PDCP uplane encap cases Akhil Goyal
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 4/7] test/crypto: add PDCP uplane encap with integrity cases Akhil Goyal
2019-09-30 19:27 ` Akhil Goyal [this message]
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 6/7] test/crypto: add PDCP cases for scatter gather bufs Akhil Goyal
2019-09-30 19:27 ` [dpdk-dev] [PATCH v2 7/7] test/crypto: support wireless algos for dpaa2-sec Akhil Goyal
2019-09-30 20:30 ` [dpdk-dev] [PATCH v2 0/7] Add PDCP test cases Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190930192746.16815-6-akhil.goyal@nxp.com \
--to=akhil.goyal@nxp.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=konstantin.ananyev@intel.com \
--cc=vakul.garg@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).