* [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym
@ 2022-10-18 13:53 Arek Kusztal
2022-10-18 13:53 ` [PATCH v2 2/3] crypto/qat: fix unnecessary session check Arek Kusztal
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Arek Kusztal @ 2022-10-18 13:53 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, Arek Kusztal
Fixed incorrectly placed clean function in asym response.
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 | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 19931791c4..3d7a800392 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -129,20 +129,23 @@ cleanup_crt(struct qat_asym_op_cookie *cookie,
static void
cleanup(struct qat_asym_op_cookie *cookie,
- struct rte_crypto_asym_xform *xform, int alg_size)
+ struct rte_crypto_asym_xform *xform)
{
if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX)
cleanup_arrays(cookie, QAT_ASYM_MODEXP_NUM_IN_PARAMS,
- QAT_ASYM_MODEXP_NUM_OUT_PARAMS, alg_size);
+ QAT_ASYM_MODEXP_NUM_OUT_PARAMS,
+ cookie->alg_bytesize);
else if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV)
cleanup_arrays(cookie, QAT_ASYM_MODINV_NUM_IN_PARAMS,
- QAT_ASYM_MODINV_NUM_OUT_PARAMS, alg_size);
+ QAT_ASYM_MODINV_NUM_OUT_PARAMS,
+ cookie->alg_bytesize);
else if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) {
if (xform->rsa.key_type == RTE_RSA_KEY_TYPE_QT)
- cleanup_crt(cookie, alg_size);
+ cleanup_crt(cookie, cookie->alg_bytesize);
else {
cleanup_arrays(cookie, QAT_ASYM_RSA_NUM_IN_PARAMS,
- QAT_ASYM_RSA_NUM_OUT_PARAMS, alg_size);
+ QAT_ASYM_RSA_NUM_OUT_PARAMS,
+ cookie->alg_bytesize);
}
} else {
cleanup_arrays(cookie, QAT_ASYM_MAX_PARAMS,
@@ -804,12 +807,13 @@ qat_asym_build_request(void *in_op, uint8_t *out_msg, void *op_cookie,
op->asym->session->sess_private_data;
int err = 0;
+ op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
if (unlikely(qat_session == NULL)) {
QAT_DP_LOG(ERR, "Session was not created for this device");
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
goto error;
}
- op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
request_init(qat_req);
@@ -882,10 +886,11 @@ qat_asym_process_response(void **out_op, uint8_t *resp,
struct rte_crypto_op *op = (struct rte_crypto_op *)(uintptr_t)
(resp_msg->opaque);
struct qat_asym_op_cookie *cookie = op_cookie;
- struct rte_crypto_asym_xform *xform;
+ struct rte_crypto_asym_xform *xform = NULL;
struct qat_asym_session *qat_session = (struct qat_asym_session *)
op->asym->session->sess_private_data;
+ *out_op = op;
if (cookie->error) {
cookie->error = 0;
if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)
@@ -917,17 +922,13 @@ qat_asym_process_response(void **out_op, uint8_t *resp,
default:
QAT_DP_LOG(ERR,
"Invalid session/xform settings in response ring!");
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- }
-
- if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) {
- op->status = qat_asym_collect_response(op,
- cookie, xform);
- cleanup(cookie, xform, cookie->alg_bytesize);
+ op->status = RTE_CRYPTO_OP_STATUS_ERROR;
}
-
- *out_op = op;
+ if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)
+ op->status = qat_asym_collect_response(op, cookie, xform);
HEXDUMP("resp_msg:", resp_msg, sizeof(struct icp_qat_fw_pke_resp));
+ if (likely(xform != NULL))
+ cleanup(cookie, xform);
return 1;
}
--
2.13.6
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] crypto/qat: fix unnecessary session check
2022-10-18 13:53 [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Arek Kusztal
@ 2022-10-18 13:53 ` Arek Kusztal
2022-10-21 8:29 ` Power, Ciara
2022-10-18 13:53 ` [PATCH v2 3/3] crypto/qat: fix not set rsa lengths Arek Kusztal
2022-10-21 8:29 ` [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Power, Ciara
2 siblings, 1 reply; 7+ messages in thread
From: Arek Kusztal @ 2022-10-18 13:53 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, Arek Kusztal
Removed unncessary session check which could lead to segfault,
in case api was changed.
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 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 3d7a800392..0eb5ba79bc 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -808,15 +808,15 @@ qat_asym_build_request(void *in_op, uint8_t *out_msg, void *op_cookie,
int err = 0;
op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- if (unlikely(qat_session == NULL)) {
- QAT_DP_LOG(ERR, "Session was not created for this device");
- op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
- goto error;
- }
-
switch (op->sess_type) {
case RTE_CRYPTO_OP_WITH_SESSION:
request_init(qat_req);
+ if (unlikely(qat_session == NULL)) {
+ QAT_DP_LOG(ERR,
+ "Session was not created for this device");
+ op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+ goto error;
+ }
xform = &qat_session->xform;
break;
case RTE_CRYPTO_OP_SESSIONLESS:
--
2.13.6
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] crypto/qat: fix not set rsa lengths
2022-10-18 13:53 [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Arek Kusztal
2022-10-18 13:53 ` [PATCH v2 2/3] crypto/qat: fix unnecessary session check Arek Kusztal
@ 2022-10-18 13:53 ` Arek Kusztal
2022-10-21 8:29 ` Power, Ciara
2022-10-21 8:29 ` [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Power, Ciara
2 siblings, 1 reply; 7+ messages in thread
From: Arek Kusztal @ 2022-10-18 13:53 UTC (permalink / raw)
To: dev; +Cc: gakhil, kai.ji, Arek Kusztal
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(-)
diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 0eb5ba79bc..05ca95319b 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -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);
}
--
2.13.6
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym
2022-10-18 13:53 [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Arek Kusztal
2022-10-18 13:53 ` [PATCH v2 2/3] crypto/qat: fix unnecessary session check Arek Kusztal
2022-10-18 13:53 ` [PATCH v2 3/3] crypto/qat: fix not set rsa lengths Arek Kusztal
@ 2022-10-21 8:29 ` Power, Ciara
2022-10-21 13:29 ` Akhil Goyal
2 siblings, 1 reply; 7+ messages in thread
From: Power, Ciara @ 2022-10-21 8:29 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, Ji, Kai, Kusztal, ArkadiuszX
> -----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 1/3] crypto/qat: fix uncleared cookies in asym
>
> Fixed incorrectly placed clean function in asym response.
>
> Fixes: 002486db239e ("crypto/qat: refactor asymmetric session")
>
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
> v2:
> - fixed compilation issues
> - split into 3 patches
>
<snip>
Acked-by: Ciara Power <ciara.power@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 2/3] crypto/qat: fix unnecessary session check
2022-10-18 13:53 ` [PATCH v2 2/3] crypto/qat: fix unnecessary session check Arek Kusztal
@ 2022-10-21 8:29 ` Power, Ciara
0 siblings, 0 replies; 7+ messages in thread
From: Power, Ciara @ 2022-10-21 8:29 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, Ji, Kai, Kusztal, ArkadiuszX
> -----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 2/3] crypto/qat: fix unnecessary session check
>
> Removed unncessary session check which could lead to segfault, in case api
> was changed.
>
> Fixes: 002486db239e ("crypto/qat: refactor asymmetric session")
>
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
> v2:
> - fixed compilation issues
> - split into 3 patches
<snip>
Acked-by: Ciara Power <ciara.power@intel.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 3/3] crypto/qat: fix not set rsa lengths
2022-10-18 13:53 ` [PATCH v2 3/3] crypto/qat: fix not set rsa lengths Arek Kusztal
@ 2022-10-21 8:29 ` Power, Ciara
0 siblings, 0 replies; 7+ messages in thread
From: Power, Ciara @ 2022-10-21 8:29 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, Ji, Kai, Kusztal, ArkadiuszX
> -----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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym
2022-10-21 8:29 ` [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Power, Ciara
@ 2022-10-21 13:29 ` Akhil Goyal
0 siblings, 0 replies; 7+ messages in thread
From: Akhil Goyal @ 2022-10-21 13:29 UTC (permalink / raw)
To: Power, Ciara, Kusztal, ArkadiuszX, dev; +Cc: Ji, Kai, Kusztal, ArkadiuszX
> > Subject: [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym
> >
> > Fixed incorrectly placed clean function in asym response.
> >
> > Fixes: 002486db239e ("crypto/qat: refactor asymmetric session")
> >
> > Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> > ---
> > v2:
> > - fixed compilation issues
> > - split into 3 patches
> >
> <snip>
>
> Acked-by: Ciara Power <ciara.power@intel.com>
Series applied to dpdk-next-crypto
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-10-21 13:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 13:53 [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Arek Kusztal
2022-10-18 13:53 ` [PATCH v2 2/3] crypto/qat: fix unnecessary session check Arek Kusztal
2022-10-21 8:29 ` Power, Ciara
2022-10-18 13:53 ` [PATCH v2 3/3] crypto/qat: fix not set rsa lengths Arek Kusztal
2022-10-21 8:29 ` Power, Ciara
2022-10-21 8:29 ` [PATCH v2 1/3] crypto/qat: fix uncleared cookies in asym Power, Ciara
2022-10-21 13:29 ` 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).