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 993A0A0C45; Mon, 25 Oct 2021 06:00:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58D25407FF; Mon, 25 Oct 2021 06:00:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id C8AC44003E for ; Mon, 25 Oct 2021 06:00:16 +0200 (CEST) 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 SMTP id 19P0E37N015508 for ; Sun, 24 Oct 2021 21:00:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Ek01QmLmiPhwk+OAlGYKwD0HNB7G/x0YPP0duYpZQ3Y=; b=Sl2K/f35KPNPpYlw8WKT2oDnZWMQ7+LyvxZL+l0VQwj8t3vIm1uFNOZDWlQC3fhozu02 MVOH9nTky7BVM5DHemucxHyvRmDRiYNrySE/+CCtBFcFF4GJfPK+NtJgPiZBJ2ZoCfBi OfeJsjUZWwKLbmi3H3c1nXgGvAH2ckuEH+/M50EoZPo5efdHk4nDXeA9L3JvtG/rQqDo 1lVrCPjA8gWiT+/yCymBY3gdDlbnzsnvaN6ukJPUZKTWb751WfzdpTqgbLPik29hyJ9N hzBqf+jBEY/1bqDxO8ZiktDOr6m6GYHf3BucfaotkeF6/jPUXeGLLnGIlhVcpIyXVhHh Mg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3bwhv1rge0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 24 Oct 2021 21:00:15 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 24 Oct 2021 21:00:14 -0700 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; Sun, 24 Oct 2021 21:00:14 -0700 Received: from cavium-kiran.marvell.com (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 7686B3F7114; Sun, 24 Oct 2021 21:00:08 -0700 (PDT) From: To: Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj CC: , Kiran Kumar K Date: Mon, 25 Oct 2021 09:30:04 +0530 Message-ID: <20211025040004.3171175-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: TZdyCQBmNVMuRm92FZkYObQziMfcr2zO X-Proofpoint-GUID: TZdyCQBmNVMuRm92FZkYObQziMfcr2zO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-25_01,2021-10-25_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH] crypto/cnxk: fix bus error on RSA verify 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" From: Kiran Kumar K While creating RSA session, private key length is not being calculated properly. This is causing bus error on RSA verify. This patch fix the issue with length calculation. Fixes: 5a3513caeb455 ("crypto/cnxk: add asymmetric session") Signed-off-by: Kiran Kumar K --- drivers/crypto/cnxk/cnxk_ae.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h index 00dc75ef9d..6222171fe6 100644 --- a/drivers/crypto/cnxk/cnxk_ae.h +++ b/drivers/crypto/cnxk/cnxk_ae.h @@ -82,15 +82,15 @@ cnxk_ae_fill_rsa_params(struct cnxk_ae_sess *sess, struct rte_crypto_rsa_xform *rsa = &sess->rsa_ctx; size_t mod_len = xfrm_rsa->n.length; size_t exp_len = xfrm_rsa->e.length; - size_t len = (mod_len / 2); uint64_t total_size; + size_t len = 0; if (qt.p.length != 0 && qt.p.data == NULL) return -EINVAL; /* Make sure key length used is not more than mod_len/2 */ if (qt.p.data != NULL) - len = RTE_MIN(len, qt.p.length); + len = (((mod_len / 2) < qt.p.length) ? 0 : qt.p.length); /* Total size required for RSA key params(n,e,(q,dQ,p,dP,qInv)) */ total_size = mod_len + exp_len + 5 * len; -- 2.25.1