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 F1EB2A0C5A; Mon, 29 Nov 2021 11:41:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10F1642765; Mon, 29 Nov 2021 11:41:13 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 2E10040689; Mon, 29 Nov 2021 10:53:46 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1AT7ZQbC009078; Mon, 29 Nov 2021 01:53:45 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=owL+yEvx51IDYyVIvVBL3b77DK9AOZ8ahfxiHWcTZpU=; b=L2XsoQZcmAv5h2MjgoPXYmsLGtUybdQS2/cAgbmCow3tiRd0U1d59fHKyK8Z5uooLpoa ET+otuAbgATLBnslKA10kn3GB3OhiduXVcdjtndrXPnOoS9a3dck1T77D4QDz1mqnZ/E KrtVYxEIDTQbBT6dZ78ATVpSdnrZGBrvNPUJj7f3zDcOHtXaDX1GfyClIKUC1oAFNNfC oEWTWc2d6yzcL5/d0PV5sHQm5w+ELSCD/nDAbC3ohjGDKsLRO3rnIvAApFjhCpvdfGy/ mQVqB8S46dKEQrBOOtlkmibQtkKed/ndFWTdo6nYE45+w7dEXgXRWfbWzuzxs3peH0O2 nQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cmtkpgdcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 01:53:45 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 29 Nov 2021 01:53:43 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 29 Nov 2021 01:53:43 -0800 Received: from rbalu.marvell.com (unknown [10.29.53.29]) by maili.marvell.com (Postfix) with ESMTP id 96E163F7090; Mon, 29 Nov 2021 01:53:38 -0800 (PST) From: Ramkumar Balu To: Akhil Goyal , Anoob Joseph , Declan Doherty , Fan Zhang , Ankur Dwivedi , "Tejasree Kondoj" CC: , , Ramkumar Subject: [PATCH 4/5] crypto/octeontx2: fix output field for RSA verify Date: Mon, 29 Nov 2021 09:51:58 +0000 Message-ID: <20211129095159.16376-5-rbalu@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211129095159.16376-1-rbalu@marvell.com> References: <20211129095159.16376-1-rbalu@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 3eyfa1uWCsgCQNHauh7yVSnzb7T61Nj0 X-Proofpoint-ORIG-GUID: 3eyfa1uWCsgCQNHauh7yVSnzb7T61Nj0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-29_07,2021-11-28_01,2020-04-07_01 X-Mailman-Approved-At: Mon, 29 Nov 2021 11:41:08 +0100 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 From: Ramkumar During RSA sign verification, the OCTEONTX2 PMD returns the decrypted plaintext in 'sign' field of rte_crypto_rsa_op_param. The 'sign' field is actually used to pass input to the operation. This PMD overwrites the 'sign' field buffer. This is non-compliance to lib cryptodev. This patch fixes the PMD to use 'cipher' field to return the decrypted plaintext during RSA verify operation. Fixes: 04227377c81b ("crypto/octeontx2: support asymmetric in enqueue/dequeue") Cc: stable@dpdk.org Signed-off-by: Ramkumar --- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index 339b82f33e..fb38e309aa 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c @@ -876,20 +876,22 @@ otx2_cpt_asym_rsa_op(struct rte_crypto_op *cop, struct cpt_request_info *req, break; case RTE_CRYPTO_ASYM_OP_VERIFY: if (rsa->pad == RTE_CRYPTO_RSA_PADDING_NONE) { - rsa->sign.length = rsa_ctx->n.length; - memcpy(rsa->sign.data, req->rptr, rsa->sign.length); + rsa->cipher.length = rsa_ctx->n.length; } else { /* Get length of signed output */ - rsa->sign.length = rte_cpu_to_be_16 + rsa->cipher.length = rte_cpu_to_be_16 (*((uint16_t *)req->rptr)); /* * Offset output data pointer by length field - * (2 bytes) and copy signed data. + * (2 bytes). */ - memcpy(rsa->sign.data, req->rptr + 2, - rsa->sign.length); + req->rptr += 2; } - if (memcmp(rsa->sign.data, rsa->message.data, + + if (rsa->cipher.data != NULL) + memcpy(rsa->cipher.data, req->rptr, rsa->cipher.length); + + if (memcmp(req->rptr, rsa->message.data, rsa->message.length)) { CPT_LOG_DP_ERR("RSA verification failed"); cop->status = RTE_CRYPTO_OP_STATUS_ERROR; -- 2.17.1