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 464B0A034C for ; Thu, 28 Apr 2022 13:48:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D85242833; Thu, 28 Apr 2022 13:48:07 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80074.outbound.protection.outlook.com [40.107.8.74]) by mails.dpdk.org (Postfix) with ESMTP id 2B1204282D; Thu, 28 Apr 2022 13:48:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m+6b7F5akV9mRt5tIbDWN774XtwgwdQQU922/6Io5uL8FFdNIUXv3tiw8JmeUn3qABzeLJkyhx4g9p91jHSkr942zVmzig7ywcLiN0Zh5quq5zHG0QCE9n867Fxr0nH8yXDODTchHmEuvwblpgpepKIwa0Mkn9EfoDCW5oNsGroZCE4XoPvUx6XOhCvInd1Rui/vgzPqb51/jisyEstnsGeF5WC/vqV96jPNT1/7YTOjj590vtS3xJ1qfYXw6qw5CAaLsMy4Yh1nm/+/WVmgrez6yWjhGYGQNY82tZ/cL1eli1jWfq37dWq5P/2BDb7a5KZi4dqUAfgmCv85GfA1eQ== 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=gcZG4KC0yFc+O0ifG+aH+6vCdYh0WSkwUKQUQ4IuNlqIFJmdMTN4Ran/Bk5na7aDGc0YXPwrzgSU0LklUhpWamo1J7enAYYTu1NT0NapjyoXE/aOzaspD0oz3yq3U1IFIpfwQ5OFmDpO3Dgs2o3e8u8kyEUvr97B7BvXv066Covcdpr4bhxngW0chXqnTPYGEU+lN950L6EYLaqWoblL2SrASPIcsH/WNvoNorAi4PRvVZY25ngVlTW6Tj9w+JxK1k1klhFzAy0IgDSQgC49vWJxphJukGb5mvnwwXT3xiOMt4Uxo6NJzQzLb/+iXcxl7H8Yg1zgaQXusIHw2yD2dw== 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=SotxeHCAQ8AP/YZLuAQT33o281jgf9xg03UgRlZhETlN2XfWnPI3dAVGqdii8nCxWw3m61yexuw/Gl0qrbAmzaHM5aX7pMdSDTrG5r9zbcvzpPyNJnS6+lZ6vterjBXOFwvJmD7qJKtoZ20ZU7Xr0AZKJQD0gawNML5v70/67Xk= 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: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%9]) with mapi id 15.20.5206.014; Thu, 28 Apr 2022 11:48:04 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH v2 03/14] crypto/dpaa_sec: fix length for chain FD in raw sec driver Date: Thu, 28 Apr 2022 17:17:22 +0530 Message-Id: <20220428114733.1419957-4-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: 9da1bab6-7e03-4986-9792-08da290cf439 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: BX5gSiEQ7UlMMg6a2D1pQ1wBV73oiXsd0Q1M2ur0SNm4X04J3rG44b1U+jaUlu2NPT+C+E6bqVwDFJtiaJKY2pa3F2W7MFRCm3r/E/g+8Lk1GYyYJZvUXVGgJPSaX/vipzAeH8EJmZhlRcz5StwMwOmWnvakn1daJvGphy3ilD6Rd2IYbOFHYPyz+BmIgUxI+jCZrrimv6/ioDhY9J8+PT2Kwh83nCKVcjZhjpHbXFBNCEZoBD/UhjtM3ylQXn9yzrCkzQbfbRkAh8X8m5DcIHOKXnIZKg21ZcktbV9hnCffN69vWLOQXQwxP75nbBRcWePsL9ZEbeglRvklSDOtch8A83+VVBCBHe2rGoxi669xFDpL4OqcJZVed6Cvxq9YOs1Ux8XhxbccQDVZUduQLshvkTy2QtoLcLLV8xEUy9pnAfWaFOwuF3OjXZ9e2RzbBfLpeFLp/U0EZgdA3BJE28pZYGRET7zxEVojDHmeG7wGiQw13FGkOw8rDI6Uxp318j3IAYKV7rKG1fFD3uYfxXuXwqVpbeaa1sqHfPKOdyMf07qZt1XHaSots2M0v6fDXePrlsXthVmmq2T37Bv2nrO+c0mfKbNr7A54whefuIHfGp3iZyGklI2xKVjfjEtUcovWh2OrmBPiy76SrC28dN6foUekwrxqAdh5udlwLFbx687GDCyYElYBgSVSPmakmDTGEXjlv+zNuC3mGDLY+Q== 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?GUT/lv+qJg4JeZqfu6/3/G3qeuvYRfbjbGLhS4ckruNb7kqCyf7hphLgr5kM?= =?us-ascii?Q?ke8WmbUgcZhoYtfwE1NxjsbV4huK4Fv9gBocHw2WDy/l6k12pGBsnJOXVd/s?= =?us-ascii?Q?W9I8TGivGCA4R+KB0GkL3/6dNz0gC6mHfPGPCNrQuOtLb71bD0R8tKPqez2D?= =?us-ascii?Q?1pXqRiyyRjdnm8BKF0IecBGWrS/nN4FEMLpYSPw+6Fo2wl1k9YLZHAMpN755?= =?us-ascii?Q?86Haf2qJcja5JKi6fC7sIpXOFgoiYmws68rNpUIRjyML91H5LLl1Py6uOECo?= =?us-ascii?Q?bV1m2t9y5TH+9Z24pCaf6ehh5T4Sazo2lwiOQMlsMZG2fQf+6n9XOU1gxVEZ?= =?us-ascii?Q?ffXJElA5sCRYQwtYwNoLroSlZyBHoGXHB3wUfBm0f+BMPblDTdWpTlpgUjR2?=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KmJ7A5nNs2dK9+9092xrbwEgOC+RtD3h1bD/D?= =?us-ascii?Q?yjG+N3IC686rG3huv3ajE3muh9wd4kJcVx4jQBILl/p02o1Cb5xsMCg8C/Dt?= =?us-ascii?Q?lfJp8LMbYRLRfNtpMONsHo7f2rUC/d8haMxIQ92QHM6bM9cDHUvA+lGQezPv?= =?us-ascii?Q?DLxocoaW4YkdO5xG0xfLsVv72kZdYBt4WPi1KFbDG1ats4Lwi2b2Axmbn89A?= =?us-ascii?Q?0gXWTWvYmXSLKMELBcUk9AvSHJWCehnbKqmln4sz/7y9mGg972GxjXSqwUna?= =?us-ascii?Q?AMK1vS2rfuSSnAEBraoC8h8blG5H3YUS44ocQyAmmhXMFRikKebO1O+CPd+k?= =?us-ascii?Q?rysrYvUy0gHM+V/CZ81/ksAJDkFUJH0fSAVOP8g+8fAsNf0ko/i7Vqafrw0t?= =?us-ascii?Q?sGHlUqK8CMd/JZjjitk1KIDLNRuKI6+4I1jCmzcXhi3J1jC9dGDimecVXd8b?= =?us-ascii?Q?q4JImyCRuA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9da1bab6-7e03-4986-9792-08da290cf439 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:04.2451 (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: oKVeXujgYcN3tl6VBuD7vLtVgP4xySCY7TUzhM8TtGuL8KPQ66k9hZUQN5EvQBRk 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 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