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 A8CE9A034C for ; Thu, 28 Apr 2022 13:48:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DFB942837; Thu, 28 Apr 2022 13:48:09 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20069.outbound.protection.outlook.com [40.107.2.69]) by mails.dpdk.org (Postfix) with ESMTP id 8B9C942835; Thu, 28 Apr 2022 13:48:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7XdhebCAn5UpzXs6u2euCtD6zPZbrmaRRNCVzYQp17ph+aO5bD6cti9SAlu2ZH05b0YyTUkGFbNAa8Ar3J6utp9xd1WI0CE0DJrQiv67rIvd/zBwRFAqEUlc67mKVdEmexymUpDHSCvlZcQOiKXqornykSQgtHfZS5MvMa/Z3CMEjbajIOKgwTiZCvEUJVBpN98c15BNbK10OfP31WUU078Di8WqUhVGp/4NHUcIz0XHROKjK7xrWa71QvMhBCoCtL/VqemIifLVDwmf8rzqEr7/1Ej0Ybw7qfuhdLPxqZKp34C/hI+oFUHm0wQKoSsAP87YcgV9twC6eK+reVQIg== 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=IayR0E88eVM5inwCrhymWO5NjgZL4SUwtIZ9io2tHPpTC5LkQgK7fdozgQX2eVifvlHlKsCyJApr0nfFcWLF8NtX20K73YKyrwsLXcdOxAEj/wAjwYnrodrMV4RlYoEmeAX1f/iJVnC7fXCuJdozjdh9z2IYrVXLBpwuYKUZ6cSeBK0r1lc/2mJ1gwf288Aj+Yy+957V5m6SfLeZdxo8QimRFVl33eCarRjA6+KFVrsGrM9r8bTTCWfa3mUp8n6I82gT3pKvh3x/8UQfFtNTxKN8OT/gB4AixXTqqEM+Pk/hzyxI9ayYmDEZn3F8jR1rMKhbfW1UOAXpMZgViRVlKw== 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=AZ7pIwiOfNnlW4YrqAdDAorKU4nkI9A3FBmZav1IZdP6L92pxxi8o2iGH5NadImdHJd25VXTNe61uGKiPYSloTzaXEUeunBiJDcAdQIic1hr6kkVrPCxZaNxc5TOaUIzCWyzpF9CDKIa/PJRxCBSi0Cymyl0qphLKV+w/mw2+Q8= 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 VI1PR04MB4622.eurprd04.prod.outlook.com (2603:10a6:803:76::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.14; Thu, 28 Apr 2022 11:48:06 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2%9]) with mapi id 15.20.5206.014; Thu, 28 Apr 2022 11:48:06 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH v2 04/14] crypto/dpaa2_sec: fix length for chain FD in raw sec driver Date: Thu, 28 Apr 2022 17:17:23 +0530 Message-Id: <20220428114733.1419957-5-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220428114733.1419957-1-g.singh@nxp.com> References: <20220422035100.3180870-1-g.singh@nxp.com> <20220428114733.1419957-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0002.apcprd02.prod.outlook.com (2603:1096:4:194::22) 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: 2d0e7155-6a57-423a-6248-08da290cf568 X-MS-TrafficTypeDiagnostic: VI1PR04MB4622: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: 7OIfEjt/CLId2jFrxAoxPqb8zZ2vMu/NaCSg0LzZikC9tzIKW/EmlIk1OLwC+/5b51Okq99wSqiSC42vi0ct4iPhVgtD+7aPrL51ksg8iy47rjHCS/gqdLOupYcM1JmJ7cvOB8cvZSL1lXwxtr3LT6/13L7jpyq9pgYfZvizyoatBFiCIo3F1PKbEbiwe7+pkYfLIs9G+DFLHhCNadmz15YxgP8k2FxqL8hLkz6jfESYYmMob5KgsMbzrajg8ViCUB8wFXYBCgTPrOQ95p+vh2LFihEnP+dD9gilz8Ou2wOjuGg3Yd2ATqPtyItOkJZNj1nim8k+EZY8MXqfacrUq96QhmA9Vz7ujX5ILSbp3PyPaaZby0t3uAA/wmzFaOkVlEX/DFNzfOyIYMvDoMVavFO3wDPqpRxXR/FggZCrzPqhRQSZ0DpGB18c0eB+gbkCD1QplMfEHuy6RgMM9uJbhM7oqcXb1VGfY/I3YdjwvnqxqDlANPV4L2BMf8kUasZP1LClhmLNkw6krhTzuMaFbKv8WyZ2uxmzpAN6ywVF3QdWkucznNYm176z+8SS6W7V/Jo2KUnK91GBgHXxGfwqBvIipbYciJi/U7jwQHRHFgojYHdprPHf2KQAt2EDHRlhENvqGR1ldIBQhAH7Bfsty71op9cjANSKuctLwnKpL+7MWgFvw8oT44XUbmD2uYZgxQJ90r8wOnfGLZTURPz/yQ== 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)(2906002)(4326008)(8936002)(83380400001)(508600001)(6666004)(6506007)(6512007)(26005)(86362001)(52116002)(55236004)(5660300002)(38100700002)(8676002)(6486002)(316002)(186003)(2616005)(1076003)(36756003)(66946007)(66556008)(66476007)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wZns1ceX1YYKTDWz+OqWO8/idyNhcTxdHhLaTyTuAPSPes5jmu1Luh5ACB5h?= =?us-ascii?Q?KP9tgEDgkBloLSOkxbM/OM7HGzIOEuL4wHcKVBcHYMPQIXRvlNBfp5kh3A61?= =?us-ascii?Q?wTXzd8cxiUeXzS+hjAiU1A5igSYOvwRbp6MfdN2tGQwuviJ9rxxLDi9ms3EL?= =?us-ascii?Q?E9mGm65GA1459NdnZ1DGbqtuhi6Df8Dq3CPSUhms/8KYMLCBPZsu2mB1xXEe?= =?us-ascii?Q?4cUVC2mIe+4a5bX7+BcUiwT/0Q2PG4guWic+/9NSlnfdTjX9HNgOoZUD2hGj?= =?us-ascii?Q?GymWIqWv3HGQDAWfTHwcwIYkQ4t+JGKWHRVOZoaxEtWTmbG7A/9UCAlcb/Tc?= =?us-ascii?Q?iqyoSxs7Jb9U6sB3Cq1HN9HJ4GMZ5wPVRizc0NKI6OA4zJKBp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cMoH9k1/Js9ddGnr+PVbSaw5WEQbyU3o2AFWdEsEc?= =?us-ascii?Q?NcBib5Hk1tYEerqGcB6/NguWKkbT8FGYnppVHm2PIT6d5veYbjtMHJgnE13i?= =?us-ascii?Q?wLuBLNi6p6JczrNFp7T7LBPc/iYrCTb/3PGFJ1ku5f/v+D+EPXulnfFRPgen?= =?us-ascii?Q?7dBN2qSpqNWP4EPC6kx3Sc8LEyMgZeyx5dN2tqjQjBEYequCjfeThUqciRj2?= =?us-ascii?Q?iJ/c9zVF/1E1eYBnDNotV1mJRCfBU8/GzrLvwiSWEaIY1R3yIROyc0hNxSSX?= =?us-ascii?Q?YbLNBgb2GbrUqgjYs7H5WSokO8KOACIp1GEcjLYxNHqU6KUzA6GTJe4NBIi2?= =?us-ascii?Q?Xzsy6Vb2sr8AIGi4El/em5ea1CU5mq29yS0qYSj0yScVEVpbuzOAmKdXS1ym?= =?us-ascii?Q?416TOeU3dm8Gdpe0Cyg+Tk3T2XqEZRiSxqYinnhL4KXczJmP0KO00OKphRLy?= =?us-ascii?Q?BdBmDj2F9Q=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d0e7155-6a57-423a-6248-08da290cf568 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2022 11:48:06.2607 (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: 92xnSz20/cfOlMq/73YcBn7mvbREUNKbG/M4tndO9eEpLt+y23HxoaYB8AKKvtUz X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4622 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