From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, kai.ji@intel.com,
Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [PATCH 2/2] crypto/qat: fix not set rsa lengths
Date: Wed, 28 Sep 2022 16:58:11 +0100 [thread overview]
Message-ID: <20220928155811.25016-2-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20220928155811.25016-1-arkadiuszx.kusztal@intel.com>
Fixed not set output length in asym pmd
when doing RSA.
Fixes: 002486db239e ("crypto/qat: refactor asymmetric session")
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
drivers/crypto/qat/qat_asym.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 4b0538eea8..78e18dfc1a 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -505,21 +505,19 @@ rsa_collect(struct rte_crypto_asym_op *asym_op,
if (asym_op->rsa.op_type ==
RTE_CRYPTO_ASYM_OP_ENCRYPT) {
- uint8_t *rsa_result = asym_op->rsa.cipher.data;
-
- rte_memcpy(rsa_result,
+ rte_memcpy(asym_op->rsa.cipher.data,
cookie->output_array[0],
alg_bytesize);
+ asym_op->rsa.cipher.length = alg_bytesize;
HEXDUMP("RSA Encrypted data", cookie->output_array[0],
alg_bytesize);
} else {
- uint8_t *rsa_result = asym_op->rsa.cipher.data;
-
switch (asym_op->rsa.padding.type) {
case RTE_CRYPTO_RSA_PADDING_NONE:
- rte_memcpy(rsa_result,
+ rte_memcpy(asym_op->rsa.cipher.data,
cookie->output_array[0],
alg_bytesize);
+ asym_op->rsa.cipher.length = alg_bytesize;
HEXDUMP("RSA signature",
cookie->output_array[0],
alg_bytesize);
@@ -531,13 +529,12 @@ rsa_collect(struct rte_crypto_asym_op *asym_op,
}
} else {
if (asym_op->rsa.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) {
- uint8_t *rsa_result = asym_op->rsa.message.data;
-
switch (asym_op->rsa.padding.type) {
case RTE_CRYPTO_RSA_PADDING_NONE:
- rte_memcpy(rsa_result,
+ rte_memcpy(asym_op->rsa.message.data,
cookie->output_array[0],
alg_bytesize);
+ asym_op->rsa.message.length = alg_bytesize;
HEXDUMP("RSA Decrypted Message",
cookie->output_array[0],
alg_bytesize);
@@ -547,11 +544,10 @@ rsa_collect(struct rte_crypto_asym_op *asym_op,
return RTE_CRYPTO_OP_STATUS_ERROR;
}
} else {
- uint8_t *rsa_result = asym_op->rsa.sign.data;
-
- rte_memcpy(rsa_result,
- cookie->output_array[0],
- alg_bytesize);
+ rte_memcpy(asym_op->rsa.sign.data,
+ cookie->output_array[0],
+ alg_bytesize);
+ asym_op->rsa.sign.length = alg_bytesize;
HEXDUMP("RSA Signature", cookie->output_array[0],
alg_bytesize);
}
--
2.13.6
next prev parent reply other threads:[~2022-09-28 17:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 15:58 [PATCH 1/2] crypto/qat: fix uncleared cookies in asym Arek Kusztal
2022-09-28 15:58 ` Arek Kusztal [this message]
2022-10-07 10:56 ` [EXT] [PATCH 2/2] crypto/qat: fix not set rsa lengths Akhil Goyal
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=20220928155811.25016-2-arkadiuszx.kusztal@intel.com \
--to=arkadiuszx.kusztal@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=kai.ji@intel.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).