[2/2] crypto/qat: fix not set rsa lengths

Message ID 20220928155811.25016-2-arkadiuszx.kusztal@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [1/2] crypto/qat: fix uncleared cookies in asym |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing fail Testing issues
ci/iol-aarch64-compile-testing fail Testing issues
ci/iol-x86_64-compile-testing fail Testing issues
ci/github-robot: build fail github build: failed
ci/iol-x86_64-unit-testing fail Testing issues

Commit Message

Arkadiusz Kusztal Sept. 28, 2022, 3:58 p.m. UTC
  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(-)
  

Comments

Akhil Goyal Oct. 7, 2022, 10:56 a.m. UTC | #1
> 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>
Please fix compilation
  

Patch

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);
 		}