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 60C7DA0C5A; Mon, 29 Nov 2021 11:41:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10AFB41147; Mon, 29 Nov 2021 11:41:11 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id EAAB540689; Mon, 29 Nov 2021 10:53:18 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1ASLrU0T017558; Mon, 29 Nov 2021 01:53:18 -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=gfmG/K17S1B8BgwswZveGnpZ8uta98xGz6hunFg/hbo=; b=UN5mOJZHmDvXVphFfaFfLVHjDyFCyohNeNT+9ktzhEM0g0Wb52KShlVEEUM9gE/iA5Gc YWWLwdwHEJRi1IVlqqPC3XU4ZFAfJnTAUTZf2QpE3gAVoT2SZT5DSpL+zR2kV/ho5ZvG Q0RjjjKTmvJFiBjJN+kzCmECZ41nwbArP2I18if2KjsFspkC5U8yqwPbvtL2Oyw/cpnf zLHJZ30EPxAWKNDumjURXkFBu6roCJj7BEpDLXWmhiJqKXUUEBePuZ3QSM+U+Gbt1rie 9b/YNsOSSmsBdVuaGx2cUovHJU8yyejtFqHWBEMEBpHmPL9yf2nQioXUgGTmL0YAQEL9 AQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3cmgkpsuht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 01:53:17 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 29 Nov 2021 01:53:16 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 29 Nov 2021 01:53:16 -0800 Received: from rbalu.marvell.com (unknown [10.29.53.29]) by maili.marvell.com (Postfix) with ESMTP id DC42C3F7079; Mon, 29 Nov 2021 01:53:12 -0800 (PST) From: Ramkumar Balu To: Akhil Goyal , Anoob Joseph , Declan Doherty , Fan Zhang , Ankur Dwivedi , "Tejasree Kondoj" CC: , , Ramkumar Subject: [PATCH 2/5] crypto/openssl: fix output of RSA verify op Date: Mon, 29 Nov 2021 09:51:56 +0000 Message-ID: <20211129095159.16376-3-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-ORIG-GUID: r2s8pKg1049fSOrbP6KjbPPatOebb0DK X-Proofpoint-GUID: r2s8pKg1049fSOrbP6KjbPPatOebb0DK 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 verify, the OpenSSL PMD fails to return the plaintext after public key decryption. This patch fixes the OpenSSL PMD to return the decrypted plaintext in cipher.data / cipher.length fields Fixes: 3e9d6bd447fb ("crypto/openssl: add RSA and mod asym operations") Fixes: fe1606e0138c ("crypto/openssl: fix RSA verify operation") Cc: stable@dpdk.org Signed-off-by: Ramkumar --- drivers/crypto/openssl/rte_openssl_pmd.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 5794ed8159..3ab2c3b5c1 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1953,12 +1953,16 @@ process_openssl_rsa_op(struct rte_crypto_op *cop, break; case RTE_CRYPTO_ASYM_OP_VERIFY: - tmp = rte_malloc(NULL, op->rsa.sign.length, 0); + tmp = op->rsa.cipher.data; if (tmp == NULL) { - OPENSSL_LOG(ERR, "Memory allocation failed"); - cop->status = RTE_CRYPTO_OP_STATUS_ERROR; - break; + tmp = rte_malloc(NULL, op->rsa.sign.length, 0); + if (tmp == NULL) { + OPENSSL_LOG(ERR, "Memory allocation failed"); + cop->status = RTE_CRYPTO_OP_STATUS_ERROR; + break; + } } + ret = RSA_public_decrypt(op->rsa.sign.length, op->rsa.sign.data, tmp, @@ -1974,7 +1978,9 @@ process_openssl_rsa_op(struct rte_crypto_op *cop, OPENSSL_LOG(ERR, "RSA sign Verification failed"); cop->status = RTE_CRYPTO_OP_STATUS_ERROR; } - rte_free(tmp); + op->rsa.cipher.length = ret; + if (tmp != op->rsa.cipher.data) + rte_free(tmp); break; default: -- 2.17.1