From: Gagandeep Singh <g.singh@nxp.com>
To: gakhil@marvell.com, dev@dpdk.org
Cc: thomas@monjalon.net, Gagandeep Singh <g.singh@nxp.com>
Subject: [dpdk-dev] [PATCH v3 2/4] test/crypto: add pdcp security short MAC-I support
Date: Wed, 8 Sep 2021 17:31:13 +0530 [thread overview]
Message-ID: <20210908120115.3548009-3-g.singh@nxp.com> (raw)
In-Reply-To: <20210908120115.3548009-1-g.singh@nxp.com>
This patch add support to test the pdcp short mac
packets support in crypto.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
app/test/test_cryptodev.c | 48 ++++++++
...est_cryptodev_security_pdcp_test_vectors.h | 105 +++++++++++++++++-
2 files changed, 152 insertions(+), 1 deletion(-)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 9e823db1e6..16d770a17f 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -8767,6 +8767,50 @@ test_PDCP_SDAP_PROTO_encap_all(void)
return (all_err == TEST_SUCCESS) ? TEST_SUCCESS : TEST_FAILED;
}
+static int
+test_PDCP_PROTO_short_mac(void)
+{
+ int i = 0, size = 0;
+ int err, all_err = TEST_SUCCESS;
+ const struct pdcp_short_mac_test *cur_test;
+
+ size = RTE_DIM(list_pdcp_smac_tests);
+
+ for (i = 0; i < size; i++) {
+ cur_test = &list_pdcp_smac_tests[i];
+ err = test_pdcp_proto(
+ i, 0, RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+ RTE_CRYPTO_AUTH_OP_GENERATE, cur_test->data_in,
+ cur_test->in_len, cur_test->data_out,
+ cur_test->in_len + ((cur_test->auth_key) ? 4 : 0),
+ RTE_CRYPTO_CIPHER_NULL, NULL,
+ 0, cur_test->param.auth_alg,
+ cur_test->auth_key, cur_test->param.auth_key_len,
+ 0, cur_test->param.domain, 0, 0,
+ 0, 0, 0);
+ if (err) {
+ printf("\t%d) %s: Short MAC test failed\n",
+ cur_test->test_idx,
+ cur_test->param.name);
+ err = TEST_FAILED;
+ } else {
+ printf("\t%d) %s: Short MAC test PASS\n",
+ cur_test->test_idx,
+ cur_test->param.name);
+ rte_hexdump(stdout, "MAC I",
+ cur_test->data_out + cur_test->in_len + 2,
+ 2);
+ err = TEST_SUCCESS;
+ }
+ all_err += err;
+ }
+
+ printf("Success: %d, Failure: %d\n", size + all_err, -all_err);
+
+ return (all_err == TEST_SUCCESS) ? TEST_SUCCESS : TEST_FAILED;
+
+}
+
static int
test_PDCP_SDAP_PROTO_decap_all(void)
{
@@ -14039,6 +14083,8 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_PDCP_PROTO_short_mac),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_1_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
@@ -14279,6 +14325,8 @@ static struct unit_test_suite cryptodev_kasumi_testsuite = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_decryption_test_case_1_oop),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_PDCP_PROTO_short_mac),
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_cipher_auth_test_case_1),
diff --git a/app/test/test_cryptodev_security_pdcp_test_vectors.h b/app/test/test_cryptodev_security_pdcp_test_vectors.h
index 703076479d..81fd6e606b 100644
--- a/app/test/test_cryptodev_security_pdcp_test_vectors.h
+++ b/app/test/test_cryptodev_security_pdcp_test_vectors.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (C) 2015-2016 Freescale Semiconductor,Inc.
- * Copyright 2018-2019 NXP
+ * Copyright 2018-2021 NXP
*/
#ifndef SECURITY_PDCP_TEST_VECTOR_H_
@@ -28,6 +28,109 @@ struct pdcp_test_param {
const char *name;
};
+struct pdcp_short_mac_test {
+ uint32_t test_idx;
+ struct pdcp_short_mac_test_param {
+ enum rte_security_pdcp_domain domain;
+ enum rte_crypto_auth_algorithm auth_alg;
+ uint8_t auth_key_len;
+ const char *name;
+ } param;
+ const uint8_t *auth_key;
+ const uint8_t *data_in;
+ uint32_t in_len;
+ const uint8_t *data_out;
+};
+
+static const struct pdcp_short_mac_test list_pdcp_smac_tests[] = {
+ {
+ .test_idx = 1,
+ .param = {.name = "PDCP-SMAC SNOW3G UIA2",
+ .auth_alg = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
+ .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC,
+ .auth_key_len = 16,
+ },
+ .auth_key = (uint8_t[]){ 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5,
+ 0xb3, 0x00, 0x95, 0x2c, 0x49, 0x10,
+ 0x48, 0x81, 0xff, 0x48 },
+ .data_in = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39,
+ 0x38 },
+ .in_len = 7,
+ .data_out = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39,
+ 0x38, 0x56, 0xd2, 0x09, 0xae },
+ },
+
+ {
+ .test_idx = 2,
+ .param = {.name = "PDCP-SMAC AES CMAC 1",
+ .auth_alg = RTE_CRYPTO_AUTH_AES_CMAC,
+ .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC,
+ .auth_key_len = 16,
+ },
+ .auth_key = (uint8_t[]){ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 },
+ .data_in = (uint8_t[]){ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00 },
+ .in_len = 7,
+ .data_out = (uint8_t[]){ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x13, 0xf8, 0x4b, 0xea },
+ },
+
+ {
+ .test_idx = 3,
+ .param = {.name = "PDCP-SMAC AES CMAC 2",
+ .auth_alg = RTE_CRYPTO_AUTH_AES_CMAC,
+ .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC,
+ .auth_key_len = 16,
+ },
+ .auth_key = (uint8_t[]){ 0x16, 0xc1, 0x98, 0x14, 0x9a, 0x2c,
+ 0xf4, 0x12, 0x4f, 0xd4, 0x14, 0xec,
+ 0x72, 0x43, 0x29, 0x04 },
+ .data_in = (uint8_t[]){ 0x00, 0xc0, 0x00, 0x00, 0x00, 0x05,
+ 0x09, 0xe4 },
+ .in_len = 8,
+ .data_out = (uint8_t[]){ 0x00, 0xc0, 0x00, 0x00, 0x00, 0x05,
+ 0x09, 0xe4, 0xdd, 0xff, 0xde, 0xa9 },
+ },
+
+ {
+ .test_idx = 4,
+ .param = {.name = "PDCP-SMAC AES CMAC 3",
+ .auth_alg = RTE_CRYPTO_AUTH_AES_CMAC,
+ .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC,
+ .auth_key_len = 16,
+ },
+ .auth_key = (uint8_t[]){ 0xD3, 0xC5, 0xD5, 0x92, 0x32, 0x7F,
+ 0xB1, 0x1C, 0x40, 0x35, 0xC6, 0x68,
+ 0x0A, 0xF8, 0xC6, 0xD3 },
+ .data_in = (uint8_t[]){ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00 },
+ .in_len = 7,
+ .data_out = (uint8_t[]){ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x23, 0xea, 0x95, 0xb0 },
+ },
+
+ {
+ .test_idx = 5,
+ .param = {.name = "PDCP-SMAC NULL",
+ .auth_alg = RTE_CRYPTO_AUTH_NULL,
+ .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC,
+ .auth_key_len = 16,
+ },
+ .auth_key = (uint8_t[]){ 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5,
+ 0xB3, 0x00, 0x95, 0x2C, 0x49, 0x10,
+ 0x48, 0x81, 0xFF, 0x48
+ },
+ .data_in = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39,
+ 0x38 },
+ .in_len = 7,
+ .data_out = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39,
+ 0x38, 0x00, 0x00, 0x00, 0x00 },
+ },
+
+};
+
static struct pdcp_test_param pdcp_test_params[] = {
{
.name =
--
2.25.1
next prev parent reply other threads:[~2021-09-08 12:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 11:23 [dpdk-dev] [PATCH 0/5] support of MAC-I Gagandeep Singh
2021-08-26 11:23 ` [dpdk-dev] [PATCH 1/5] common/dpaax: fix IV value for shortMAC-I for SNOW algo Gagandeep Singh
2021-09-02 11:38 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-26 11:23 ` [dpdk-dev] [PATCH 2/5] security: add pdcp short MAC-I support Gagandeep Singh
2021-09-02 11:34 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-26 11:23 ` [dpdk-dev] [PATCH 3/5] test/crypto: add pdcp security " Gagandeep Singh
2021-08-26 11:23 ` [dpdk-dev] [PATCH 4/5] crypto/dpaa2_sec: add PDCP " Gagandeep Singh
2021-08-26 11:23 ` [dpdk-dev] [PATCH 5/5] crypto/dpaa_sec: add pdcp " Gagandeep Singh
2021-09-07 8:56 ` [dpdk-dev] [PATCH v2 0/5] support of MAC-I Gagandeep Singh
2021-09-07 8:56 ` [dpdk-dev] [PATCH v2 1/5] common/dpaax: fix IV value for shortMAC-I for SNOW algo Gagandeep Singh
2021-09-08 12:01 ` [dpdk-dev] [PATCH v3 0/4] support of MAC-I Gagandeep Singh
2021-09-08 12:01 ` [dpdk-dev] [PATCH v3 1/4] security: support PDCP short MAC-I Gagandeep Singh
2021-09-08 12:15 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-08 12:33 ` Gagandeep Singh
2021-09-08 12:51 ` [dpdk-dev] [PATCH v4 0/5] support of MAC-I Gagandeep Singh
2021-09-08 12:51 ` [dpdk-dev] [PATCH v4 1/5] crypto/dpaa2_sec: support integrity only case for PDCP Gagandeep Singh
2021-09-08 12:51 ` [dpdk-dev] [PATCH v4 2/5] security: add pdcp short MAC-I support Gagandeep Singh
2021-09-08 12:51 ` [dpdk-dev] [PATCH v4 3/5] test/crypto: add pdcp security " Gagandeep Singh
2021-09-08 12:51 ` [dpdk-dev] [PATCH v4 4/5] crypto/dpaa2_sec: add PDCP " Gagandeep Singh
2021-09-08 12:51 ` [dpdk-dev] [PATCH v4 5/5] crypto/dpaa_sec: add pdcp " Gagandeep Singh
2021-09-08 15:21 ` [dpdk-dev] [EXT] [PATCH v4 0/5] support of MAC-I Akhil Goyal
2021-09-08 12:01 ` Gagandeep Singh [this message]
2021-09-08 12:01 ` [dpdk-dev] [PATCH v3 3/4] crypto/dpaa2_sec: add PDCP short MAC-I support Gagandeep Singh
2021-09-08 12:01 ` [dpdk-dev] [PATCH v3 4/4] crypto/dpaa_sec: add pdcp " Gagandeep Singh
2021-09-07 8:56 ` [dpdk-dev] [PATCH v2 2/5] security: support PDCP short MAC-I Gagandeep Singh
2021-09-07 8:56 ` [dpdk-dev] [PATCH v2 3/5] test/crypto: add pdcp security short MAC-I support Gagandeep Singh
2021-09-07 8:56 ` [dpdk-dev] [PATCH v2 4/5] crypto/dpaa2_sec: add PDCP " Gagandeep Singh
2021-09-07 8:56 ` [dpdk-dev] [PATCH v2 5/5] crypto/dpaa_sec: add pdcp " Gagandeep Singh
2021-09-07 11:46 ` [dpdk-dev] [EXT] [PATCH v2 0/5] support of MAC-I 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=20210908120115.3548009-3-g.singh@nxp.com \
--to=g.singh@nxp.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=thomas@monjalon.net \
/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).