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 6CDC74546C for ; Sat, 15 Jun 2024 13:34:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60F2C40674; Sat, 15 Jun 2024 13:34:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 23E5440269; Sat, 15 Jun 2024 13:34:41 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45F9uW5E029004; Sat, 15 Jun 2024 04:34:41 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=sJHQhFLreXfMzhvuPHG7uLt 9Kb3t8pxredC7qS3TEqQ=; b=WNx0xDFjzF9ysCp9vOreSVfl0ccGB6N2MT7Lh5e FXiQLnuwhH569kiVp40O6ldqG+qytMNWiaG1zWdqQAMR6Wxs9Akg03+OLGwDv2sF P4B+Q4O1nxOvv8VZkB0qq+E27SBkK1iorO+QGU1AkNC5uFsIpIVHcIQItcA82Z7T WWTKdxgJhinm6RsRkiVNvWGaMj3aTUS0Dm5OWdFxBIFtOwh1meIGjNovPeBWgR9i /xqoQNlLzHA6Z+tdX2EvvONbUlqRLgAXxrNeipZZNpUl+8p6UILSIaEAF1RWs7pP 6kgAOecaG3ItViiAyCXzBXnsLLVtn0CZN/l2QcI5W31JEww== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ys8ajr6gf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 15 Jun 2024 04:34:41 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 15 Jun 2024 04:34:39 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sat, 15 Jun 2024 04:34:39 -0700 Received: from BG-LT91401.marvell.com (unknown [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id 7CCD45B692E; Sat, 15 Jun 2024 04:34:37 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj CC: Gowrishankar Muthukrishnan , Subject: [PATCH] crypto/cnxk: fix ECDH pubkey verify Date: Sat, 15 Jun 2024 17:04:31 +0530 Message-ID: <20240615113434.2331-1-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 3yeKFqi1dTKORzkB1qdE9yzlkaoWzwkY X-Proofpoint-ORIG-GUID: 3yeKFqi1dTKORzkB1qdE9yzlkaoWzwkY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-15_08,2024-06-14_03,2024-05-17_01 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 Fix dequeue operation for ECDH pubkey verify. Fixes: baae0994fa96 ("crypto/cnxk: support ECDH") Fixes: 5c9025583167 ("crypto/cnxk: fix CN9K ECDH public key verification") Cc: stable@dpdk.org Signed-off-by: Gowrishankar Muthukrishnan --- drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 23 ++++++++++++++--------- drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 21 +++++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c index 720b756001..07bd13b16d 100644 --- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c @@ -1186,15 +1186,20 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop return; } else if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC && - cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION && - cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) { - if (likely(compcode == CPT_COMP_GOOD)) { - if (uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) { - cop->status = RTE_CRYPTO_OP_STATUS_ERROR; - return; - } else if (uc_compcode == ROC_AE_ERR_ECC_PAI) { - cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; - return; + cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { + struct cnxk_ae_sess *sess; + + sess = (struct cnxk_ae_sess *)cop->asym->session; + if (sess->xfrm_type == RTE_CRYPTO_ASYM_XFORM_ECDH && + cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) { + if (likely(compcode == CPT_COMP_GOOD)) { + if (uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) { + cop->status = RTE_CRYPTO_OP_STATUS_ERROR; + return; + } else if (uc_compcode == ROC_AE_ERR_ECC_PAI) { + cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; + return; + } } } } diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c index 96a75a7797..f443cb9563 100644 --- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c @@ -523,14 +523,19 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop, if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE) cop->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; else if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC && - cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION && - cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) { - if (res->uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) { - cop->status = RTE_CRYPTO_OP_STATUS_ERROR; - return; - } else if (res->uc_compcode == ROC_AE_ERR_ECC_PAI) { - cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; - return; + cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { + struct cnxk_ae_sess *sess; + + sess = (struct cnxk_ae_sess *)cop->asym->session; + if (sess->xfrm_type == RTE_CRYPTO_ASYM_XFORM_ECDH && + cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) { + if (res->uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) { + cop->status = RTE_CRYPTO_OP_STATUS_ERROR; + return; + } else if (res->uc_compcode == ROC_AE_ERR_ECC_PAI) { + cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS; + return; + } } } else cop->status = RTE_CRYPTO_OP_STATUS_ERROR; -- 2.25.1