[v2,3/3] crypto/qat: fix not set rsa lengths
Checks
Commit Message
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>
---
v2:
- fixed compilation issues
- split into 3 patches
drivers/crypto/qat/qat_asym.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
Comments
> -----Original Message-----
> From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> Sent: Tuesday 18 October 2022 14:54
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Ji, Kai <kai.ji@intel.com>; Kusztal, ArkadiuszX
> <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH v2 3/3] crypto/qat: fix not set rsa lengths
>
> 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>
> ---
> v2:
> - fixed compilation issues
> - split into 3 patches
>
> drivers/crypto/qat/qat_asym.c | 24 ++++++++++--------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
<snip>
Acked-by: Ciara Power <ciara.power@intel.com>
@@ -508,21 +508,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);
@@ -534,13 +532,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);
@@ -550,11 +547,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);
}