From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52008432E5 for ; Thu, 9 Nov 2023 15:29:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37A7440281; Thu, 9 Nov 2023 15:29:00 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 24BBF4026B for ; Thu, 9 Nov 2023 15:28:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699540138; x=1731076138; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=F6hg6HsDcYYGpuuhlP2TIYjvTq4eYZZrd3ES5+bFi/A=; b=B9fk1wUfmnjEqHyf+ztLGdf9wzmogGhHeTskcy/OIxDv2xsPt3UnZMMo mMdzx11J4bLHb7Hf+VBOua3Ia56FAbma5uxXerqbjUxloQhl/xfFfOhnC tLpYHrfAj22LpWmNHKDR/VFNBs4C8N02IUn6dF+QDOE1jv2ZIthHnqDv/ CBY7qenIOoyMK2VvBkikS03/yqPMeNhO7tNhJ/T5S5ndStjX76kpqwMUN YWJ7A4YNRHCeBYmlkh8jcRDIE1bL92TNAcr4JiXEASfFMZKrhEjeADCHO C2t0DWqNAEEFM1RlSVbIHyHUGvJfEBWHBcFKw40USCsNSkvB/0e/u+bHe g==; X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="3022564" X-IronPort-AV: E=Sophos;i="6.03,289,1694761200"; d="scan'208";a="3022564" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 06:28:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="792547628" X-IronPort-AV: E=Sophos;i="6.03,289,1694761200"; d="scan'208";a="792547628" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by orsmga008.jf.intel.com with ESMTP; 09 Nov 2023 06:28:55 -0800 From: Ciara Power To: stable@dpdk.org Cc: ktraynor@redhat.com, Ciara Power Subject: [PATCH 21.11] crypto/qat: fix NULL algorithm digest placement Date: Thu, 9 Nov 2023 14:28:52 +0000 Message-Id: <20231109142852.4052616-1-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [upstream commit 8b4618a7b453dec02ca8ea40871fb124100f98f4] QAT HW generates bytes of 0x00 digest, even when a digest of len 0 is requested for NULL. This caused test failures when the test vector had digest len 0, as the buffer has unexpected changed bytes. By placing the digest into the cookie for NULL authentication, the buffer remains unchanged as expected, and the digest is placed to the side, as it won't be used anyway. Fixes: db0e952a5c01 ("crypto/qat: add NULL capability") Signed-off-by: Ciara Power --- drivers/crypto/qat/qat_sym.c | 6 +++--- drivers/crypto/qat/qat_sym.h | 2 ++ drivers/crypto/qat/qat_sym_pmd.c | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 0dd83ee2ee..ff3d1ec484 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -394,9 +394,9 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, } min_ofs = auth_ofs; - - if (ctx->qat_hash_alg != ICP_QAT_HW_AUTH_ALGO_NULL || - ctx->auth_op == ICP_QAT_HW_AUTH_VERIFY) + if (ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL) + auth_param->auth_res_addr = cookie->digest_null_phys_addr; + else auth_param->auth_res_addr = op->sym->auth.digest.phys_addr; diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h index e3ec7f0de4..91a4c38c37 100644 --- a/drivers/crypto/qat/qat_sym.h +++ b/drivers/crypto/qat/qat_sym.h @@ -52,6 +52,8 @@ struct qat_sym_op_cookie { phys_addr_t cd_phys_addr; } spc_gmac; } opt; + uint8_t digest_null[4]; + phys_addr_t digest_null_phys_addr; }; int diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c index b835245f17..8069989ce8 100644 --- a/drivers/crypto/qat/qat_sym_pmd.c +++ b/drivers/crypto/qat/qat_sym_pmd.c @@ -43,6 +43,11 @@ qat_sym_init_op_cookie(void *op_cookie) rte_mempool_virt2iova(cookie) + offsetof(struct qat_sym_op_cookie, opt.spc_gmac.cd_cipher); + + cookie->digest_null_phys_addr = + rte_mempool_virt2iova(cookie) + + offsetof(struct qat_sym_op_cookie, + digest_null); } static uint16_t -- 2.25.1