From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89750A0547; Wed, 8 Sep 2021 14:52:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18AAE4121E; Wed, 8 Sep 2021 14:51:57 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80075.outbound.protection.outlook.com [40.107.8.75]) by mails.dpdk.org (Postfix) with ESMTP id 510FE411A2 for ; Wed, 8 Sep 2021 14:51:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awyxb/euf2KMkwHh+6H2W+CYw3LgX7qq3kHLwVSNtW0KtY/qyO82tV/6lH+eg1orPODlECPzlrSg7cb8CdtEvif/cDmv/HaZsxwwJJCB2gkh0/Gb6ghXWFWGKyd9oliQ3U5tk+/hj7S9DM+2j20wKjahticxTFMnsY2PR0dPVnZeFwNjHVZ7F6g/vUmoxsoYkUkBARy/L8pBFpJH2XNOoL+s7smDKlbtRlowWzUQejXS9HXw+oOO2Jn45hNxw79Frd+QU2Lc+wDdlGS1aBakKRChX2mOEe2l58neB588yhVck4L49pjWw66vBnJzzaiSVp3w1rPerYuh4Fczt+Dzdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ov+ZI7Rea0+sTinuL2DIdxiX59moI1ezRA7y9Esdqcw=; b=kockzY6Oex+kun0l0tPLJgmxS4LCpTnqKpCeBEpT9eH7B3x1JqBvJBC87dktkmbDf05mVGufKkMRpRRYB9f6fH6vZHm7bKg9ogn3g5pqNd9H7VNSLgX0b73M3RGE1bXD+7sLNDAbrMFTmAgrcuPUP2BpeTcj+HlBFYJTU+ojh5I82IwkbkJKc6Tqxql6NC43Oms/jcBB8yYL/M1y0QydQVfJCEc9kfE/vn6XD1EY5HyPFAxJYl+Lq7IwJEw6Zb+0sQ7sEcglvKaFi/m3CwFnr51xKRfdXrgRWsmApBt//vGRAvWpyP7IidFINGOS+W1+Avtvvi4e40kCWQI5ARlqeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ov+ZI7Rea0+sTinuL2DIdxiX59moI1ezRA7y9Esdqcw=; b=cV064MzddBqeRUQoxuzOMW9Yc/30klqdFPhRNdk3IV8bpRqyqK7bnARnwa5EGvR7Ho06xNt/aybIf57uo2Ookeb+hEzippYFVl0fi1qwmBM5EgLiea+XuuznwdkFFI+zGdW3nL3Q1BvvWIn84bvY52htqmhOyToz8VCK167rLPw= Authentication-Results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB6960.eurprd04.prod.outlook.com (2603:10a6:803:12d::10) by VI1PR04MB3024.eurprd04.prod.outlook.com (2603:10a6:802:d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.24; Wed, 8 Sep 2021 12:51:53 +0000 Received: from VI1PR04MB6960.eurprd04.prod.outlook.com ([fe80::d496:fcce:f667:7aa7]) by VI1PR04MB6960.eurprd04.prod.outlook.com ([fe80::d496:fcce:f667:7aa7%8]) with mapi id 15.20.4500.015; Wed, 8 Sep 2021 12:51:53 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: thomas@monjalon.net, Gagandeep Singh Date: Wed, 8 Sep 2021 18:21:25 +0530 Message-Id: <20210908125127.3566886-4-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210908125127.3566886-1-g.singh@nxp.com> References: <20210908120115.3548009-2-g.singh@nxp.com> <20210908125127.3566886-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0144.apcprd03.prod.outlook.com (2603:1096:4:c8::17) To VI1PR04MB6960.eurprd04.prod.outlook.com (2603:10a6:803:12d::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03457.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR03CA0144.apcprd03.prod.outlook.com (2603:1096:4:c8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Wed, 8 Sep 2021 12:51:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 24daf4ca-43d8-4956-c96b-08d972c76eb0 X-MS-TrafficTypeDiagnostic: VI1PR04MB3024: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:321; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RZG8ZGPZf4V1e8F78T1cg/kgbtne7GadRhp9jETYrZYFIsYmngtVQnKt4CSLM+vniBkgvu0nA1KB6nGNg5nUCeyvTSv3MldIJ3/QT8oS8GRv5cdsfIDfys0F16s8W+lH3Tn1MNAKriaN/fpssazJDXCgoNS4y8hCDTV6mK7CYBjCtPGz5XX64Z05/qk9zYpjmfLTUhgYZssDoSRzBzKnkb8flgxCoX3IQB5XFJ7WpIlrA7RRZWlNy2+AUlufDxe22DhN8xwaX9PF8hyG8YW3KbP9+9gA3GUOggRN6ule7xbnXxqMfgqFEr3IIhBgnXG111lqGPt5i9d1LXjr7EyVrEgkC+lMTvFKuniqSUSzz/2DZ8BBjHtp6JdDdB2PcHp86c/nDRxOJVUlzjCnBCyeJ2dsVPJ8vm1zJib/nyAp4nbRcrmEpVH/jsW5BZdVoIB03/3D/gavrHeL/usJZLwKdz8FiqH+I4R7eY/4RMp9kCXlsJcDIkRtN8QfW1dH5C93BVPvB7S58jY4HYuI5iIcTYEo37xdJRbNV2QKEZpBdmmG73vk6wC2GYbXJsVnUoscEZOxMAY9nUQlm2jMtw8ofrSWpT4GHQTnt9Rj1B7zyNj7gZYXEbYSIm9aBECydYlomAzM/jAmpxEwKmr6Tx9LS6DBM5Pn25Vc42LlIyY0i/WiEv0ZtQucSBqYWT8i0uOTqn6XHVwSDl5WDfeB/QVhCFSuFr+cM5elqDvozheDG00= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB6960.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(396003)(346002)(366004)(136003)(38350700002)(5660300002)(8676002)(38100700002)(55236004)(66556008)(66946007)(186003)(478600001)(52116002)(7696005)(1076003)(26005)(316002)(66476007)(8936002)(1006002)(6666004)(36756003)(86362001)(2906002)(4326008)(6486002)(956004)(15650500001)(83380400001)(2616005)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?U/nMFPW3TrOYz49B1a0RlSz3NnzUF3chG93s4vfrfPqPmCJPWBi9cQqWt1Im?= =?us-ascii?Q?vOncS53P4lFBeEo9BBPD/fXqA5oj6+a6KNaZMtObkyCKygkr9GJj9FfWYuUS?= =?us-ascii?Q?ypd6Fl4It/c8D4mIrM6k+odr8+XZ900Gjut4nVVZ9ZxtpS5Fyv1Syrzy6fB/?= =?us-ascii?Q?2vWf4e8KgoedyLZCWDQYIpLEYQX6EgmD76LLcmgd4Zh7ZKjRzLn4ut+4iiLm?= =?us-ascii?Q?5yNI0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/Dbk9mVGlgpX?= =?us-ascii?Q?JbEZRuShSANM4xGxoD7+6xi4DtKhQHxC94gm5OX/ltsOYiTlX9TP3d7IovWe?= =?us-ascii?Q?U31vbydVO9sthdMud5FwIiXBHYj+eUtUif+k7pvxnGUcrO7D9ZnQJ2o5PYiW?= =?us-ascii?Q?epzinuEx6ZbHkyTuSpNv17Q9AemO+eGZpSug5OUr1a1Ajw7zQnKy7MHXt8xu?= =?us-ascii?Q?eTtjigbpYgWqqb+hbSpCFbXk?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24daf4ca-43d8-4956-c96b-08d972c76eb0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB6960.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 12:51:53.4766 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jz1s0q1LInGlyJU6dpais9o5cTNbf7YfyaIXtaiHV8Guhg6GoQpRzYDIBMz7E1p0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3024 Subject: [dpdk-dev] [PATCH v4 3/5] test/crypto: add pdcp security short MAC-I support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 support to test the pdcp short mac packets support in crypto. Signed-off-by: Gagandeep Singh --- 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