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 774A0A0093 for ; Thu, 21 Apr 2022 14:01:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FC7B4067E; Thu, 21 Apr 2022 14:01:07 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20076.outbound.protection.outlook.com [40.107.2.76]) by mails.dpdk.org (Postfix) with ESMTP id 53EDD4067E for ; Thu, 21 Apr 2022 14:01:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A1ODSUZSx5mIKXe9XzpIBiNnDYAQULs9GhvnuzhJgPNHEGwNDZ6xlLITxJtGsHNPqgiUL+sWEHByGV5HAjK3vs2QHrbX5yeHwaWrJGGra1FgtdtMmXG+TgZNZanb1Ae871rWfL/EtopCZupTWsFEI5XlhPxjCnj1GMHZI5PFjNBl+nVNzuHWnaXvU9lkm1ePJcaKXfZOmCBHuILYCAo1jbSHeNBJaOrsQ2CnOmvdhansMUM07vb9bePf+3OkqjpKNqfyy2pSbkAjg8dft0q2LqEjxAEM/VUc+GB5IA8hVLR7YMAK8l09Efl199fLUs/Z/reczJsOmEHsTKNTneZ1aA== 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=MT4Gi0Cg5uQW/YKmaxudPHm6HJTQqt4gvjrYr8ohOYtYVTzm4vRhMGAgepnSbq2l+L6zBYCDiLTo3SA0qWhL0pLikYfhz4iOz1UeK1q0vofq65KP7SWH1JbGnEWtVxkFLT3/l3Z2OryUnszB4QXtnhlNtzgjErcAFCoiFHDfp61IahQV7sRCbvJbizTKzw69A61rRZUDI70STWlTvxmOTQYA//r8i98mX8QOsKaTKL9aIlXfBD00gPzzjKYfugZtJSrAO3SJel4Yg2PG9ATsp6AO3iUwGjaroxLXxHdGI4B/Lli6wSRv6se6hcOHEAVCZODx0IuBnUD5+tIbHU8cWQ== 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=a5/XNj2v+dhGfMiuTXcqPwOX57X97FMZx8vfdlVLirWxG5njzQoAgJAVj2od99AuKWZNCAvUxKPO48n+WLWFmqCWM2LYGhGVbOQvBdYIG8JV2iXENbTA8k3emykoHW5ayq1pnjWuCIjKAnGspM/dgeaCvWih5Y4+Lr7HIV2tZdI= 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:05 +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:05 +0000 From: Gagandeep Singh To: dpdk-up@NXP1.onmicrosoft.com Cc: Gagandeep Singh , stable@dpdk.org Subject: [PATCH 04/15] crypto/dpaa2_sec: fix length for chain fd in raw sec driver Date: Thu, 21 Apr 2022 17:30:32 +0530 Message-Id: <20220421120043.2565227-4-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: c9f11211-4e4f-4dba-ff94-08da238e9d0c 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: kypeIKRLWN14kx4qrwYT4V2yv8ajsMM7Vcvv+iUO3jv+DYtXROEGwXHDUnzRNdHoqRKFnSS7oWiKJUGm57LpBUCRoQIsNbzfpt4N6FgZ0zOpWh0cjeuSVMjrmA8ia0U8LoOULmSNgjXx2Gzt0c1UvFEshClPyTxGslJVjqukMd2WWb2mRIGJYYnkay3D029RpuFCnB+Wy8atH5jw9yjuwP0BU0VekuX87HOiH6kCqwOuDHSQ2GAC6fZicWmX7th292aLXIMjejuN4tcp9HRRfKuU6rwPBnVjNOsK4l8lDPJw56vSHRjEonZAcb5I6jVL+QxI/whuEh/0R9EhpAxBpzoDPKhcKP0amBSVXyD6rS8wQTbfo0giR+auxgg4IY5PSo0d7p9NvAtMXFCNXbahYWRNSASZ4U1tpgZuczZs89Lpl5eSKDmPJtZFtCc50UUN8XSaQugcMk+z5Fdm1xd8D1kPGqbaczqCzVGCi8Z+KRSeTAFymyRi+lNKTKab7bM2poD3oFjNTj+i/5YteMPlLFbehw1I4buFro+igwiD/vpvO2oH/g6yVB/Lns3KBK16fPOy45EcReEQwEgfXjb4eOVO3YAWxRPcOrAP9p9u+SyR5KHbGW1DKIjpcxWirZ/rCsso845c1h9GkPND5cHPTaC0zHjnzuU65NG9w9bupBbJ5vNnedrDcModnARInXj1JD8ONDUHj8ChK2d+LFTK3Q== 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?m2W7i3k7nyigJ4DENBluT6tuOoVEiaLBo/d1dFQlMYuiV0dH2THkV1hNdcsS?= =?us-ascii?Q?28mQopSfE1f5HMpcZHBXuOAFtr1vnPUwo7yYsoGeHN8gb4UagHvy0ohhowWf?= =?us-ascii?Q?CqG8EyyTWhOf5RIHHCZGTN4rvnSJD2I4DSURomtjTv2JK/s+0vEYma42nXgB?= =?us-ascii?Q?ZD3LVynyNOtHDG80esBfwl37sffaxck/Ns9IE1sr76n0CXrjqYLbXeq3r39t?= =?us-ascii?Q?jDI3C3YzqaLKldV7UySrsCuZ3WXvXq1whXgG88nMdPU4Px9IExCbFjNCplW4?= =?us-ascii?Q?jeD9TAuT6FC1mIEJ5buykla1IZ6+BGJpdugQQorw4ztnnre7y2IIdGhTLAMo?= =?us-ascii?Q?L9UqS/P35cdOmWmIhmZo8SI2eOPOOpZRagXwR0W9FOEs2uS2N3o/tmXQaAhR?= =?us-ascii?Q?dTRYsWpJ/HZMM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iihg+cRzZV7N7?= =?us-ascii?Q?F53tvXiYo7ED8vCvLIDavEaTyhJIn+A2yKPX//hyD/iWfQXVSuRmWxcgnzlt?= =?us-ascii?Q?iN+iD4Z6XshBjMjyeeTUqtMizFGREZlJ9tTDzeaJ2zncXAiu4re1m8HoppFG?= =?us-ascii?Q?3y4WEwkl+tSc5g23UXgpQaiBwrsVO/MojFSEX7qOzbjfT3DOWWiu/aKioQg+?= =?us-ascii?Q?6WhtvbQrr8cDoAJdHZzANd00ej7nhFYefwiSwY5/YFouRN8oj8o7vO1SQ8RF?= =?us-ascii?Q?NiAf1wPcKuHI1ocoZUaGJOWv+t1Cjg+unR+xGLjBmHx00h9/ZbsMCFQVaEOJ?= =?us-ascii?Q?aUevsJUfngW6PulI5eFX6uko9XcjbbphM5p7P+JXR2f4PisKt1GUG2inOU6P?= =?us-ascii?Q?5kCSI6cTbuWfBP4lMhNblqQaENZ83/AD6kSuXRN3cUccWKwfIA+D6qlnhgp0?= =?us-ascii?Q?5lRtmxHegg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9f11211-4e4f-4dba-ff94-08da238e9d0c 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:05.5880 (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: KyoRA8+JWtF06CarAajWbe5BT5EKavObZv3HRmTBjy8JOIc0rcGZfoWh/LljSSWH 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 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