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 55EB0A0093 for ; Thu, 21 Apr 2022 14:01:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5198040040; Thu, 21 Apr 2022 14:01:06 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20063.outbound.protection.outlook.com [40.107.2.63]) by mails.dpdk.org (Postfix) with ESMTP id 04450427EE for ; Thu, 21 Apr 2022 14:01:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nEyzuFFWxlIwxDobyvhzXa9squbySIJ8fApCF8AW5hnFPcvmN9m24kz8ap/9x41HCwY24giqkHZ8HXLuiai8SXWE9CNmp3itHfNjeWbrBBlIm+1NuDVfdKrodDTChP6KoPXpC0H5/NOai6cpdCizIqxRVEXdNycOAUhlJrs1ebwe6VBh0G0p/DpziZvGldnWKBTRE/JFuFrqYte+4CL3QRRn4E3+6sVSG++y1JF5IiTxSPqNpOn96ysklZ2aO6OM6EpTSC5I00+eumgW5gUO3fouGsZXjuE5BOOM1gvpnPF9opWxPddyNPSYxjBPZ6hhoE/g5r/9wEK9AVI5Iwx2Wg== 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=/jWTJ+8y7eqN4JZqhHKI/bOc45P/Isbhn7aUgvrHXpk=; b=RT/Mg3c/CfxsvUQGqNDawzEMd1vnf9kpftlnGtc7qzyDl5uStL5udV1RwtVf1ZiypEpqNgUKf2zBFebHYsxNq0N/Y6HXn71wqafHcpVrZE2Yjj3jyx4LMgXI9gNwbwMyciqoU5kytQaOQPjtk1YianNrkAD/DhwjfoRCXIesGylw2LJg1lEtOSfg2KuXyCkRcSIGtTFNHTvHufO+o3KiK7AjT7IoIWVP2khOW759B07XJ/zupxZyckUIqAYMXeGxlfDM0iRNOa7duQwKZe5K5BKU37yl19YYpTQrh3LhhR163XcQP6ZHSrau5HB/am4kQuU3ws59XttHcuJ205kWPQ== 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=/jWTJ+8y7eqN4JZqhHKI/bOc45P/Isbhn7aUgvrHXpk=; b=mcHwiGwduUA0IAkBrcNXfjuEeBZDOwdg/W811dE9QAAZ/U5TXsIw/Zkgaug6y+2e4S+Q6yOxmfZjpcEkCxg/yKgWStFwOjaL4e6TJtpAll6ClHr8rV+N+e+6Z2YHyD58Ga3GMuVN6s/vaLk6BLUT/QP1Fea5XQCTn4knvAaHr84= 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 AS8PR04MB8054.eurprd04.prod.outlook.com (2603:10a6:20b:2a8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 21 Apr 2022 12:01:04 +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.014; Thu, 21 Apr 2022 12:01:04 +0000 From: Gagandeep Singh To: dpdk-up@NXP1.onmicrosoft.com Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH 03/15] crypto/dpaa_sec: fix length for chain fd in raw sec driver Date: Thu, 21 Apr 2022 17:30:31 +0530 Message-Id: <20220421120043.2565227-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421120043.2565227-1-g.singh@nxp.com> References: <20220421120043.2565227-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0167.apcprd04.prod.outlook.com (2603:1096:4::29) 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: 7bec6cc0-27a8-482e-01bf-08da238e9c21 X-MS-TrafficTypeDiagnostic: AS8PR04MB8054: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: f2tc3kiY8bA1SgH2dTg0L6/aHaDJbG95tUz6Vqf3KLfC8s/ECJK0BxPLdMLrMmlI6WfvT92fdk5l5utRWoxOdS+iUAIKmeugnXiXy3V6zrlZnePjgQ5+kIs70rC6KMC/r5JC4eAdG36lPj4Rg/4HFqIft5+08uS1TM4K5BPdIoEz77blMmqDZuD6H3ETgyLTctuBORYv1mh/03gkTk1Ppuu2OcgFO6TPBHSSVMTO2tBHyvjWv425tS0M8Y+DHkne6cm12XXAReQfcSbc3kRRpSgLtSNDyDybT131AlGTLZ1XS4atRQ+phXUYCvuPUTtuYlAF+98TyplmP8r5nuyRx1du1UVhI3JHGxyPBHeOkF2X/0Mk7gEBdnJUo+9sWs+K6Va4esSNd+xsurMN2uy8SPsYaPw61qQdjw642oIGzUdocRh9+IEs9HfT1qcCzQMxKZUJHwTM19583CUDIxda5Lsk/c9jZHlUUVJ3vKIPnQNcmKq7KWkqUeKoVrA5C9P6u0q8s0+qHgS/FrxrwFlynqy0aro5cP+dwPwEUscnqaCNjg/xEymyRfo4bvQju1z86W3IPS85chiRFK5s3q6pvUvnr0wVHx1kdmNZFnI5Ltq5+vmoBKLjQJrItRV4BU+wMBSvNE5Zqb+Z6Eg53OOzFBq9S1xgL2CEXg71EPJYR2Sd1jO/qRd++JO/8vchFE2NYuGKAiApBXax2YWncVs40g== 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)(2616005)(86362001)(316002)(8936002)(5660300002)(6486002)(2906002)(83380400001)(52116002)(66476007)(8676002)(55236004)(6512007)(1076003)(186003)(38350700002)(38100700002)(4326008)(34206002)(26005)(6506007)(6666004)(508600001)(66946007)(66556008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?76aVNQqKnwGeeQI8w3C32dOnNtOQnvhqxeI1Mxuj97nQCBltJzegjabCFoWH?= =?us-ascii?Q?UB9PeqntHCDbn3pZyjXqjSOnmVVmT4UJsTJGMXH2U14OudEq2C4KwQYWOciZ?= =?us-ascii?Q?wQNsT5M13jjhk9AjwfBJf6MdzsTKJyJYl+Mvky/F0xsfEWvFEmMm5gupCN/K?= =?us-ascii?Q?WM2ZHdTNU69kFDVCZCZMkpAWWDLdYhVVLGYP2l0b6AMN+qSQfKaB4OlOxmwl?= =?us-ascii?Q?wmHcVmFHXt8PSc0l1SPJYGh+EZxd0Coda4fkOMnnFToCF7VTFSkqH2jJzmB6?= =?us-ascii?Q?hgcIUdob7qbfYv2ftM7+bEy9Tn25wbWiD4RRfOLSYNOWmRO3FW/7kQZIIv06?= =?us-ascii?Q?+E6X3Fxxy1hWZHgs0r9RsFNtkfILAHwRrRJIWLOWTBZNE9m3fg26VbZTuEjD?= =?us-ascii?Q?6R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6?= =?us-ascii?Q?8EsrJoZ9NxbKHz8LZzcQBpWp+m1KFjaH02+V+Og3pcQEMew/CPxTH/nn26vC?= =?us-ascii?Q?ZYf5+bfl+ivOAusfWcVNVM4NPJbvkDelLef2kfD0VRdmRgn97CKCDvypqTwr?= =?us-ascii?Q?NicoADEpIR5dT471jl1QxYx6VdHfp5cJfWV+lJQnvCBUpKuTlLzfJ6uWZZt9?= =?us-ascii?Q?kH+Qg4fOSvEVcU2/pl/VDlKzlHp4nbB+mIEFWqiw/jppItXgRowSASebnGmz?= =?us-ascii?Q?2aWS+CQMK5PFnMUJegNZtNRNkLcOG9XGoDGZsJ5a+VvHljz4aExazlGw+We9?= =?us-ascii?Q?J6KFlZjVs6MHlvhT5dwGLYTlbRLneYvUrv65CyB99webxvO6H+ZtDgDBDrBy?= =?us-ascii?Q?RbLggMg/0ZK7xXsFoQTzpHJp9ApMR1mjt5Ya8/zXx3XEzflLOZlw73hjcc29?= =?us-ascii?Q?GijHnsENgA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bec6cc0-27a8-482e-01bf-08da238e9c21 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 12:01:04.0583 (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: Bx6Xilwv6t+3yddJiOHiEKiSW9KNC3mKqN7uJFGHmtVQ1Gv6X1nGTv4tVRlHhnWL X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8054 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 DPAA sec raw driver is calculating the wrong lengths while creating the FD for chain. This patch fixes lengths for chain FD. Fixes: 78156d38e112 ("crypto/dpaa_sec: support authonly and chain with raw API") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c index 522685f8cf..29f4e6d40b 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2022 NXP */ #include @@ -397,8 +397,8 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, unsigned int i; 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 data_len = 0, auth_len = 0, cipher_len = 0; for (i = 0; i < sgl->num; i++) @@ -406,6 +406,8 @@ build_dpaa_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; if (sgl->num > MAX_SG_ENTRIES) { DPAA_SEC_DP_ERR("Cipher-Auth: Max sec segs supported is %d", @@ -448,6 +450,7 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, qm_sg_entry_set64(sg, dest_sgl->vec[i].iova); sg->length = dest_sgl->vec[i].len; } + sg->length -= ofs.ofs.cipher.tail; } else { qm_sg_entry_set64(sg, sgl->vec[0].iova); sg->length = sgl->vec[0].len - ofs.ofs.cipher.head; @@ -460,6 +463,7 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, qm_sg_entry_set64(sg, sgl->vec[i].iova); sg->length = sgl->vec[i].len; } + sg->length -= ofs.ofs.cipher.tail; } if (is_encode(ses)) { -- 2.25.1