patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 21.11] crypto/qat: fix NULL algorithm digest placement
@ 2023-11-09 14:28 Ciara Power
  2023-11-23 10:47 ` Kevin Traynor
  0 siblings, 1 reply; 2+ messages in thread
From: Ciara Power @ 2023-11-09 14:28 UTC (permalink / raw)
  To: stable; +Cc: ktraynor, Ciara Power

[upstream commit 8b4618a7b453dec02ca8ea40871fb124100f98f4]

QAT HW generates bytes of 0x00 digest, even when a digest of len 0 is
requested for NULL. This caused test failures when the test vector had
digest len 0, as the buffer has unexpected changed bytes.

By placing the digest into the cookie for NULL authentication,
the buffer remains unchanged as expected, and the digest
is placed to the side, as it won't be used anyway.

Fixes: db0e952a5c01 ("crypto/qat: add NULL capability")

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 drivers/crypto/qat/qat_sym.c     | 6 +++---
 drivers/crypto/qat/qat_sym.h     | 2 ++
 drivers/crypto/qat/qat_sym_pmd.c | 5 +++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 0dd83ee2ee..ff3d1ec484 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -394,9 +394,9 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 
 		}
 		min_ofs = auth_ofs;
-
-		if (ctx->qat_hash_alg != ICP_QAT_HW_AUTH_ALGO_NULL ||
-				ctx->auth_op == ICP_QAT_HW_AUTH_VERIFY)
+		if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL)
+			auth_param->auth_res_addr = cookie->digest_null_phys_addr;
+		else
 			auth_param->auth_res_addr =
 					op->sym->auth.digest.phys_addr;
 
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index e3ec7f0de4..91a4c38c37 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -52,6 +52,8 @@ struct qat_sym_op_cookie {
 			phys_addr_t cd_phys_addr;
 		} spc_gmac;
 	} opt;
+	uint8_t digest_null[4];
+	phys_addr_t digest_null_phys_addr;
 };
 
 int
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index b835245f17..8069989ce8 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -43,6 +43,11 @@ qat_sym_init_op_cookie(void *op_cookie)
 			rte_mempool_virt2iova(cookie) +
 			offsetof(struct qat_sym_op_cookie,
 			opt.spc_gmac.cd_cipher);
+
+	cookie->digest_null_phys_addr =
+			rte_mempool_virt2iova(cookie) +
+			offsetof(struct qat_sym_op_cookie,
+			digest_null);
 }
 
 static uint16_t
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 21.11] crypto/qat: fix NULL algorithm digest placement
  2023-11-09 14:28 [PATCH 21.11] crypto/qat: fix NULL algorithm digest placement Ciara Power
@ 2023-11-23 10:47 ` Kevin Traynor
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Traynor @ 2023-11-23 10:47 UTC (permalink / raw)
  To: Ciara Power, stable

On 09/11/2023 14:28, Ciara Power wrote:
> [upstream commit 8b4618a7b453dec02ca8ea40871fb124100f98f4]
> 
> QAT HW generates bytes of 0x00 digest, even when a digest of len 0 is
> requested for NULL. This caused test failures when the test vector had
> digest len 0, as the buffer has unexpected changed bytes.
> 
> By placing the digest into the cookie for NULL authentication,
> the buffer remains unchanged as expected, and the digest
> is placed to the side, as it won't be used anyway.
> 
> Fixes: db0e952a5c01 ("crypto/qat: add NULL capability")
> 
> Signed-off-by: Ciara Power<ciara.power@intel.com>
> ---
>   drivers/crypto/qat/qat_sym.c     | 6 +++---
>   drivers/crypto/qat/qat_sym.h     | 2 ++
>   drivers/crypto/qat/qat_sym_pmd.c | 5 +++++
>   3 files changed, 10 insertions(+), 3 deletions(-)

Applied to 21.11. Thanks for backporting.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-23 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 14:28 [PATCH 21.11] crypto/qat: fix NULL algorithm digest placement Ciara Power
2023-11-23 10:47 ` Kevin Traynor

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).