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 222E0A0093; Wed, 9 Mar 2022 11:45:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC18B40395; Wed, 9 Mar 2022 11:45:24 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id EED8940150; Wed, 9 Mar 2022 11:45:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646822723; x=1678358723; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WVrJMtmvs8J/BOoe4+nTul72I2xEk/xbpmsa1UOk+cs=; b=gkIqdLUC1vQmdHAYq4/07IaKhbjQ6FIXX26fSR8zMSmfkd3wJxhEPleI HqOKkPEuTjJJc4BgWwdZ65ZRX9kLvxjkjYE3mwIJFC2BNVakFNAj1Knmj 0CjkA9rOV+BwqS4JKz8bWtw068WuBXuicbY8fnF267g3j/IpemFaKIvw7 fPkl+9cwDbmHv9V8dSGcdsHbLrGtiC4BvPjHRl75wcKrNXeL1Qgb49rSX TxQoljnkpXLyNgHlrPF4Qa40FMHzc3HGsDF2BnGgR6LQzTa6fqcbNpA2c MxwvcY8OAK/D8jNlEzhkevjklnPEq4WFDljykJDRgZ42tZvcYgs11taFo g==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="254885932" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="254885932" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 02:45:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="554068554" Received: from silpixa00400636.ir.intel.com ([10.237.213.19]) by orsmga008.jf.intel.com with ESMTP; 09 Mar 2022 02:45:20 -0800 From: Pablo de Lara To: radu.nicolau@intel.com, daniel.m.buckley@intel.com, roy.fan.zhang@intel.com Cc: dev@dpdk.org, Pablo de Lara , stable@dpdk.org Subject: [PATCH] crypto/ipsec_mb: fix GMAC parameters setting Date: Wed, 9 Mar 2022 10:45:14 +0000 Message-Id: <20220309104514.1180589-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index c974886032..afa0b6e3a4 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -1296,9 +1296,9 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_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 *, @@ -1378,8 +1378,18 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->msg_len_to_cipher_in_bits = op->sym->cipher.data.length; break; - case IMB_CIPHER_CCM: case IMB_CIPHER_GCM: + if (session->cipher.mode == IMB_CIPHER_NULL) { + /* 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 IMB_CIPHER_CCM: case IMB_CIPHER_CHACHA20_POLY1305: job->cipher_start_src_offset_in_bytes = op->sym->aead.data.offset; -- 2.25.1