From patchwork Wed Aug 25 08:18:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502249 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp382100jab; Wed, 25 Aug 2021 01:22:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVTwo2SSyVA6+5LBbcuM0tROaJOyFQxukd3ZANoTottOGXzXM/MnPXsdkGoNsnD5aZpn2Y X-Received: by 2002:a05:6402:332:: with SMTP id q18mr5622352edw.127.1629879736506; Wed, 25 Aug 2021 01:22:16 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id w16si11827646edq.201.2021.08.25.01.22.16; Wed, 25 Aug 2021 01:22:16 -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=ci0BHsSJ; 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 5F25D411C4; Wed, 25 Aug 2021 10:22:15 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20084.outbound.protection.outlook.com [40.107.2.84]) by mails.dpdk.org (Postfix) with ESMTP id C8B164003D; Wed, 25 Aug 2021 10:22:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JWv+4+lf4nL5nV8R6Az6oFyEh75yZ2Q4YuzvY/W88TVuCbUK9sd6WCQWCBNIGVDgpw1GKYvmgUnXTbxA8bWEs53Uslm7OPvUFEryoaoOgMRMCzzbGbU8lgd2Bze7//MkV2l0ObI102asVcCt+0Dt/RlCRJAZZSDDsLUJMCve4vgYoJVPGz+rKu2J9wXt+OuvrfEOS0ccPm3iF5bjovbmiW/7j25nuyNA84LnxWAqCXrsIXqYJJMYGxc90nUHbfjqMv22CODB6mgzS324DuYWL8bDQB4XsOKwQqS+ng75od234DvZT8gisy9NnbHmgK707zXhp0rxMV3LFtzuwHKZrQ== 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=o3hBEISs0+3w9Maw89TQUNpHZmDX3mLdgXDV9wGHqh0=; b=Xlx1ygjNxy6Jq3atPQaUGBqMhrQhHdnoD1fCrhYpz8hbaBItuLWM60vOPYBtDbly2jaZ5TR87Ka7JZfp5zwD8cvSqzLzCNf5rmwj/vIARERy8LjZtThk2kBf3p+KRl2Ckg+4/oHw34pTI/wmuHsHKrj2vKngLhj2OqqEEodSm/lbGzsv4N8dhMdp1RBWfqm31G7XOA0SjaUb5dD/hBsLbProLtlYG7vhEQD37ZNUJpf1AiKfyKzYIqGUIwwGDEHX4NkCNNn8NQhC9pLu7lrHCwOktn4VSvER431ZNLhyoCAqGe8Luz/S2AGIStafNPZ2CyxbwnGH5MFdzHzmdlFtkA== 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=o3hBEISs0+3w9Maw89TQUNpHZmDX3mLdgXDV9wGHqh0=; b=ci0BHsSJK5QKqamKWNR1z5Zi+b7skFk9cI8X6XeUMplumvO8S4dmc0FzkQJBsRjsmmWtrgSNwKJo4sATUtcTzqWAm19xX2KndytHj6Y/Qsd6ZTY0XcYvlz4M/otCQgVSGtdxkf47g/K8x1DN2pdYzkAn+Uq5CqQZmbbrJ0G6ogQ= 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 DU2PR04MB8584.eurprd04.prod.outlook.com (2603:10a6:10:2db::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Wed, 25 Aug 2021 08:22:12 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 08:22:10 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: stable@dpdk.org Date: Wed, 25 Aug 2021 13:48:27 +0530 Message-Id: <20210825081837.23830-1-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721073920.21893-1-hemant.agrawal@nxp.com> References: <20210721073920.21893-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0106.apcprd02.prod.outlook.com (2603:1096:4:92::22) 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 SG2PR02CA0106.apcprd02.prod.outlook.com (2603:1096:4:92::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Wed, 25 Aug 2021 08:22:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba6452ef-92c7-42d5-1d46-08d967a16f3c X-MS-TrafficTypeDiagnostic: DU2PR04MB8584: 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: PiVI2pKNWcV13cJSmLeHX84m5pyysW8yMcW6/kuQ9THJZTAG2LpFGWf51Tk69vFX3bqEq67i5miKuSnKmjtQjoGFryWjgaGiZxnFcjHoZqZvAjwfzeSBsl4TrCgwpdO7+yFVCWskpAyMm1UH5n0ZYIvuSjfApWuumiag2DsdsUmvIM4M6fFvPBkCNNYT1wgF2CRMnUdJNBpnz0VSSXbNtEiJ0/Uq2HkJolXuLht4o7uyOB1On8fJDdMyBe8j+62E3hTS8sKmbDWfLlcxLTVyNaIM2YfdbS2TD4tGO+SKEa+7UnlD0uvsXrOVsw3E/09yPeQS05XpJCLzOnmr74gD1O323JtsQR4bOXHVOPsWibJH79lZLa+VAVYGCvqAas8n71fV771G8O54Tqe28SvvCa7BayUpS2fU9+xrUIXIEfOiHGG6F7qjEjbK3jt177EfO7hODHTxSU+Si3XvwL8UkPjWJsg6YASFSKLrd0psk1IxsQL6BDtvqFzib4ncWM6sP2tR2BV9oGizdvuEd0s7Xgic/2zbonNgihO6IGBSAJnbEt632OyJSxnPIs6xApwF1dfzQo8VWZo82F3tsjr11KO8pkO367PAumqnmuUwrhsnGzUNahpz+vRgRL9U5E0oU0+mMVBNGVruWd5D5EVOJU27l1ka1I/6K36irHidhTgS768XGMhvQBuC97pqsbDstlGEO6oNVrUvE2mB2HkJNg== 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)(136003)(366004)(376002)(39860400002)(346002)(396003)(6666004)(66556008)(66476007)(1076003)(26005)(8936002)(186003)(52116002)(6486002)(66946007)(6506007)(316002)(5660300002)(2906002)(44832011)(4326008)(36756003)(956004)(8676002)(478600001)(38100700002)(83380400001)(6512007)(38350700002)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4wJych0yYn9QQ28b194GHodI4juxSAS+c8wBrTclhJcsCmbMSrSqrrd62k2cMdlO2Qha4D7wG6GjK4SLiCcTNpYMie9g0kZ2jhwnblCadnFf7j+a+ZLIxO522jCZHT0g29kktvfNx4qIY5HELK7yvQ42Jcz8rL7oaCrkyAj1mGRriU+0NBkXx5l577kXYy70XD8HV1pIJHF99TKE4CFV/Z+njM3S1lSE83snxrAfuIUrro73ZADHEPM/L/ZpzTkC91NUjmjIXNcQixNwtTHfQvnR60QNVRheBW4hGRw87fhJ553trfxZprP+2Lrn6Gf07FbyFZNCEan3nRANXRXOkYny+u8FiKw1cBsyRFnZdeDnRiDgR5Bo6s2fuXHz6GI4LmiMaQmR86hhC/tv+lcFIbLoR/ujw/E7el2A41O2AY3WoR8wUIDp2rOIlpHbpMe4OrlyMbMgSDgYWnocT+Dz1H2tlByVgnDoq3EkJYLkHJAQ6XSEHBoj2c7SXsdBOia/nywoW1ojs7Nu8q/F2pyCCaqhG8Iw2/SRslDjRINzetVQcdw+vOV5dQ2lFxuUi0mjFmfSx151wgMqbUAIy7TjQCkuotSYP6Vz68e1BbhVuYv2J6oGAd8RDbKUP04cVJt6x9BVLxn5YCj/Nd30XJO3XBiPhwtPI/V5HluhE1ibSDu8k8FeDO4eofANuD2cqvnl47uYsN4HEgZZ1muvVJh8hC2xPrN4doPoW27Kxwa/95q9hXUDWAdlsS4pt/qPLfO9mJx6BSPKFjwLvvfLIMtTNXi9/EcLG/3eEm+aIfqmyLr3oi0jP+1WUvQnrrmZamahzaPdG0oLZxBivEPqY3srXrDv/XtDnO0EwGr9OuAtgqUYeJLzED+387c0W9ixz14pTwdjTEkPpffbXPwal6nKuWrwypT8cVen0WLCPLsH3ZADvn00ezRUlRsUxvUc28cilfOdLdhOTHXEawOWPf/a1me1zUmNOEKgEEAFekzE7W7gf+4TKzs3GB6kQRnlosM0Nmg/a7fDQVdQ3ni8Vg56AGR09GzIg3+6hqe7+yiOSYpWGS0finZJZVmXlEKP5bJJHV8D+QCmUZVO38PPsXUYpxekow1Tb/Kk8JnkTBPHiPKSpUVMioPDezKadGqVRjUBceU+HeuvEZxpGeNi1VFxnk0zTcdanhwXXM9AHXGqdGL9VUjS8ylFW8DL8NL+DW9y59kcmo2JilvL0u+w+vSQR+YkbauDdd3bZH18WNLX0Xbu6/FdtyMaz6KU+kb3oCvZ9bUwl8NlXUksBjHCZsFBgq0DrNhrGkFf2o6894AMBLO/OZce3FfzRL0wp3zIZJri X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba6452ef-92c7-42d5-1d46-08d967a16f3c X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 08:22:10.7577 (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: CPTt9yPgaejNTu/WXW5go9KMAh/RzFE8Gb6lOt3lVqTqLFX0eD2eMfo8axqvbO0YFZuHslLiWHluDAJcXWokkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8584 Subject: [dpdk-dev] [PATCH v2 01/11] 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 fe90d9d2d8..87a94b2c04 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -3095,7 +3095,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; @@ -3127,18 +3127,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; @@ -3177,7 +3177,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;