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 DD755456E4 for ; Mon, 29 Jul 2024 14:58:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF70F40676; Mon, 29 Jul 2024 14:58:13 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 29D1D4066D; Mon, 29 Jul 2024 14:58:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722257892; x=1753793892; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ur1acSurhfBRVfUlZwJl9wBHyZ6TpU6x5xTVGhZ80Pk=; b=dkFhIPO4XpWFek+UqfgS6W5B48ErVrQYoYibGjXQnqsICtIvv5z5ny0k +bxivpPfakjZlTenZx8xUwlgOovj/Fj6uUD99Otn1MFKTaXMNvLCAiQ/8 gEmvCMXnuqP5V6UyVQczh+TNCzPV8uiXv71Ni6wakiexoA8yvgGr+XNJO WwEi6fwtNjesfJyAtGUmVmQ2HIPzIx7ESYH5ZJ2HfHMp3MD5xhwyK/bKx iTG0LY5CQuyYM5PE8PsdTWv7zkL6XL8YLCA/7pnJ5TWn2iXJk3IktnQGj 3kZRdzcsGVDSwCNT2JHSbEK9XmANdKUYmYYC+mOEyazfe/yOoXLbgLLrW A==; X-CSE-ConnectionGUID: kO7p9nW9T7SO68xzqNQlhA== X-CSE-MsgGUID: ynz8GbuSTM6UWoflqruTAA== X-IronPort-AV: E=McAfee;i="6700,10204,11148"; a="19703397" X-IronPort-AV: E=Sophos;i="6.09,246,1716274800"; d="scan'208";a="19703397" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2024 05:58:09 -0700 X-CSE-ConnectionGUID: GP9SKlGsSFKEDglMdaJq3Q== X-CSE-MsgGUID: IHP4yi6oQxeOTv32lDuX4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,246,1716274800"; d="scan'208";a="53673507" Received: from silpixa00401176.ir.intel.com ([10.243.22.170]) by fmviesa007.fm.intel.com with ESMTP; 29 Jul 2024 05:58:08 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: radu.nicolau@intel.com, gakhil@marvell.com, shihong.wang@corigine.com, stable@dpdk.org Subject: [PATCH] examples/ipsec-secgw: revert fix SA salt endianness Date: Mon, 29 Jul 2024 12:57:54 +0000 Message-Id: <20240729125754.939818-1-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.34.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 The previous commit swapped the bytes of SA salt which led to incorrect work of the ipsec-secgw application. This patch reverts the previous commit and changes the type of the salt field in the ipsec_sa structure. Fixes: e6bfd9676109 ("examples/ipsec-secgw: fix SA salt endianness") Cc: shihong.wang@corigine.com Cc: stable@dpdk.org Signed-off-by: Vladimir Medvedkin --- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/sa.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index a83fd2283b..1fe6b97168 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -117,7 +117,7 @@ struct __rte_cache_aligned ipsec_sa { uint32_t spi; struct cdev_qp *cqp[RTE_MAX_LCORE]; uint64_t seq; - uint32_t salt; + rte_be32_t salt; uint32_t fallback_sessions; enum rte_crypto_cipher_algorithm cipher_algo; enum rte_crypto_auth_algorithm auth_algo; diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 8aa9aca739..c4bac17cd7 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -374,7 +374,6 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, uint32_t ti; /*token index*/ uint32_t *ri /*rule index*/; struct ipsec_sa_cnt *sa_cnt; - rte_be32_t salt; /*big-endian salt*/ uint32_t cipher_algo_p = 0; uint32_t auth_algo_p = 0; uint32_t aead_algo_p = 0; @@ -509,8 +508,8 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, if (algo->algo == RTE_CRYPTO_CIPHER_AES_CTR) { key_len -= 4; rule->cipher_key_len = key_len; - memcpy(&salt, &rule->cipher_key[key_len], 4); - rule->salt = rte_be_to_cpu_32(salt); + memcpy(&rule->salt, + &rule->cipher_key[key_len], 4); } cipher_algo_p = 1; @@ -574,8 +573,8 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, key_len -= 4; rule->auth_key_len = key_len; rule->iv_len = algo->iv_len; - memcpy(&salt, &rule->auth_key[key_len], 4); - rule->salt = rte_be_to_cpu_32(salt); + memcpy(&rule->salt, + &rule->auth_key[key_len], 4); } auth_algo_p = 1; @@ -633,8 +632,8 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, key_len -= 4; rule->cipher_key_len = key_len; - memcpy(&salt, &rule->cipher_key[key_len], 4); - rule->salt = rte_be_to_cpu_32(salt); + memcpy(&rule->salt, + &rule->cipher_key[key_len], 4); aead_algo_p = 1; continue; -- 2.34.1