patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [dpdk-dev] crypto/qat: fix digest in buffer
@ 2021-01-20 17:33 Fan Zhang
  2021-01-27 19:40 ` Akhil Goyal
  0 siblings, 1 reply; 2+ messages in thread
From: Fan Zhang @ 2021-01-20 17:33 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Fan Zhang, stable

This patch fixes the missed digest in buffer support to
QAT symmetric raw API. Originally digest in buffer is
supported only for wireless algorithms

Fixes: 728c76b0e50f ("crypto/qat: support raw datapath API")
Cc: roy.fan.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 drivers/crypto/qat/qat_sym_hw_dp.c | 97 +++++++++++++++---------------
 1 file changed, 48 insertions(+), 49 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym_hw_dp.c b/drivers/crypto/qat/qat_sym_hw_dp.c
index dfbbad59b..01afb883e 100644
--- a/drivers/crypto/qat/qat_sym_hw_dp.c
+++ b/drivers/crypto/qat/qat_sym_hw_dp.c
@@ -558,55 +558,6 @@ enqueue_one_chain_job(struct qat_sym_session *ctx,
 	case ICP_QAT_HW_AUTH_ALGO_KASUMI_F9:
 	case ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3:
 		auth_param->u1.aad_adr = auth_iv->iova;
-
-		if (unlikely(n_data_vecs > 1)) {
-			int auth_end_get = 0, i = n_data_vecs - 1;
-			struct rte_crypto_vec *cvec = &data[0];
-			uint32_t len;
-
-			len = data_len - ofs.ofs.auth.tail;
-
-			while (i >= 0 && len > 0) {
-				if (cvec->len >= len) {
-					auth_iova_end = cvec->iova +
-						(cvec->len - len);
-					len = 0;
-					auth_end_get = 1;
-					break;
-				}
-				len -= cvec->len;
-				i--;
-				cvec++;
-			}
-
-			if (unlikely(auth_end_get == 0))
-				return -1;
-		} else
-			auth_iova_end = data[0].iova + auth_param->auth_off +
-				auth_param->auth_len;
-
-		/* Then check if digest-encrypted conditions are met */
-		if ((auth_param->auth_off + auth_param->auth_len <
-			cipher_param->cipher_offset +
-			cipher_param->cipher_length) &&
-			(digest->iova == auth_iova_end)) {
-			/* Handle partial digest encryption */
-			if (cipher_param->cipher_offset +
-					cipher_param->cipher_length <
-					auth_param->auth_off +
-					auth_param->auth_len +
-					ctx->digest_length)
-				req->comn_mid.dst_length =
-					req->comn_mid.src_length =
-					auth_param->auth_off +
-					auth_param->auth_len +
-					ctx->digest_length;
-			struct icp_qat_fw_comn_req_hdr *header =
-				&req->comn_hdr;
-			ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(
-				header->serv_specif_flags,
-				ICP_QAT_FW_LA_DIGEST_IN_BUFFER);
-		}
 		break;
 	case ICP_QAT_HW_AUTH_ALGO_GALOIS_128:
 	case ICP_QAT_HW_AUTH_ALGO_GALOIS_64:
@@ -615,6 +566,54 @@ enqueue_one_chain_job(struct qat_sym_session *ctx,
 		break;
 	}
 
+	if (unlikely(n_data_vecs > 1)) {
+		int auth_end_get = 0, i = n_data_vecs - 1;
+		struct rte_crypto_vec *cvec = &data[0];
+		uint32_t len;
+
+		len = data_len - ofs.ofs.auth.tail;
+
+		while (i >= 0 && len > 0) {
+			if (cvec->len >= len) {
+				auth_iova_end = cvec->iova + len;
+				len = 0;
+				auth_end_get = 1;
+				break;
+			}
+			len -= cvec->len;
+			i--;
+			cvec++;
+		}
+
+		if (unlikely(auth_end_get == 0))
+			return -1;
+	} else
+		auth_iova_end = data[0].iova + auth_param->auth_off +
+			auth_param->auth_len;
+
+	/* Then check if digest-encrypted conditions are met */
+	if ((auth_param->auth_off + auth_param->auth_len <
+		cipher_param->cipher_offset +
+		cipher_param->cipher_length) &&
+		(digest->iova == auth_iova_end)) {
+		/* Handle partial digest encryption */
+		if (cipher_param->cipher_offset +
+				cipher_param->cipher_length <
+				auth_param->auth_off +
+				auth_param->auth_len +
+				ctx->digest_length)
+			req->comn_mid.dst_length =
+				req->comn_mid.src_length =
+				auth_param->auth_off +
+				auth_param->auth_len +
+				ctx->digest_length;
+		struct icp_qat_fw_comn_req_hdr *header =
+			&req->comn_hdr;
+		ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(
+			header->serv_specif_flags,
+			ICP_QAT_FW_LA_DIGEST_IN_BUFFER);
+	}
+
 	return 0;
 }
 
-- 
2.25.1


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

* Re: [dpdk-stable] [dpdk-dev] crypto/qat: fix digest in buffer
  2021-01-20 17:33 [dpdk-stable] [dpdk-dev] crypto/qat: fix digest in buffer Fan Zhang
@ 2021-01-27 19:40 ` Akhil Goyal
  0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2021-01-27 19:40 UTC (permalink / raw)
  To: Fan Zhang, dev; +Cc: stable

> Subject: [dpdk-dev] crypto/qat: fix digest in buffer
> 
> This patch fixes the missed digest in buffer support to
> QAT symmetric raw API. Originally digest in buffer is
> supported only for wireless algorithms
> 
> Fixes: 728c76b0e50f ("crypto/qat: support raw datapath API")
> Cc: roy.fan.zhang@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Applied to dpdk-next-crypto

Thanks.


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

end of thread, other threads:[~2021-01-27 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 17:33 [dpdk-stable] [dpdk-dev] crypto/qat: fix digest in buffer Fan Zhang
2021-01-27 19:40 ` Akhil Goyal

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git