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 C0497A0C46; Tue, 7 Sep 2021 10:56:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D637B41130; Tue, 7 Sep 2021 10:56:36 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150078.outbound.protection.outlook.com [40.107.15.78]) by mails.dpdk.org (Postfix) with ESMTP id E25B741147 for ; Tue, 7 Sep 2021 10:56:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cy0EZjfKZkPiYiRwBVeP0lxQGv7Ga67PF1/wk15W3BstveUUfaR4O3InfQQFZWpGu+sxndu4qjTzT/G5t6PluI96tptd8rW3GujFks1J14OJ3LkMyqin3Axk6iFDIRlYRtwpC2crEe3JB+6K3TW4etyrSP7wBYLvF2mdJoLum04PiRXx6BfTGHDyKK+eu6QmM/1ScVA798N++JNa/cQqZzBVAtL5taRY+FdF8Ka7THUNoeClqV72UUD9VZFggTTQJwSNptZDc2QeQkprnfXodyECxJlcUYWE3AZ596XZqs0scyVk+GpwcXVMJic2vw9nSMkUAz1mVG4IPQL6q9wAAA== 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=29/v26WJwlb+620bXtnZdmlRvzIc0ObvYWe+LyXoa0w=; b=DJRVW4whuIRD2ovA/BaUpu2HgDEgkGnQx1gTMJzu3fYzk2ftDF8CTyAG0FuZAKBDi9hRhBrSTse971tBNdkTFvTzUuYboA9z5Eo99K8L7Qf4u2NzDYlnbbeFJpi1p8wjTtC/7k2k6gJRFMS1UR9AlNOjMefzBpRLkGBk4gFozSG2uMVUrq8PbWnA3wLVsoi+BT9qoxQda2wNrR251TTs37RVqVMPXujrh/yYFXmOTdGEnU4iyNBarqTiHBYAXjQBwABtMk2cpfVY5qC5hP1b4d/0GrBvkoVqKzd3AuuZ6HYitM0Q6zMGNRLVdFTMETYPU7V/MSVvDjdJbsxZe/kPAw== 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=FSGSo5qLAwLKjcb+KU2LTlYG/HwLOSirYkI4dAEuojAm7rweMXVkIxESBStrmZhyoxQyoZiH7BNRBeZx8MBi3Fs8AjOr4HsDP/kDE2/TJljNtTN1M6M+FKZIn0nHNSnsj++tXhq6abZGr8AGA2SoKkarRPicGkpJYN72doqHoRk= 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 VE1PR04MB7262.eurprd04.prod.outlook.com (2603:10a6:800:1ab::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21; Tue, 7 Sep 2021 08:56:32 +0000 Received: from VI1PR04MB6960.eurprd04.prod.outlook.com ([fe80::d496:fcce:f667:7aa7]) by VI1PR04MB6960.eurprd04.prod.outlook.com ([fe80::d496:fcce:f667:7aa7%7]) with mapi id 15.20.4478.025; Tue, 7 Sep 2021 08:56:32 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: thomas@monjalon.net, Gagandeep Singh Date: Tue, 7 Sep 2021 14:26:03 +0530 Message-Id: <20210907085605.3010882-4-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210907085605.3010882-1-g.singh@nxp.com> References: <20210826112315.1375237-1-g.singh@nxp.com> <20210907085605.3010882-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0133.apcprd04.prod.outlook.com (2603:1096:3:16::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 SG2PR04CA0133.apcprd04.prod.outlook.com (2603:1096:3:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 08:56:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34ed2cc8-596c-4a50-0ff5-08d971dd63ad X-MS-TrafficTypeDiagnostic: VE1PR04MB7262: 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: yPrPA1n2lrcFs3aO9OJNHeG7GRlakFkJBoW0WwE+6hsbFFwyiSO+3O0Kq2V/Uwf+5vAHOdXelL9qlKkVDr4MvlpxznhoiOJVoTcjdG7hE8eFbYQW46ehTOSHxkD91S7lwjiDinBAtUTGUio/6sXl+ToYBdim0ImYr8pxRm7tFXgNhkGmCb3S9mM3TW3lJjvvlzPZypazIjJeDwneaNC96hLBeg7mBkrQE4x1nIgWtFsGHfCWg5RaEyjNSWpk6oXDrdsiO15IqSqockeizwSczeybC3gjBhG8NRhgWW7Ckn1cE4MpjFN+LaBVPqrfjAQaFy7LoFHgSrZA0w5092HOR9CZOW4W7WLDduu7PrXypOvXw1j1oKUXyLPrrbhEcbY8d7PRT8bI5GlS7UQwV/z8Hu8bZZTQJirDtu6B/TrsWNGsGAAh0sbOF38NbJaLnwZBZLiI1e80CA6qxqEPP2blgCzaISepWZUFfX6D0XTQED734NdLA415jyNtvtnerupH2aZHtrzUvHW1VoCjAjaob6NVEBZT73AU3g3bUBYAv4sN2xk8xQPl9AfFzIBbxot6P4llIdQ5MMmn7inPXFeQGYImJdSjh47g0OI7Rj4OFjKp53eye4/4l3ROmNXhzoVhUzkv6olayhFKJae0ApNSRbBEJYuzNsgiUivxMMVSxmMg3VG+xlcmxMAlZMLKF1GAAGiZRWXmKZZLs9JMx+xaWl46U7bRHFap37Ls6OJLAAM= 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)(346002)(366004)(39860400002)(136003)(376002)(396003)(1076003)(1006002)(36756003)(55236004)(66556008)(66476007)(4326008)(38100700002)(6666004)(8676002)(52116002)(7696005)(8936002)(66946007)(38350700002)(5660300002)(478600001)(26005)(956004)(2616005)(6486002)(316002)(83380400001)(86362001)(2906002)(15650500001)(186003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TG/6yFRFGO4QcmTiFUg1WXO0/IY6xgR2zodL56pDDA0CANwfyJUGVWKgjsz4?= =?us-ascii?Q?wZLogg/8xu0NjSQua1SQXyzAFmlofMZOkPmfKl8aZYuGcwroLcNKIrD3UEN7?= =?us-ascii?Q?/Kbym6XZiXueSkguLY7bq1uP4RrXdsBJ1fRhnbjuWGsslc8of6vD77mzg7BB?= =?us-ascii?Q?Gk/gG3ptM9lWJr07dmKG3myl076UaDs4cA3IWrRiHinowBXgkWnl1V0FjVm2?= =?us-ascii?Q?V2qQUCtT6c9NGmkTNpqTnquImYpIRZmZxyuKg6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FUmp1XIIMsbJF3AzDRXMV6wpGKgg+tz8iMbH06yOx50uKPYk5KCghyDdkhT4?= =?us-ascii?Q?9CbsD3a3SelKipFTQvtspXVZN3Zp7KmZy9Bi78lsY/ayseLAHarVimor+OXv?= =?us-ascii?Q?zRPCSGR0sopdNLtSmdrh8MFDAcwIBh5bvl9IJXiFnt6y7IRtdJS6h15Wcrw/?= =?us-ascii?Q?j/CjrRaUR4Ri5TXHtwz8/3PI?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34ed2cc8-596c-4a50-0ff5-08d971dd63ad X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB6960.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 08:56:32.7436 (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: wyTD81Ab9ZrTtHTt0x20ThFO0QUUp/6mADa0G4WR4wB/v3k7/FbJsblP75a5iK0Z X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7262 Subject: [dpdk-dev] [PATCH v2 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