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 83C49A0C56; Wed, 8 Sep 2021 14:01:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D75C4411E9; Wed, 8 Sep 2021 14:01:45 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80051.outbound.protection.outlook.com [40.107.8.51]) by mails.dpdk.org (Postfix) with ESMTP id 742A54118B for ; Wed, 8 Sep 2021 14:01:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBkiHGajZKesF0N+rhAhdyEE84F1lMf3JbX91O2zKvyBkGb2bKd+TDuX28GdcDT8eSsoSRkiiMQ6GxNSWUJE8GNy519ko2Y5PgCmKSOGiTq+9XhSZ64bYP8+6ZuudzkpXc4pPcCvpPwgwXAzpoNu5eO6uHMDpo/nZEEgs/bDNf3YjCtK9j3s4RXAJTF+zGXrQ/kxgICPEznJg8sdgcDz/3yzZBgOdP6TAgYPbKqlg5cX5MQTVWtRwiXVy8Edoq+/w+sh10TbtM68a/Pl9ftxHEbyo59WifmV8GQ+Q9kBAZIuZHh3hfs/iSYmrvroGDMv0nmvKzAZf0BPxjSD9Gipzg== 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=et5fa19B7FiN8SzygTtF0FkatDtaGEoZYx1g26ctUiYWw5EN0WDUSVjJPy/pzGf/dcOaPtDmNBzJqwOFIUbgdU4m7v96mKFNpOds0yp+Pc51V3LBBoJpdrkDOSYuW85FSVcU/wxYmRM7L5tGaDS4dM+S+CdeOzbL4v44j9xdY8vF1pH2FYCMKBkUMR/rCJFVq4C2cVXv9hjXoOE9e921u6kZzzXbXNEhOHI8anxVDCOWH1MTGm3xRM5X+1EVK6lmh76wQM+xE9R0bdNUF0MuhFyO/UFBADw+Mh/PoLOfVkfCGEzvpsI7xv3QJv1feLVwYIMrw/H2FKL4rQ0Wf/r+vA== 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=Lv+AXS5YFTxwtpXzhuJ0ivT/ShDthMlKTPwUs42lSfZ+Y7/dh+gPqTe0YQLMy8p0hVaeN96gYgV6XldIureKpjsBKeyLVr2xrlZoRJ9uktzPDdqjUL9+k5ZJkTvpX5EEcSMd5M4AFXZCBvBkS8mGxu6tzMM8MbrUPQEVFDNJ6rw= 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 VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Wed, 8 Sep 2021 12:01:42 +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:01:42 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: thomas@monjalon.net, Gagandeep Singh Date: Wed, 8 Sep 2021 17:31:13 +0530 Message-Id: <20210908120115.3548009-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210908120115.3548009-1-g.singh@nxp.com> References: <20210907085605.3010882-2-g.singh@nxp.com> <20210908120115.3548009-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0108.apcprd06.prod.outlook.com (2603:1096:3:14::34) 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 SG2PR06CA0108.apcprd06.prod.outlook.com (2603:1096:3:14::34) 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:01:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 671be98f-e0b4-4914-72e1-08d972c06bf1 X-MS-TrafficTypeDiagnostic: VI1PR04MB5631: 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: BQi3e9RTbtyTqZZjxvib+ORhCJVF1oHz6/L1QjBa0ENpeXuOWAuf0dz2Q7ww+sqLgsAY2Bvg+j1HSV3rMImg4D9Aw7Ert8gtNIIE8R//8k+S1jq1tpRGlATNWyvlggOtFonvrAxxS7B+J0ahJp/EpaflHhQx3oBwEXiHRvKLVZOATqXhtl5CuzOpoCO/bogXOG/Sh6U+sNSgJD7VP5jB5KEpbPPGcOKRM4tBFFP09qLWcLOVHMex6SyXq25eXyOy3zB14w23f9rXndaaRZkMN3VG2FRbC6TyH3LDbpbk0q6C92+IC4x6jqeV/0UC5qWnH2lbrQBHEomKwegsZjSb8gElOmEqd/G8D7UF3WAwhGI9qCs+AMny+15Dy9NTK2k/so/AoJ/p26ogU4kMFGw7aZMD7fue4fX3MJbnHYgsGX4aP358iRP9M+POTkRZqZDNChpF+U5XqFuOWIE713fP5sxX1E9BbVK9y+k1rXD+2FfESv9MTTQPC/9FMMfEsRYSCYXntNjUienHexN6cAmAI7Cex4Cz1Ao9DNId3KUvl0QxkUbBS6J4BjE7NiB2MsHlWL6yPtcXxOoaYUrt8WmkwiUPAwrGIbtHuYUPxNUJu6f04w1/M9TU1goDzKgTuz/7Pmb1N43KlDK3I04HdCzey10pfQlId6dE3HfxY/pgFbmgfPFNG4NKf6mmakaKdm/eTkEfE1Yu+g39Rl0mI1DhlaEcrEkiOkbVR9fFw5osMz8= 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)(38350700002)(83380400001)(52116002)(316002)(508600001)(8676002)(66556008)(4326008)(956004)(7696005)(66476007)(66946007)(36756003)(86362001)(8936002)(1006002)(15650500001)(55236004)(5660300002)(2906002)(1076003)(6666004)(38100700002)(26005)(6486002)(2616005)(186003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?P301utd6Fz1bERSj+PdQetHzAlvey9Jd4N0pZ0fEba7pak1xUElmXvIpJSYf?= =?us-ascii?Q?aio9uG3h0ewG5xN97O9+1kkG1K56VIEgQXD5B7Z6h8l+mGN0CUSGO4WPE97X?= =?us-ascii?Q?V+OhHrMSfTHsqSOS+D0aLjuwwLUTUGYAS7b90eMCndIxLaZ3TEnk/4VLQMoA?= =?us-ascii?Q?mFUZHFCFkt45zht71NNvRvmwcUwJXOqZOAR1ecT+x4pQAzSat6Z/z2xsud9M?= =?us-ascii?Q?dk7q5hegxaFk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5T3yADvYIY57?= =?us-ascii?Q?uz3TmcYUReYkHgMCmkBjln/SUynFz+AcMWaO4B1ShH/ozv4Hd6qx9bcCiMgO?= =?us-ascii?Q?ucnk5a5ufBPrgGG5D+33ZEZ/9Fps9ya6dOuVfLg/l1Cncxv/Fe5sUZNJ7zZa?= =?us-ascii?Q?mxXMVjloLf3hoU63DL45XF2LY9WfnClcjAlcl3An+e8V6IXFyuC32gEvDqUE?= =?us-ascii?Q?8Rh7JrPuk1MHdW8cD9HMEpdV?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 671be98f-e0b4-4914-72e1-08d972c06bf1 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:01:42.4389 (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: zarZ4b3Xu1mfsERqESk6illCg6DdWakLr5QINNXWIou7ePkBRTJoVUx7XP0IWGR4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5631 Subject: [dpdk-dev] [PATCH v3 2/4] 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