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 E8C35A0093 for ; Fri, 22 Apr 2022 05:51:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 830E6427FD; Fri, 22 Apr 2022 05:51:43 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20049.outbound.protection.outlook.com [40.107.2.49]) by mails.dpdk.org (Postfix) with ESMTP id A864242804; Fri, 22 Apr 2022 05:51:41 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a0O2IVfGg5gblTfgI0OW5fvKkczZ5vkjWt5iWjt4cFzs1KYvYf58byHhzxStqW+WKClpUmL0OrM3AP0Q25zQZtvUM+uGsIJdRGIraw4oNPzqeY22wrDcU6ofIJz1DWYI11NRisM279EgHWCXr+X+OEA+Zwn9hTLdqGd1p8XcDjaaqQkVJdUV27lUrD6MBpjBE2GNfPKLuC8xblDh6hzqkPAlAWhJt4/nitobZi0zcQ5jXhqAhW/CvKurxa3AuGVW75knTv3gpGwv96zeaHbiFKZwfNvt1jESfKMlQSOdDnF6esIwPIbB/r4BeWAgEXRuqJdHeUz8ULbsOujeywW4tQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lPctF8D0bjVtiokAgVqLEcuQ+6aFiXPOP1VviQzQzQo=; b=SVlYyYnQhTMOoy/avmV6/A6RSV/g6zYbf/SauYDxqfNkU2DSmy0sukNWwVK804dPo+80mYPI5Cgp2i1IKfIazB6YUSq2KH7MASWusiU/U4sG8pBYYgsKqfJT1ZGHKprmn8InZh7+iHPaCuGWywX3/TPlNyLrMJTScVRMy7TZWzww6N9AYEGtOI2x5TdathZSmvZlr1IdWtAnmJLNPHBdEk/DsDcEBcyA1aFVMmeK/mvMLJJrm8dnyTIP1YTSFqIVwDho04qbpAIoMaoVFXHyxRg7jpKOAkFXW30mwIF27aXFvjnvJnkkvutst+WCFNgI0bFN+OD9u28zGKO6bLO8Zg== 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=lPctF8D0bjVtiokAgVqLEcuQ+6aFiXPOP1VviQzQzQo=; b=OAVCfgx35ZI/nIll6hx+/7nWPzMWKCr8v9zj9igx+MeJ7HCNrbBWWWjOACtB8iZn+hO09iDYW6QiZ+0fW7wJpef4H8cBntVP6lYIRmf3tpZhQ949UNV2xDKwIaUmzkCFYMAZs2mvAXyUZKHrysD977vjVuH93cLwkIUN6gu9iDg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by DB7PR04MB4393.eurprd04.prod.outlook.com (2603:10a6:5:32::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Fri, 22 Apr 2022 03:51:40 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2%7]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 03:51:40 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH 04/14] crypto/dpaa2_sec: fix length for chain fd in raw sec driver Date: Fri, 22 Apr 2022 09:20:50 +0530 Message-Id: <20220422035100.3180870-4-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422035100.3180870-1-g.singh@nxp.com> References: <20220422035100.3180870-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1255a3fb-a7ac-4367-7eba-08da24136872 X-MS-TrafficTypeDiagnostic: DB7PR04MB4393:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oMydiRCt2PzO/lJLNcce233p6TqJaYAWXYglSeGcaeNpl3cpfU5bVs5LA2mlsm5NXeBrrGkbZSx59bZGcMlvftQIBIGW+DJSCBDkI9fxy+I+6NGH+8QH/nPXWZ4y+VJst1DQwtnB29D7xQuEiFSZJvmCGYJgajMI2+3aaSV/xPBKqIWE2cAT9+nXSMeSYSjYPcf4pshCkbPSXnMN5z3PLGriUT8HAeHRrv9Jv5//7IikNL7ShUlpahutrKczfovlETKKzOsBadE9lXO7XAW/DBi8SOIqA/670HjLy6MOeF5Le+n6J86J8uQYDcqG60Y70d4l8N8YFQuboX5YQBxMcwHfZY5BglBJLhi0ymGKH5R06Bm6dK02+Cld6yKAnLW0uNxfNLRtsjnJZNM0uiE3R2kYTMQihOyfGH2Ij11EB0Otx5e+rtf23JDwTFtkjayXYc8vAIV2unw9HOuUov4kGRmkjS8YNhpJHrHFD34BRGIdi6+LoA0ZdjLE1IFdFqJIYvNR4F0qo5cl9Z1Nqa60FUw6p9S9aZrPvdRPyLVqbHc4fm4h1qklI1PXkxXn9tQag+I9w8OdsarPvR9PpDw9PJvD4wsY6x1OD9cHQoNY8k4JBXtHpjNFuUT0eF22pAwe+89c/UEqstZyORZ5qkpXpp7glK9P6ktxRb6SqfIriBVdQqyUtm32JGpZEIS+i5D6WDf6LGRNG5oJMzO7SVdqfg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(5660300002)(36756003)(2616005)(6486002)(1076003)(8936002)(86362001)(316002)(52116002)(66946007)(26005)(6506007)(6512007)(186003)(66556008)(6666004)(66476007)(83380400001)(38350700002)(38100700002)(508600001)(4326008)(55236004)(2906002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tFBQSbnXnKyCYKrE5cxKm3QZSfKuz+z/9pdcWTXfzSIyWe4tdMotugqs3ybz?= =?us-ascii?Q?cKc6SivabBoraSESpwZLh5S6ANDFIdX8odCo5msOKZnSfqT0M4Xqk94Y03Cg?= =?us-ascii?Q?8ZBgJyn+yYGIeqq3VZwAcNCrIZtidkWki+LtFmwOQvQHjIaRPzr9bPKtNeEZ?= =?us-ascii?Q?I0oGnzsfN+eZKq+g0ltyNw083a4PXwx2M0EUYiZAbMzQvWn4quf+KAyvj6ZQ?= =?us-ascii?Q?h+J7MPHjR3T5oSpYnVa16NF+0qKLwApeoZOwPEN2CUxOSxitHGCj2zRBvvyB?= =?us-ascii?Q?eJKUCfpM34Bd6SQfQC6rSnK4jlrAwi5mkpLz3K3Vtiy8FBBxD6ISLNZA+Hiz?= =?us-ascii?Q?Nsi1xKMRJYuma7OKE8Yq/yDkwQrR1ZoWCoasN74n+q/klQWKYxPllXyCz/F9?= =?us-ascii?Q?dP+c6R6Vn2u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JRrzVHm1a20PU/HkEUH18b?= =?us-ascii?Q?mCP6q05bZ2fGbAN0GEB6Ist/jG1ZgIxpErCuSUN3N0ytRJqqXxSWM7hXh2k7?= =?us-ascii?Q?FTdKh+LhPS7SBVc5Xtv+3bTTR8hHgU8TwxctqQKLeBrH8fLjQhTUZzwvFdRE?= =?us-ascii?Q?aKEyaIT7EAauDIV1QN6BUe7dy5+6nH7WcQE0jdhKLoIRrnXh9uPRYyFmVW5x?= =?us-ascii?Q?GQ7n+c+HtMyp6LoPkSNNx5D1iC4+Tfm56eACW179ictPzHRgCpiqJFqmI8pA?= =?us-ascii?Q?q6wRIxrvsijeYfJXeBgiGmuihiwazrJ3dSSovmLiWTdWUghtvV8YNiiwVtVA?= =?us-ascii?Q?8/lwS+Hlw1VIkZvBhAhzhDSLP05ml7rKc1sdOHyQ9fR+b9egAO49PeDCOMWb?= =?us-ascii?Q?R3FBvDO9W//X6jdXxe0NuVfemR3EmsMir05nGinwPNUFH69zAmgBcLOuujhP?= =?us-ascii?Q?TSYdPCf6yg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1255a3fb-a7ac-4367-7eba-08da24136872 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 03:51:40.3846 (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: BMiyhBRkGUbCczaj70nEQBP1/nQQCLEZ2KmScD+pvSnOafhGtnPp5x9ksJg/hKRm X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4393 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org DPAA2 sec raw driver is calculating the wrong lengths while creating the FD for chain. This patch fixes lengths for chain FD. Fixes: aa6ec1fd8443 ("crypto/dpaa2_sec: support authenc with raw buffer API") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 74f2045637..e68a4875dd 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2022 NXP */ #include @@ -44,8 +44,8 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, uint16_t auth_hdr_len = ofs.ofs.cipher.head - ofs.ofs.auth.head; - uint16_t auth_tail_len = ofs.ofs.auth.tail; - uint32_t auth_only_len = (auth_tail_len << 16) | auth_hdr_len; + uint16_t auth_tail_len; + uint32_t auth_only_len; int icv_len = sess->digest_length; uint8_t *old_icv; uint8_t *iv_ptr = iv->va; @@ -55,6 +55,8 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, cipher_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; auth_len = data_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + auth_tail_len = auth_len - cipher_len - auth_hdr_len; + auth_only_len = (auth_tail_len << 16) | auth_hdr_len; /* first FLE entry used to store session ctxt */ fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE(2 * sgl->num), @@ -104,6 +106,7 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, DPAA2_SET_FLE_OFFSET(sge, 0); sge->length = dest_sgl->vec[i].len; } + sge->length -= ofs.ofs.cipher.tail; } else { /* Configure Output SGE for Encap/Decap */ DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova); @@ -117,6 +120,7 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, DPAA2_SET_FLE_OFFSET(sge, 0); sge->length = sgl->vec[i].len; } + sge->length -= ofs.ofs.cipher.tail; } if (sess->dir == DIR_ENC) { -- 2.25.1