From patchwork Wed Jul 21 07:39:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 483262 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5941067jao; Wed, 21 Jul 2021 00:42:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvTHkKLaRMzH4g+28DDs+MZmBrAdwK+bkwbapX+UqRbIW4x5Qo61XGyiUpTeQbVpYVS4ZR X-Received: by 2002:adf:90c6:: with SMTP id i64mr41769017wri.168.1626853339839; Wed, 21 Jul 2021 00:42:19 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id p17si1663255wru.51.2021.07.21.00.42.19; Wed, 21 Jul 2021 00:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector2 header.b=aBUmvpZQ; arc=fail (signature failed); spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 195E640689; Wed, 21 Jul 2021 09:42:19 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20075.outbound.protection.outlook.com [40.107.2.75]) by mails.dpdk.org (Postfix) with ESMTP id 3742A4014E; Wed, 21 Jul 2021 09:42:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XAIJKJCPS0qEYJjZOOQ05PYyNrfO3CJ86XVaX6F1516bvb07PejX8UQq4LqHrxVjlDu/ceSEN4cptoKiee+51HbaFLMdU/awMQG+yB7+JO9Am1+/8Y2OnXLqIquKvJhrdSUfYHRlDXsqDY2NJF3T01zQSjkbw/sTEblhGF6P1P4ntI5KHherm/vphlJSzwe3qAcQpfj06UG8eIDdUQrTrG7DxPQnZ2QH40xuRgf/Dh8cCG8WlYqRIzp9kFuYebo0jU2VU0ezgBm8wVTcmENVrsAwAkNTGqXG4STZncoe8mM412KUVNdF523X55WGxxd6uyMfHheHIJsprcWc+KtIdQ== 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-SenderADCheck; bh=fhkYWX0GAVb6WIZc9B6JYgXV9puFDbiB5csNptWIb7Q=; b=DjMORh1IVsm2DFvl/foIOcHVkPWNY2SbLjl2p703X/CJ+rb0miU+g56QBWQYjXJvHJ3/kWwyMyK1UNGQVmACBOLHbzhH3ENVZk12LzSdb2MApLvSge5PMMK8g+fVRPXLzqu/IV+iCyBe0YvPyruFYbUwtOP9l6n9ilH7J0lTa+fN2pHvnvaqyR8bkAZNOlC9ZGcAHBM+OxoFCT6k/2OneQemgHWcG1pd1rtClwTvD1fZzQo7UI27ilVAcEjhN0bz+GU19e/jAHbr34cBmoeEBKgmlXJ35WvjpAn9HdzC9sfcosJ3xtuAvLEwIxINHtdCxwZAoIt9dyRDSmfqRB3BHw== 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=fhkYWX0GAVb6WIZc9B6JYgXV9puFDbiB5csNptWIb7Q=; b=aBUmvpZQO2IVj7+3+jFHfsqPW9HwXG5AVdTiFKi3ezEsQLHdnBa+JDa1WBHKo39BLBv3ePtFumkVgqysgS5gOJMYMG6eREKTN6clAS0D/KOdr+dkBUsX1iL+suRUn7nxCJcmrvVrkli8KNmRiVcDPNExQvlrlRCMDAz7h2zAkco= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8581.eurprd04.prod.outlook.com (2603:10a6:10:2d8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Wed, 21 Jul 2021 07:42:17 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::f483:9bb1:cde3:8a28]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::f483:9bb1:cde3:8a28%6]) with mapi id 15.20.4331.034; Wed, 21 Jul 2021 07:42:16 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: gakhil@marvell.com, stable@dpdk.org Date: Wed, 21 Jul 2021 13:09:16 +0530 Message-Id: <20210721073920.21893-1-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SG2PR06CA0240.apcprd06.prod.outlook.com (2603:1096:4:ac::24) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR06CA0240.apcprd06.prod.outlook.com (2603:1096:4:ac::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 07:42:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50a442b6-7e95-4929-5229-08d94c1b0ff3 X-MS-TrafficTypeDiagnostic: DU2PR04MB8581: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7C1r8R1m2N8xeHHJ62tPStpUSekmkeTQnSh9R3lJpu6tdFsqTWHCjmZd56ckYhdgM6BQCD/SPojO64iWtLYY5FpDsf6eGiyCpCUTVdcinr6RZheAo6WdIs7BEdfgeCfs26ONboR/ALHPyoGpJFIOHj1HJRnxL8EfuQiy/VNKkH/AO1Ibjzr8I/Zt1pXRWhIV8NAPOQ+BLVi7yILqV78UIswHN6R/kuvMK+xtN1N2ErWRHxY4F9pfe4xKCKOjIclaGkx+uAVdK7bbAnn+jR4WOhGMOD0FDPIjvn/4FUeX6AzdWMMFsWr7+3TdxxupOINLiakMigYFBXgw8HHxMhwdoqOtqpOPzApJvJcG2NqxKO+IbclsHsvRe73jmHLPTELhF+mjHl5EuoPjT3AcXhcBHSB4yLNMb65mmfKEMbVcr2JwHor1fBnhPF4nJNSUDgY4lW3cWityc6h+B96GCEViUiDh9K3bRecIpNRWee2kf21olWIQwZe8CPVK12v+DOGUVHL/PVJ2Mcih/herfgOkQnH3kUkCEO3mHQZa6P8ZZeiVV+vctNpOjRagsVfQrMjljj8Uonc9VjmwlDzJkQ2T5onIJKTKDxviV49iJ5Dybklo/qlFIPtaaYahJqJSodLGAyanapCQ34GFdDKFtF7KjnRtLlPj1hGLIt4oeSP7zmQjbWbZ3oTAYqrnuTyvn75omxSmD1PntsweRHv5KAZcXw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(376002)(366004)(39860400002)(396003)(136003)(44832011)(6512007)(186003)(956004)(2616005)(66476007)(38100700002)(38350700002)(66946007)(1076003)(6506007)(5660300002)(8676002)(66556008)(36756003)(86362001)(26005)(83380400001)(2906002)(4326008)(8936002)(316002)(478600001)(6916009)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: adpFVxzQ1cuWIX3kaaGXtu5a9vC2JAWYVIpgewXnpgUmeLkivLQGiGua7JjTxirnlSiyMlVm46e1WPmJNnRJ+KEHJgrThJVKNnPIyjMb5ejq6zd4rYKExKN65Tx337wdAMknyIte2CtjKChfgKDmlySddssISbw50yDODYTGqUDItdBDsDWgXJ5vf240FhRiGYYyq9IqLtAQ17XoCx2+PVVnN6X5qg+QA1fS13TaJecSGOyed482yznOJX+yMb2BwWyQWPNw/t8XdKkN2XNz8b8sYfJkGaZve6pdDAZTgZvkQY8zuBYDRuSzLgQP1iiUBeZtNAYo2TuBYoZ0Lhof0DM21tmeFgCdMh99+MV4zSVxO175v91CmGlOCSaq1yEuX1s05BrokLWjSja7z/6aaCgb2n6qfIZZ3Bb31ILLvc6MDEk/xrWBIXnHvxATvDRlvhvgjdsxz1cuqK9JCfH0FJk6qBjF4mY/GdHwd3aCR0ADx7NQ+1I148KhyHZDk35YEIw9vCcxp8RrI7/OE5YTALdIAg8YMJY2jS81svNnBBqTCladXGF7HHGQeXrmBa9I4vtSpBPWP+9CsCLvX8ZtkLFgfjlcV+pepfJo11IejHBq91B1QlRox3R2qfNkZjp/VYHgs1GPlZWF6TNPju4u6sL+qr47D2QeTP0vB1r2ehvS7PMN8o6a/ZmwXMIaW6Up6HG5D1Ry9A8lxdTofW+iWsE+AW1WJsKrXRWYRtcDLIRONiRZ42huANsz8umHGpHuPtK4KlkVvekmgc0wQmSrLtBvhbpiCXtkA9IL8gffu57Z84Y5peBtRwHN5tZWbhu2CWWPnoT6UUefGhrCwotFvFYzP7qy0o4fRAH+P4L4h1zbDsbDlY9F2nEyhjqgORDGKQMjmTVDHJn/lqxyrb+v2b0jW8y2tPLX59z3aj4HYiS4p4Z8d1FpNcTVwIbDBxBIbyYMxyAP5n+Wb35sP+apAlBmOjXVXuDdBbPNGIf4/bBrHvvBDQrV1AN50kd1SKNS8eWLKsb6T5PZ8d8hJtVNlxbtTgpKK9dXSg2DmcpqpIEjTBctug8o2HUXRJhrDsScnsAicJ/KWA0TOiomP8wtqWb/F6h5KrB20n1NW9kVyvhrCo66Rmykp07RiMrZhbPCKC6rdlMr6mEhLYnTp/g9kNDTHurB+K6gsjPX7Bas75ITXTO8QzuwfPIAYdciHMQR7BA0xW5YKUiaR3WUpCIwqmcqLKSscK0zCitwreVfSq8+092lGD+iPvC8yT3novYPsFTIKyWscakAlLcIpq4Q8qyDE0m1E8lBwSi2IlAD0RCfWGNFQrrCn27IJIJc1TY1 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50a442b6-7e95-4929-5229-08d94c1b0ff3 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 07:42:16.7268 (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: ZysuGfv+KlbFARJlX3d+rSckZxqmiFMPpxZaRuuxXpxd1mwWUj9OWRKxxhXejlZXusbeOfkVgSEiiO2wnS7LoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8581 Subject: [dpdk-dev] [PATCH 1/5] crypto/dpaa2_sec: fix to check next null for auth only case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes the issue to check for next pointer as null in the integrity only case in pdcp-security context. Fixes: bef594ec5cc8 ("crypto/dpaa2_sec: support PDCP offload") Cc: stable@dpdk.org Signed-off-by: Hemant Agrawal --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1ccead3641..4438486a8b 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -3102,7 +3102,7 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, struct rte_security_pdcp_xform *pdcp_xform = &conf->pdcp; struct rte_crypto_sym_xform *xform = conf->crypto_xform; struct rte_crypto_auth_xform *auth_xform = NULL; - struct rte_crypto_cipher_xform *cipher_xform; + struct rte_crypto_cipher_xform *cipher_xform = NULL; dpaa2_sec_session *session = (dpaa2_sec_session *)sess; struct ctxt_priv *priv; struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private; @@ -3134,18 +3134,18 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, flc = &priv->flc_desc[0].flc; /* find xfrm types */ - if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && xform->next == NULL) { - cipher_xform = &xform->cipher; - } else if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && - xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH) { - session->ext_params.aead_ctxt.auth_cipher_text = true; + if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) { cipher_xform = &xform->cipher; - auth_xform = &xform->next->auth; - } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH && - xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER) { - session->ext_params.aead_ctxt.auth_cipher_text = false; - cipher_xform = &xform->next->cipher; + if (xform->next != NULL) { + session->ext_params.aead_ctxt.auth_cipher_text = true; + auth_xform = &xform->next->auth; + } + } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) { auth_xform = &xform->auth; + if (xform->next != NULL) { + session->ext_params.aead_ctxt.auth_cipher_text = false; + cipher_xform = &xform->next->cipher; + } } else { DPAA2_SEC_ERR("Invalid crypto type"); return -EINVAL; @@ -3184,7 +3184,8 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd; /* hfv ovd offset location is stored in iv.offset value*/ - session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; + if (cipher_xform) + session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; cipherdata.key = (size_t)session->cipher_key.data; cipherdata.keylen = session->cipher_key.length;