From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <deepak.k.jain@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 46C0E275D
 for <dev@dpdk.org>; Sun, 10 Jul 2016 12:21:27 +0200 (CEST)
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga103.fm.intel.com with ESMTP; 10 Jul 2016 03:21:27 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,340,1464678000"; d="scan'208";a="136703761"
Received: from sie-lab-214-241.ir.intel.com (HELO
 silpixa00382162.ir.intel.com) ([10.237.214.241])
 by fmsmga004.fm.intel.com with ESMTP; 10 Jul 2016 03:21:25 -0700
From: Deepak Kumar Jain <deepak.k.jain@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com,
 john.griffin@intel.com, Deepak Kumar Jain <deepak.k.jain@intel.com>
Date: Sun, 10 Jul 2016 11:21:22 +0100
Message-Id: <1468146082-244275-1-git-send-email-deepak.k.jain@intel.com>
X-Mailer: git-send-email 2.5.5
Subject: [dpdk-dev] [PATCH] qat: fix for digest verification use case
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sun, 10 Jul 2016 10:21:27 -0000

This fixes the cases in which operation was Digest verify.

Fixes: e25200fbb45df ("crypto: add cipher/auth only support")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
 drivers/crypto/qat/qat_adf/qat_algs.h            |  3 ++-
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 10 +++++++++-
 drivers/crypto/qat/qat_crypto.c                  |  6 ++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h
index b47dbc2..243c1b4 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -112,7 +112,8 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
 						uint8_t *authkey,
 						uint32_t authkeylen,
 						uint32_t add_auth_data_length,
-						uint32_t digestsize);
+						uint32_t digestsize,
+						unsigned int operation);
 
 void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header);
 
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index aa108d4..185bb33 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -51,6 +51,7 @@
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include <rte_crypto_sym.h>
 
 #include "../qat_logs.h"
 #include "qat_algs.h"
@@ -502,7 +503,8 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
 						uint8_t *authkey,
 						uint32_t authkeylen,
 						uint32_t add_auth_data_length,
-						uint32_t digestsize)
+						uint32_t digestsize,
+						unsigned int operation)
 {
 	struct icp_qat_hw_cipher_algo_blk *cipher;
 	struct icp_qat_hw_auth_algo_blk *hash;
@@ -654,6 +656,12 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
 		ICP_QAT_FW_LA_CMP_AUTH_SET(header->serv_specif_flags,
 			ICP_QAT_FW_LA_NO_CMP_AUTH_RES);
 	}
+	if (operation == RTE_CRYPTO_AUTH_OP_VERIFY) {
+		ICP_QAT_FW_LA_RET_AUTH_SET(header->serv_specif_flags,
+						ICP_QAT_FW_LA_NO_RET_AUTH_RES);
+		ICP_QAT_FW_LA_CMP_AUTH_SET(header->serv_specif_flags,
+						ICP_QAT_FW_LA_CMP_AUTH_RES);
+	}
 
 	/* Cipher CD config setup */
 	cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3;
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 940b2b6..d51ca96 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -560,14 +560,16 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev *dev,
 				cipher_xform->key.data,
 				cipher_xform->key.length,
 				auth_xform->add_auth_data_length,
-				auth_xform->digest_length))
+				auth_xform->digest_length,
+				auth_xform->op))
 			goto error_out;
 	} else {
 		if (qat_alg_aead_session_create_content_desc_auth(session,
 				auth_xform->key.data,
 				auth_xform->key.length,
 				auth_xform->add_auth_data_length,
-				auth_xform->digest_length))
+				auth_xform->digest_length,
+				auth_xform->op))
 			goto error_out;
 	}
 	return session;
-- 
2.5.5