From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED265A00C5; Wed, 29 Apr 2020 16:55:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98BDD1DAD2; Wed, 29 Apr 2020 16:55:04 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 551E61DACC; Wed, 29 Apr 2020 16:55:03 +0200 (CEST) IronPort-SDR: IxtZNwbx13q+oBkuUzZ9btmhulJmfSG4CevzwQRG0eZwA+D+JZANxXFp7lBnrMF8KBCPihGJF2 qRkp5E5JG70w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 07:55:02 -0700 IronPort-SDR: JAlRlYdJoQXJCojy46q49YlOVxZ7Z/2Cn2mpDDYtKl/drUU2w9nOjfWE8fMXLG3tpaLmB2pr24 XONx22CFI/5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,332,1583222400"; d="scan'208";a="276193733" Received: from akusztax-mobl.ger.corp.intel.com ([10.104.125.72]) by orsmga002.jf.intel.com with ESMTP; 29 Apr 2020 07:55:00 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: fiona.trahe@intel.com, Arek Kusztal , stable@dpdk.org Date: Wed, 29 Apr 2020 16:51:34 +0200 Message-Id: <20200429145135.12852-1-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow 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" Offset of cd pointer is too big by state1size + state2size, so few extra unnecessary bytes will be copied into cd. Snow offset was improved as well. Fixes: d9b7d5bbc845 ("crypto/qat: add ZUC EEA3/EIA3 capability") Cc: stable@dpdk.org Signed-off-by: Arek Kusztal --- v2: - added improvement to Snow3G drivers/crypto/qat/qat_sym_session.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 3727d56..58bdbd3 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -1664,7 +1664,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc, (struct icp_qat_fw_la_auth_req_params *) ((char *)&req_tmpl->serv_specif_rqpars + ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET); - uint16_t state1_size = 0, state2_size = 0; + uint16_t state1_size = 0, state2_size = 0, cd_extra_size = 0; uint16_t hash_offset, cd_size; uint32_t *aad_len = NULL; uint32_t wordIndex = 0; @@ -1886,7 +1886,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc, memcpy(cipherconfig->key, authkey, authkeylen); memset(cipherconfig->key + authkeylen, 0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ); - cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + + cd_extra_size += sizeof(struct icp_qat_hw_cipher_config) + authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ; auth_param->hash_state_sz = ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ >> 3; break; @@ -1902,8 +1902,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc, + ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ); memcpy(cdesc->cd_cur_ptr + state1_size, authkey, authkeylen); - cdesc->cd_cur_ptr += state1_size + state2_size - + ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ; + cd_extra_size += ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ; auth_param->hash_state_sz = ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ >> 3; cdesc->min_qat_dev_gen = QAT_GEN2; @@ -1989,7 +1988,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc, RTE_ALIGN_CEIL(hash_cd_ctrl->inner_state1_sz, 8)) >> 3); - cdesc->cd_cur_ptr += state1_size + state2_size; + cdesc->cd_cur_ptr += state1_size + state2_size + cd_extra_size; cd_size = cdesc->cd_cur_ptr-(uint8_t *)&cdesc->cd; cd_pars->u.s.content_desc_addr = cdesc->cd_paddr; -- 2.1.0