From: Ramkumar Balu <rbalu@marvell.com> To: Akhil Goyal <gakhil@marvell.com>, Anoob Joseph <anoobj@marvell.com>, Declan Doherty <declan.doherty@intel.com>, Fan Zhang <roy.fan.zhang@intel.com>, Ankur Dwivedi <adwivedi@marvell.com>, "Tejasree Kondoj" <ktejasree@marvell.com> Cc: <stable@dpdk.org>, <dev@dpdk.org>, Ramkumar <rbalu@marvell.com> Subject: [PATCH 3/5] crypto/octeontx: fix output field for RSA verify Date: Mon, 29 Nov 2021 09:51:57 +0000 Message-ID: <20211129095159.16376-4-rbalu@marvell.com> (raw) In-Reply-To: <20211129095159.16376-1-rbalu@marvell.com> From: Ramkumar <rbalu@marvell.com> During RSA sign verification, the OCTEONTX 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: e9a356e2fc71 ("crypto/octeontx: add asymmetric enqueue/dequeue ops") Cc: stable@dpdk.org Signed-off-by: Ramkumar <rbalu@marvell.com> --- drivers/crypto/octeontx/otx_cryptodev_ops.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index 9e8fd495cf..07ce079d87 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -788,18 +788,20 @@ otx_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; + rsa->cipher.length = rsa_ctx->n.length; else { /* Get length of decrypted output */ - rsa->sign.length = rte_cpu_to_be_16 + rsa->cipher.length = rte_cpu_to_be_16 (*((uint16_t *)req->rptr)); /* Offset data pointer by length fields */ req->rptr += 2; } - memcpy(rsa->sign.data, req->rptr, rsa->sign.length); - 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
next prev parent reply other threads:[~2021-11-29 10:41 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-29 9:51 [PATCH 0/5] cryptodev: fix inconsistency in RSA op usage Ramkumar Balu 2021-11-29 9:51 ` [PATCH 1/5] cryptodev: fix RSA op cipher field description Ramkumar Balu 2021-11-29 9:51 ` [PATCH 2/5] crypto/openssl: fix output of RSA verify op Ramkumar Balu 2021-12-28 9:10 ` Kusztal, ArkadiuszX 2022-01-13 10:34 ` Ramkumar Balu 2021-11-29 9:51 ` Ramkumar Balu [this message] 2021-11-29 9:51 ` [PATCH 4/5] crypto/octeontx2: fix output field for RSA verify Ramkumar Balu 2021-11-29 9:51 ` [PATCH 5/5] crypto/cnxk: " Ramkumar Balu 2021-12-28 8:58 ` [PATCH 0/5] cryptodev: fix inconsistency in RSA op usage Kusztal, ArkadiuszX
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211129095159.16376-4-rbalu@marvell.com \ --to=rbalu@marvell.com \ --cc=adwivedi@marvell.com \ --cc=anoobj@marvell.com \ --cc=declan.doherty@intel.com \ --cc=dev@dpdk.org \ --cc=gakhil@marvell.com \ --cc=ktejasree@marvell.com \ --cc=roy.fan.zhang@intel.com \ --cc=stable@dpdk.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
DPDK patches and discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \ dev@dpdk.org public-inbox-index dev Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git