patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] examples/ipsec-secgw: revert fix SA salt endianness
@ 2024-07-29 12:57 Vladimir Medvedkin
  2024-07-29 13:13 ` Radu Nicolau
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Medvedkin @ 2024-07-29 12:57 UTC (permalink / raw)
  To: dev; +Cc: radu.nicolau, gakhil, shihong.wang, stable

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 <vladimir.medvedkin@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] examples/ipsec-secgw: revert fix SA salt endianness
  2024-07-29 12:57 [PATCH] examples/ipsec-secgw: revert fix SA salt endianness Vladimir Medvedkin
@ 2024-07-29 13:13 ` Radu Nicolau
  2024-07-29 17:24   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Radu Nicolau @ 2024-07-29 13:13 UTC (permalink / raw)
  To: Vladimir Medvedkin, dev; +Cc: gakhil, shihong.wang, stable


On 29-Jul-24 1:57 PM, Vladimir Medvedkin wrote:
> 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 <vladimir.medvedkin@intel.com>
> ---

Acked-by: Radu Nicolau <radu.nicolau@intel.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] examples/ipsec-secgw: revert fix SA salt endianness
  2024-07-29 13:13 ` Radu Nicolau
@ 2024-07-29 17:24   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2024-07-29 17:24 UTC (permalink / raw)
  To: Vladimir Medvedkin; +Cc: dev, gakhil, shihong.wang, stable, Radu Nicolau

29/07/2024 15:13, Radu Nicolau:
> 
> On 29-Jul-24 1:57 PM, Vladimir Medvedkin wrote:
> > 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 <vladimir.medvedkin@intel.com>
> 
> Acked-by: Radu Nicolau <radu.nicolau@intel.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-29 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-29 12:57 [PATCH] examples/ipsec-secgw: revert fix SA salt endianness Vladimir Medvedkin
2024-07-29 13:13 ` Radu Nicolau
2024-07-29 17:24   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).