[dpdk-dev,1/2] crypto/qat: fix null auth algo issue

Message ID 1516900755-28233-1-git-send-email-fiona.trahe@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Pablo de Lara Guarch
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Fiona Trahe Jan. 25, 2018, 5:19 p.m. UTC
  If auth algorithm is RTE_CRYPTO_AUTH_NULL and digest_length is 0
in the xform and digest pointer is set in the op, then
the PMD may overwrite memory at the digest pointer.
With this patch the memory is not overwritten.

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

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/qat_crypto.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Radu Nicolau Jan. 25, 2018, 5:36 p.m. UTC | #1
> -----Original Message-----
> From: Trahe, Fiona
> Sent: Thursday, January 25, 2018 5:19 PM
> To: dev@dpdk.org
> Cc: Nicolau, Radu <radu.nicolau@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [PATCH 1/2] crypto/qat: fix null auth algo issue
> 
> If auth algorithm is RTE_CRYPTO_AUTH_NULL and digest_length is 0 in the
> xform and digest pointer is set in the op, then the PMD may overwrite
> memory at the digest pointer.
> With this patch the memory is not overwritten.
> 
> Fixes: db0e952a5c01 ("crypto/qat: add NULL capability")
> 
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> ---

Tested and 
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
  
De Lara Guarch, Pablo Jan. 29, 2018, 3:58 p.m. UTC | #2
> -----Original Message-----
> From: Nicolau, Radu
> Sent: Thursday, January 25, 2018 5:37 PM
> To: Trahe, Fiona <fiona.trahe@intel.com>; dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: RE: [PATCH 1/2] crypto/qat: fix null auth algo issue
> 
> 
> > -----Original Message-----
> > From: Trahe, Fiona
> > Sent: Thursday, January 25, 2018 5:19 PM
> > To: dev@dpdk.org
> > Cc: Nicolau, Radu <radu.nicolau@intel.com>; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> > Subject: [PATCH 1/2] crypto/qat: fix null auth algo issue
> >
> > If auth algorithm is RTE_CRYPTO_AUTH_NULL and digest_length is 0 in
> > the xform and digest pointer is set in the op, then the PMD may
> > overwrite memory at the digest pointer.
> > With this patch the memory is not overwritten.
> >
> > Fixes: db0e952a5c01 ("crypto/qat: add NULL capability")
> >
> > Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> > ---
> 
> Tested and
> Acked-by: Radu Nicolau <radu.nicolau@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo
  

Patch

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index cff709a..fdc6d3b 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -1338,7 +1338,9 @@  qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
 		}
 		min_ofs = auth_ofs;
 
-		auth_param->auth_res_addr = op->sym->auth.digest.phys_addr;
+		if (likely(ctx->qat_hash_alg != ICP_QAT_HW_AUTH_ALGO_NULL))
+			auth_param->auth_res_addr =
+					op->sym->auth.digest.phys_addr;
 
 	}