DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] examples/ipsec-secgw: set AES-CTR IV length to 16
@ 2022-12-15  3:58 Tejasree Kondoj
  2022-12-15  5:42 ` [PATCH v2] " Tejasree Kondoj
  0 siblings, 1 reply; 9+ messages in thread
From: Tejasree Kondoj @ 2022-12-15  3:58 UTC (permalink / raw)
  To: Akhil Goyal, Radu Nicolau; +Cc: Anoob Joseph, dev

Set AES-CTR IV length as 16 instead of taking from
SA config option since the application populates
16B IV in the datapath. AES-CTR requires 16B IV
constructed from nonce and counter.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 examples/ipsec-secgw/sa.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 024831c177..cee29008ba 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1319,9 +1319,14 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
 			case RTE_CRYPTO_CIPHER_NULL:
 			case RTE_CRYPTO_CIPHER_3DES_CBC:
 			case RTE_CRYPTO_CIPHER_AES_CBC:
-			case RTE_CRYPTO_CIPHER_AES_CTR:
 				iv_length = sa->iv_len;
 				break;
+			case RTE_CRYPTO_CIPHER_AES_CTR:
+				/* Length includes 8B per packet IV, 4B nonce and
+				 * 4B counter as populated in datapath.
+				 */
+				iv_length = 16;
+				break;
 			default:
 				RTE_LOG(ERR, IPSEC_ESP,
 						"unsupported cipher algorithm %u\n",
-- 
2.25.1


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

* [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
  2022-12-15  3:58 [PATCH] examples/ipsec-secgw: set AES-CTR IV length to 16 Tejasree Kondoj
@ 2022-12-15  5:42 ` Tejasree Kondoj
  2023-02-01 14:16   ` Akhil Goyal
  2023-02-23 15:43   ` [PATCH v3] " Tejasree Kondoj
  0 siblings, 2 replies; 9+ messages in thread
From: Tejasree Kondoj @ 2022-12-15  5:42 UTC (permalink / raw)
  To: Akhil Goyal, Radu Nicolau; +Cc: Anoob Joseph, dev

Set AES-CTR IV length as 16 instead of taking from
SA config option since the application populates
16B IV in the datapath. AES-CTR requires 16B IV
constructed from nonce and counter.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---

v2:
* Rebased v1

 examples/ipsec-secgw/sa.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 7da9444a7b..5bb73a9137 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1328,9 +1328,14 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
 			case RTE_CRYPTO_CIPHER_DES_CBC:
 			case RTE_CRYPTO_CIPHER_3DES_CBC:
 			case RTE_CRYPTO_CIPHER_AES_CBC:
-			case RTE_CRYPTO_CIPHER_AES_CTR:
 				iv_length = sa->iv_len;
 				break;
