DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/qat: fix digest issue in wireless auth case
@ 2019-01-25 16:59 Fiona Trahe
  2019-01-25 17:00 ` Kusztal, ArkadiuszX
  0 siblings, 1 reply; 3+ messages in thread
From: Fiona Trahe @ 2019-01-25 16:59 UTC (permalink / raw)
  To: dev
  Cc: pablo.de.lara.guarch, fiona.trahe, roy.fan.zhang, akhil.goyal,
	arkadiuszx.kusztal, stable

When operation calls for auth (digest generation), followed by
encryption of both data plus digest, the digest-in-buffer
flag must be set for QAT.

Fixes: 39e0bee48e81 ("crypto/qat: rework request builder for performance")
cc: stable@dpdk.org

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

diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 10cdf2e10..8801ca567 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -157,6 +157,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 	uint32_t min_ofs = 0;
 	uint64_t src_buf_start = 0, dst_buf_start = 0;
 	uint8_t do_sgl = 0;
+	uint8_t wireless_auth = 0, in_place = 1;
 	struct rte_crypto_op *op = (struct rte_crypto_op *)in_op;
 	struct qat_sym_op_cookie *cookie =
 				(struct qat_sym_op_cookie *)op_cookie;
@@ -269,6 +270,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 			}
 			auth_ofs = op->sym->auth.data.offset >> 3;
 			auth_len = op->sym->auth.data.length >> 3;
+			wireless_auth = 1;
 
 			auth_param->u1.aad_adr =
 					rte_crypto_op_ctophys_offset(op,
@@ -438,6 +440,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 		 * Don't align DMA start. DMA the minimum data-set
 		 * so as not to overwrite data in dest buffer
 		 */
+		in_place = 0;
 		src_buf_start =
 			rte_pktmbuf_iova_offset(op->sym->m_src, min_ofs);
 		dst_buf_start =
@@ -530,6 +533,18 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 	} else {
 		qat_req->comn_mid.src_data_addr = src_buf_start;
 		qat_req->comn_mid.dest_data_addr = dst_buf_start;
+		/* handle case of auth-gen-then-cipher with digest encrypted */
+		if (wireless_auth && in_place &&
+		    (op->sym->auth.digest.phys_addr ==
+				src_buf_start + auth_ofs + auth_len) &&
+		    (auth_ofs + auth_len + ctx->digest_length <=
+				cipher_ofs + cipher_len)) {
+			struct icp_qat_fw_comn_req_hdr *header =
+						&qat_req->comn_hdr;
+			ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(
+				header->serv_specif_flags,
+				ICP_QAT_FW_LA_DIGEST_IN_BUFFER);
+		}
 	}
 
 #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
-- 
2.13.6

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

* Re: [dpdk-dev] [PATCH] crypto/qat: fix digest issue in wireless auth case
  2019-01-25 16:59 [dpdk-dev] [PATCH] crypto/qat: fix digest issue in wireless auth case Fiona Trahe
@ 2019-01-25 17:00 ` Kusztal, ArkadiuszX
  2019-01-27 22:49   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Kusztal, ArkadiuszX @ 2019-01-25 17:00 UTC (permalink / raw)
  To: Trahe, Fiona, dev
  Cc: De Lara Guarch, Pablo, Zhang, Roy Fan, akhil.goyal, stable



> -----Original Message-----
> From: Trahe, Fiona
> Sent: Friday, January 25, 2019 5:59 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com>;
> akhil.goyal@nxp.com; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] crypto/qat: fix digest issue in wireless auth case
> 
> When operation calls for auth (digest generation), followed by encryption of
> both data plus digest, the digest-in-buffer flag must be set for QAT.
> 
> Fixes: 39e0bee48e81 ("crypto/qat: rework request builder for performance")
> cc: stable@dpdk.org
> 
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> ---
>  drivers/crypto/qat/qat_sym.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
> index 10cdf2e10..8801ca567 100644
> 2.13.6

Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>

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

* Re: [dpdk-dev] [PATCH] crypto/qat: fix digest issue in wireless auth case
  2019-01-25 17:00 ` Kusztal, ArkadiuszX
@ 2019-01-27 22:49   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2019-01-27 22:49 UTC (permalink / raw)
  To: Trahe, Fiona
  Cc: dev, Kusztal, ArkadiuszX, De Lara Guarch, Pablo, Zhang, Roy Fan,
	akhil.goyal, stable

> > When operation calls for auth (digest generation), followed by encryption of
> > both data plus digest, the digest-in-buffer flag must be set for QAT.
> > 
> > Fixes: 39e0bee48e81 ("crypto/qat: rework request builder for performance")
> > cc: stable@dpdk.org
> > 
> > Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> 
> Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>

Applied, thanks

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

end of thread, other threads:[~2019-01-27 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 16:59 [dpdk-dev] [PATCH] crypto/qat: fix digest issue in wireless auth case Fiona Trahe
2019-01-25 17:00 ` Kusztal, ArkadiuszX
2019-01-27 22:49   ` Thomas Monjalon

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