From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 426FDA0096 for ; Fri, 7 Jun 2019 12:09:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D66421B9C7; Fri, 7 Jun 2019 12:09:38 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4A5281B9B4 for ; Fri, 7 Jun 2019 12:09:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2019 03:09:31 -0700 X-ExtLoop1: 1 Received: from damiannx-mobl1.ger.corp.intel.com ([10.103.104.100]) by fmsmga001.fm.intel.com with ESMTP; 07 Jun 2019 03:09:30 -0700 From: Damian Nowak To: dev@dpdk.org Cc: fiona.trahe@intel.com, arkadiuszx.kusztal@intel.com, Damian Nowak Date: Fri, 7 Jun 2019 12:06:00 +0200 Message-Id: <20190607100608.16212-4-damianx.nowak@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190607100608.16212-1-damianx.nowak@intel.com> References: <20190603145048.2596-1-damianx.nowak@intel.com> <20190607100608.16212-1-damianx.nowak@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 03/10] crypto/qat: handle buffer size for digest-encrypted auth-cipher X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds condition to be met when using wireless algorithms (SNOW3G, KASUMI, ZUC) in out-of-place auth-cipher operations. It checks if the digest location overlaps with the data to be encrypted or decrypted and if so, treats as a digest-encrypted case. It also checks if the digest is being encrypted or decrypted partially and extends PMD buffers accordingly. Signed-off-by: Damian Nowak --- drivers/crypto/qat/qat_sym.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 8801ca5..90b0ba4 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -493,6 +493,25 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, (cipher_param->cipher_offset + cipher_param->cipher_length) : (auth_param->auth_off + auth_param->auth_len); + /* Handle case of auth-gen-then-cipher with digest encrypted */ + if (wireless_auth && + (auth_ofs + auth_len < cipher_ofs + cipher_len) && + (op->sym->auth.digest.phys_addr == + (in_place ? src_buf_start : dst_buf_start) + + auth_ofs + auth_len)) { + /* Handle partial digest encryption */ + if (cipher_ofs + cipher_len < + auth_ofs + auth_len + ctx->digest_length) + qat_req->comn_mid.dst_length = + qat_req->comn_mid.src_length += + 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 (do_sgl) { ICP_QAT_FW_COMN_PTR_TYPE_SET(qat_req->comn_hdr.comn_req_flags, @@ -533,18 +552,6 @@ 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.7.4