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 99392A0C43; Thu, 26 Aug 2021 13:23:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E830D41220; Thu, 26 Aug 2021 13:23:44 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10085.outbound.protection.outlook.com [40.107.1.85]) by mails.dpdk.org (Postfix) with ESMTP id 08EEB41215 for ; Thu, 26 Aug 2021 13:23:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KF2xtid+C3a67UcK0Wlm9xyE23DUzLS3euOIYQL3Gk7ydpxF+bzmlWD86OVGDDFDyRc2a079fdQn8AbDBAFMcqCaXJsZa6m05AQMN/cfQ9cQw63A1p0+kDMzh3J7/HfPZohOtYFYutF3YalXWZqmObxv2Kp/NPxPbRFTLvgWZ8wFWXVLMu1hGSrZlAIUrRUg/QyHsTuB68SQytDZ6B9UOXjY4mpbT+p0tgcmQk9AU3IHbhUeBsGiEQiTxCZS427JLJMcEHLhOjVJTz9AGxALEL+H6ypXpTa+YxDWwd+2QF82O7DOak77RAvh7ElhJaxrUFaM+IeDOG5K0NaRPSWUAA== 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:X-MS-Exchange-SenderADCheck; bh=29/v26WJwlb+620bXtnZdmlRvzIc0ObvYWe+LyXoa0w=; b=Po3LpKsjsvKVWDwVHCFX3iyx3TxNwi2i/6bhWSwxSjkRfEn4O3DScaONV/EZfocgKemr0cU8MVJeffbfpZRL5H//QL8ZvAmiLzjNk//mwvIYsboGJfIwxEWU54dhqvE5leAQnowg9p54yfcdVfjeou6rfusx2CIY0GW+8hCOmCZGLQW7mXSNhXHD1rSwN4PIppchpz3b6ALfyLUkpthRDcQI4pigubR7LzXirhsteF8QRTfFBExVnAD19WQAognxoAs7onDVGmUliqcgNT2YZ9jJR2+OuKrtJep2NYnMnwY5l5a7ydD/AadO7ITD9QKY4RBXAFvKu7YFBxQlkCMSTA== 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=29/v26WJwlb+620bXtnZdmlRvzIc0ObvYWe+LyXoa0w=; b=cwYqDhaAT79EbPrfmURxDHNT65pWEur+KxxGDZTVswDEIIGEv58r2C5DC706la+ruU7zW9F+L3lFvPPSpJBPB9NWv8T++pHd9eNSmsbpfSv1vTR1ZuBaIW+Nwyn8skEY6Lev4Byp1od9m2aj9PqGN+/jLwizSNfKHlUM5bMuoOE= 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 VI1PR04MB4477.eurprd04.prod.outlook.com (2603:10a6:803:6e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20; Thu, 26 Aug 2021 11:23:41 +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.4457.018; Thu, 26 Aug 2021 11:23:40 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: thomas@monjalon.net, Gagandeep Singh Date: Thu, 26 Aug 2021 16:53:13 +0530 Message-Id: <20210826112315.1375237-4-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210826112315.1375237-1-g.singh@nxp.com> References: <20210826112315.1375237-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0179.apcprd06.prod.outlook.com (2603:1096:1:1e::33) 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 SG2PR06CA0179.apcprd06.prod.outlook.com (2603:1096:1:1e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19 via Frontend Transport; Thu, 26 Aug 2021 11:23:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cdbf1ea-bc21-4fa6-a185-08d96883f49e X-MS-TrafficTypeDiagnostic: VI1PR04MB4477: 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: +MDzKhjxE7nG/cLZxVYQXIhNI6FZS+QEVZCwbOUAJYdZE/hA/selDu52Efk7gRB6sf/VKb8wDHaVxJA+vabkixUeUXJY9krWVkjeJCRUZ5vZv/xDA6il8EyXRhxnzM3mdPy3EVG7a7w22rsTlTTWFDver05/cftnsBEZprOrA/ItW/zmxqZiN8sESZ2JgGsiUJP8td2kQrTLjBOvZHCt/KcXfzJWg/FHLWp+0731J1CE60UiI8cFBUSGmXGN/KhlHKwsCY5kWWfBB94mTg2PggJCSGcH64VU5tYZlBUv1I+yopMAq57j3r4GZDW1mPU1c1XxYCntd1jYpTHQNusQQVg1QkBeubMF4l/mAF0oH7tjxMODkf3AS2CVFqGgfAewwe+KAAEojsAihmTjA31IzhSC0oiLVc3dDaSgevwL+y6BNyDpQ8E9V2NOrRn4oqOnl1zVMOpS38Oo6wTIeaLjeezoygH6OK5zm+uYi/INZSKfT1lZpHoZheLuJ5l9j9DLb5YTMN8c/Nxkrv1DoHQkAlD5For7yJCFNqi0pZKqaUKhypwBWmyI8d9zHKf0jvBg6kLhd9iG9sz0ryzCIPNFbZU1ZI8mZJ0LRXvKkExBA/P+vFc/+/4brlS0LGE6l8bjXaPKl3CDFlBXQVZSQrinvnF2uigrU3XFgRdWt1Lewa3rel4yXX+pwosPEqEbT+JNFXnC0o4/nOFiKVdzTnxFjLsGkwE7judUXIZTRP2LPTs= 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)(366004)(508600001)(55236004)(66946007)(8676002)(8936002)(66556008)(2616005)(26005)(86362001)(186003)(83380400001)(956004)(15650500001)(66476007)(6666004)(36756003)(52116002)(7696005)(1006002)(4326008)(5660300002)(2906002)(38100700002)(38350700002)(1076003)(316002)(6486002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?M7ds3pmVHuWq9Od9y3WPfU6DpQiVUMyhJ+bj0qHstcXmomVznbxU/26lUnKi?= =?us-ascii?Q?ZLmwM/IER//dCIWfirrKPXctiXrnySCU18OLQgePLz+1vGkYwGjS8AaWsDyK?= =?us-ascii?Q?653u3spnOzssxOemrnolKQ9k5v5cfiwc6IP+w6st1kSaquC8jpE63XQN/hzq?= =?us-ascii?Q?d6QAdHOrvV+r24v8zIosGFpAPBDoL4oH9uGOQOio4gop79O9DQitnB4+RqEX?= =?us-ascii?Q?Nlh2Zeb69AspDpLMqxMB4a3/hgdVUj0UNhcedfisw2K9H21/I381yqZR2Lj0?= =?us-ascii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+5vC8q5IN1efG+vl7l2a8Xz+idTnWaOJ?= =?us-ascii?Q?FAcvyjtohD8vOwOmHttWkpSQTVq9qAdqF+s7Ltb7+Os398RrdO7+ooO5QHaV?= =?us-ascii?Q?5ckMK1cSHNZu6w87R/LA7aOugMxtUBuD5bNDCXm3AbcicMe9zP5HR8LGNIkD?= =?us-ascii?Q?acAzPPAnrj35yM8i2l0dLjni?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cdbf1ea-bc21-4fa6-a185-08d96883f49e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB6960.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2021 11:23:40.6902 (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: T1tQz7/FgwFWB7KTuvIdL2bSYg5xpeJeOFppeEaGTo+A3OTcFhtoNqbV28MT3EP0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4477 Subject: [dpdk-dev] [PATCH 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 9ad0b37473..86809de90b 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -8768,6 +8768,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