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 9EAFBA04FF for ; Tue, 22 Mar 2022 14:39:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 968D240694; Tue, 22 Mar 2022 14:39:29 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id B250540694 for ; Tue, 22 Mar 2022 14:39:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647956368; x=1679492368; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W2rp0mCa+gnLF1q4GYyrj3tI5pk87VozFFB/vAMXzqc=; b=KgU8O0a2MYg4LZLRGemRy8lSwq8xSURL9zQKaZz6FORvXhrja0eJEBhK MprZMgS2a/7mpXAA9wNDLa7H9UZyGvqRIEk4WaCFs2xAd6ogbw1cSkNLX H0swrN5fjhuRVVt1ND/C0DrKdNYKEf/uWE3JlOScdrFaLRE75Uo0hsqHc X2l3nhioLDUO2UFQrtSYE22HlNeMc60J8UP1A6QSKXW+O5BWf10ERKxHT upfoB0CDihJ//3y4iE9TdGBeaiFHesUAO5UKru1Xsu5oi11fL3MCCVP78 Dq6GP4+EXTY4+Xf81lKoMSA4UrMsdL2Lm0jJaHwVJ6jfaL/oDlajFReFI A==; X-IronPort-AV: E=McAfee;i="6200,9189,10293"; a="256639512" X-IronPort-AV: E=Sophos;i="5.90,201,1643702400"; d="scan'208";a="256639512" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2022 06:39:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,201,1643702400"; d="scan'208";a="518879783" Received: from silpixa00401363.ir.intel.com ([10.55.128.38]) by orsmga006.jf.intel.com with ESMTP; 22 Mar 2022 06:39:25 -0700 From: Pablo de Lara To: luca.boccassi@gmail.com Cc: stable@dpdk.org, Pablo de Lara , Fan Zhang , Radu Nicolau Subject: [PATCH 20.11 2/2] crypto/ipsec_mb: fix GMAC parameters setting Date: Tue, 22 Mar 2022 13:39:10 +0000 Message-Id: <20220322133910.664010-2-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220322133910.664010-1-pablo.de.lara.guarch@intel.com> References: <20220322133910.664010-1-pablo.de.lara.guarch@intel.com> 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 837269c2e5c5a8813adfcf59f23b80569048ddeb ] AES-GMAC requires plaintext length to be 0 when using AES-GCM, so only AAD data is used. Fixes: a501609ea646 ("crypto/ipsec_mb: fix length and offset settings") Cc: pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org Signed-off-by: Pablo de Lara Acked-by: Fan Zhang Acked-by: Radu Nicolau Tested-by: Radu Nicolau --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index ab9864739d..94055d8177 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -1438,9 +1438,9 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, op->sym->aead.data.offset; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; - } else { - job->msg_len_to_cipher_in_bytes = 0; + } else { /* AES-GMAC only, only AAD used */ job->msg_len_to_hash_in_bytes = 0; + job->hash_start_src_offset_in_bytes = 0; } job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, @@ -1524,8 +1524,19 @@ set_mb_job_params(JOB_AES_HMAC *job, struct aesni_mb_qp *qp, op->sym->cipher.data.length; break; #endif - case CCM: case GCM: + if (session->cipher.mode == NULL_CIPHER) { + /* AES-GMAC only (only AAD used) */ + job->msg_len_to_cipher_in_bytes = 0; + job->cipher_start_src_offset_in_bytes = 0; + } else { + job->cipher_start_src_offset_in_bytes = + op->sym->aead.data.offset; + job->msg_len_to_cipher_in_bytes = + op->sym->aead.data.length; + } + break; + case CCM: #if IMB_VERSION(0, 54, 3) <= IMB_VERSION_NUM case IMB_CIPHER_CHACHA20_POLY1305: #endif -- 2.25.1