DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Nithinsen Kaithakadan <nkaithakadan@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Rupesh Chiluka <rchiluka@marvell.com>,
	"Vidya Sagar Velumuri" <vvelumuri@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 3/9] common/cnxk: set correct salt value for ctr algos
Date: Tue, 27 May 2025 18:31:29 +0530	[thread overview]
Message-ID: <20250527130135.2301726-4-ktejasree@marvell.com> (raw)
In-Reply-To: <20250527130135.2301726-1-ktejasree@marvell.com>

From: Nithinsen Kaithakadan <nkaithakadan@marvell.com>

This patch includes fix for setting correct salt value
for CTR algorithm.

Fixes: 532963b8070 ("crypto/cnxk: move IPsec SA creation to common")

Signed-off-by: Nithinsen Kaithakadan <nkaithakadan@marvell.com>
---
 drivers/common/cnxk/cnxk_security.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index 62ae7b9b2e..0e6777e6ca 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -965,6 +965,8 @@ on_fill_ipsec_common_sa(struct rte_security_ipsec_xform *ipsec,
 		cipher_key_len = crypto_xform->aead.key.length;
 	} else {
 		if (cipher_xform) {
+			if (cipher_xform->cipher.algo == RTE_CRYPTO_CIPHER_AES_CTR)
+				memcpy(common_sa->iv.gcm.nonce, &ipsec->salt, 4);
 			cipher_key = cipher_xform->cipher.key.data;
 			cipher_key_len = cipher_xform->cipher.key.length;
 		}
@@ -1285,6 +1287,9 @@ ow_ipsec_sa_common_param_fill(union roc_ow_ipsec_sa_word2 *w2, uint8_t *cipher_k
 				break;
 			case RTE_CRYPTO_CIPHER_AES_CTR:
 				w2->s.enc_type = ROC_IE_SA_ENC_AES_CTR;
+				memcpy(salt_key, &ipsec_xfrm->salt, 4);
+				tmp_salt = (uint32_t *)salt_key;
+				*tmp_salt = rte_be_to_cpu_32(*tmp_salt);
 				break;
 			case RTE_CRYPTO_CIPHER_3DES_CBC:
 				w2->s.enc_type = ROC_IE_SA_ENC_3DES_CBC;
-- 
2.25.1


  parent reply	other threads:[~2025-05-27 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 13:01 [PATCH 0/9] fixes and new features to cnxk crypto PMD Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 1/9] crypto/cnxk: include required headers Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 2/9] common/cnxk: fix salt handling with aes-ctr Tejasree Kondoj
2025-05-27 13:01 ` Tejasree Kondoj [this message]
2025-05-27 13:01 ` [PATCH 4/9] crypto/cnxk: extend check for max supported gather entries Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 5/9] crypto/cnxk: add struct variable for custom metadata Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 6/9] crypto/cnxk: add asym sessionless handling Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 7/9] crypto/cnxk: add support for sessionless asym Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 8/9] common/cnxk: update qsize in CPT iq enable Tejasree Kondoj
2025-05-27 13:01 ` [PATCH 9/9] crypto/cnxk: copy 8B iv into sess in aes ctr Tejasree Kondoj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250527130135.2301726-4-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=nkaithakadan@marvell.com \
    --cc=rchiluka@marvell.com \
    --cc=vvelumuri@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).