+			case RTE_CRYPTO_CIPHER_AES_CTR:
+				/* Length includes 8B per packet IV, 4B nonce and
+				 * 4B counter as populated in datapath.
+				 */
+				iv_length = 16;
+				break;
 			default:
 				RTE_LOG(ERR, IPSEC_ESP,
 						"unsupported cipher algorithm %u\n",
-- 
2.25.1


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

* RE: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
  2022-12-15  5:42 ` [PATCH v2] " Tejasree Kondoj
@ 2023-02-01 14:16   ` Akhil Goyal
  2023-02-01 14:37     ` Nicolau, Radu
  2023-02-23 15:43   ` [PATCH v3] " Tejasree Kondoj
  1 sibling, 1 reply; 9+ messages in thread
From: Akhil Goyal @ 2023-02-01 14:16 UTC (permalink / raw)
  To: Radu Nicolau; +Cc: Anoob Joseph, dev, Tejasree Kondoj

Hi Radu,

> Subject: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
> 
> Set AES-CTR IV length as 16 instead of taking from
> SA config option since the application populates
> 16B IV in the datapath. AES-CTR requires 16B IV
> constructed from nonce and counter.
> 
> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Do you have a comment on this?

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

* Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
  2023-02-01 14:16   ` Akhil Goyal
@ 2023-02-01 14:37     ` Nicolau, Radu
  2023-02-21 16:37       ` [EXT] " Tejasree Kondoj
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolau, Radu @ 2023-02-01 14:37 UTC (permalink / raw)
  To: Akhil Goyal; +Cc: Anoob Joseph, dev, Tejasree Kondoj

Hi

On 2/1/2023 2:16 PM, Akhil Goyal wrote:
> Hi Radu,
>
>> Subject: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
>>
>> Set AES-CTR IV length as 16 instead of taking from
>> SA config option since the application populates
>> 16B IV in the datapath. AES-CTR requires 16B IV
>> constructed from nonce and counter.
>>
>> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> Do you have a comment on this?

No real objection, only that there is already an inconsistency in the 
definitions of the aes-xxx-ctr entries, 128 bit IV is 8 bytes, 192 and 
256 are 16 bytes. Maybe it would be better to change the 128 bit variant 
definition? In any case:

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


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

* RE: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
  2023-02-01 14:37     ` Nicolau, Radu
@ 2023-02-21 16:37       ` Tejasree Kondoj
  2023-02-22  9:56         ` Nicolau, Radu
  0 siblings, 1 reply; 9+ messages in thread
From: Tejasree Kondoj @ 2023-02-21 16:37 UTC (permalink / raw)
  To: Nicolau, Radu, Akhil Goyal; +Cc: Anoob Joseph, dev

Hi Radu,

Shall I change AES-128-CTR iv_len field in cipher_algos struct of sa.c from 8 to 16 and
revert below change?

Thanks
Tejasree

> -----Original Message-----
> From: Nicolau, Radu <radu.nicolau@intel.com>
> Sent: Wednesday, February 1, 2023 8:08 PM
> To: Akhil Goyal <gakhil@marvell.com>
> Cc: Anoob Joseph <anoobj@marvell.com>; dev@dpdk.org; Tejasree Kondoj
> <ktejasree@marvell.com>
> Subject: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to
> 16
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi
> 
> On 2/1/2023 2:16 PM, Akhil Goyal wrote:
> > Hi Radu,
> >
> >> Subject: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
> >>
> >> Set AES-CTR IV length as 16 instead of taking from SA config option
> >> since the application populates 16B IV in the datapath. AES-CTR
> >> requires 16B IV constructed from nonce and counter.
> >>
> >> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> > Do you have a comment on this?
> 
> No real objection, only that there is already an inconsistency in the
> definitions of the aes-xxx-ctr entries, 128 bit IV is 8 bytes, 192 and
> 256 are 16 bytes. Maybe it would be better to change the 128 bit variant
> definition? In any case:
> 
> Reviewed-by: Radu Nicolau <radu.nicolau@intel.com>


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

* RE: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
  2023-02-21 16:37       ` [EXT] " Tejasree Kondoj
@ 2023-02-22  9:56         ` Nicolau, Radu
  2023-02-22 13:43           ` Akhil Goyal
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolau, Radu @ 2023-02-22  9:56 UTC (permalink / raw)
  To: Tejasree Kondoj, Akhil Goyal; +Cc: Anoob Joseph, dev

Hi Tejasree, I think it will make more sense but I will let Akhil decide.

-----Original Message-----
From: Tejasree Kondoj <ktejasree@marvell.com> 
Sent: Tuesday, February 21, 2023 4:38 PM
To: Nicolau, Radu <radu.nicolau@intel.com>; Akhil Goyal <gakhil@marvell.com>
Cc: Anoob Joseph <anoobj@marvell.com>; dev@dpdk.org
Subject: RE: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16

Hi Radu,

Shall I change AES-128-CTR iv_len field in cipher_algos struct of sa.c from 8 to 16 and revert below change?

Thanks
Tejasree

> -----Original Message-----
> From: Nicolau, Radu <radu.nicolau@intel.com>
> Sent: Wednesday, February 1, 2023 8:08 PM
> To: Akhil Goyal <gakhil@marvell.com>
> Cc: Anoob Joseph <anoobj@marvell.com>; dev@dpdk.org; Tejasree Kondoj 
> <ktejasree@marvell.com>
> Subject: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV 
> length to
> 16
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi
> 
> On 2/1/2023 2:16 PM, Akhil Goyal wrote:
> > Hi Radu,
> >
> >> Subject: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 
> >> 16
> >>
> >> Set AES-CTR IV length as 16 instead of taking from SA config option 
> >> since the application populates 16B IV in the datapath. AES-CTR 
> >> requires 16B IV constructed from nonce and counter.
> >>
> >> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> > Do you have a comment on this?
> 
> No real objection, only that there is already an inconsistency in the 
> definitions of the aes-xxx-ctr entries, 128 bit IV is 8 bytes, 192 and
> 256 are 16 bytes. Maybe it would be better to change the 128 bit 
> variant definition? In any case:
> 
> Reviewed-by: Radu Nicolau <radu.nicolau@intel.com>


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

* RE: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16
  2023-02-22  9:56         ` Nicolau, Radu
@ 2023-02-22 13:43           ` Akhil Goyal
  0 siblings, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2023-02-22 13:43 UTC (permalink / raw)
  To: Nicolau, Radu, Tejasree Kondoj; +Cc: Anoob Joseph, dev


> Hi Tejasree, I think it will make more sense but I will let Akhil decide.
> 
> Hi Radu,
> 
> Shall I change AES-128-CTR iv_len field in cipher_algos struct of sa.c from 8 to
> 16 and revert below change?
> 
It is ok to do that, but make sure to add a comment that it includes 4B nonce and 4B counter.

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

* [PATCH v3] examples/ipsec-secgw: set AES-CTR IV length to 16
  2022-12-15  5:42 ` [PATCH v2] " Tejasree Kondoj
  2023-02-01 14:16   ` Akhil Goyal
@ 2023-02-23 15:43   ` Tejasree Kondoj
  2023-02-27 17:45     ` Akhil Goyal
  1 sibling, 1 reply; 9+ messages in thread
From: Tejasree Kondoj @ 2023-02-23 15:43 UTC (permalink / raw)
  To: Akhil Goyal, Radu Nicolau; +Cc: Anoob Joseph, dev

Set AES-CTR IV length to 16 which includes
8B per packet IV, 4B nonce and 4B counter
as populated in datapath.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---

v3:
* Changed IV length in initialization.
v2:
* Rebased v1

 examples/ipsec-secgw/sa.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 7da9444a7b..eb485e6b2b 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -96,7 +96,10 @@ const struct supported_cipher_algo cipher_algos[] = {
 	{
 		.keyword = "aes-128-ctr",
 		.algo = RTE_CRYPTO_CIPHER_AES_CTR,
-		.iv_len = 8,
+		/* iv_len includes 8B per packet IV, 4B nonce
+		 * and 4B counter
+		 */
+		.iv_len = 16,
 		.block_size = 4,
 		.key_len = 20
 	},
-- 
2.25.1


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

* RE: [PATCH v3] examples/ipsec-secgw: set AES-CTR IV length to 16
  2023-02-23 15:43   ` [PATCH v3] " Tejasree Kondoj
@ 2023-02-27 17:45     ` Akhil Goyal
  0 siblings, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2023-02-27 17:45 UTC (permalink / raw)
  To: Tejasree Kondoj, Radu Nicolau; +Cc: Anoob Joseph, dev

> Subject: [PATCH v3] examples/ipsec-secgw: set AES-CTR IV length to 16
> 
> Set AES-CTR IV length to 16 which includes
> 8B per packet IV, 4B nonce and 4B counter
> as populated in datapath.
> 
> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto
Thanks.

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

end of thread, other threads:[~2023-02-27 17:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15  3:58 [PATCH] examples/ipsec-secgw: set AES-CTR IV length to 16 Tejasree Kondoj
2022-12-15  5:42 ` [PATCH v2] " Tejasree Kondoj
2023-02-01 14:16   ` Akhil Goyal
2023-02-01 14:37     ` Nicolau, Radu
2023-02-21 16:37       ` [EXT] " Tejasree Kondoj
2023-02-22  9:56         ` Nicolau, Radu
2023-02-22 13:43           ` Akhil Goyal
2023-02-23 15:43   ` [PATCH v3] " Tejasree Kondoj
2023-02-27 17:45     ` Akhil Goyal

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).