crypto/qat: fix null auth algo overwrite
authorFiona Trahe <fiona.trahe@intel.com>
Thu, 25 Jan 2018 17:19:14 +0000 (17:19 +0000)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Mon, 29 Jan 2018 19:22:33 +0000 (20:22 +0100)
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")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
drivers/crypto/qat/qat_crypto.c

index 61760b6..f2a2875 100644 (file)
@@ -1342,7 +1342,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;
 
        }