DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/cnxk: fix bus error on RSA verify
@ 2021-10-25  4:00 kirankumark
  2021-10-25  4:17 ` Anoob Joseph
  0 siblings, 1 reply; 3+ messages in thread
From: kirankumark @ 2021-10-25  4:00 UTC (permalink / raw)
  To: Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj; +Cc: dev, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

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 <kirankumark@marvell.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-31 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25  4:00 [dpdk-dev] [PATCH] crypto/cnxk: fix bus error on RSA verify kirankumark
2021-10-25  4:17 ` Anoob Joseph
2021-10-31 19:37   ` Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).