examples/ipsec-secgw: set AES-CTR IV length to 16
PATCH 1/1 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.
--- examples/ipsec-secgw/sa.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
examples/ipsec-secgw/sa.c +6 -1
@@ -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",
Signature · 1 line
2.25.1
PATCH v2 1/1 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.
---
v2:
* Rebased v1
examples/ipsec-secgw/sa.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
examples/ipsec-secgw/sa.c +6 -1
@@ -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",
Signature · 1 line
2.25.1
Hi Radu,
Quoted 8 lines
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 <[email protected]>
Do you have a comment on this?
Nicolau, Radu
Reviewed-byHi
Quoted 11 lines · Akhil Goyal
Hi Radu,
Quoted 8 lines
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 <[email protected]>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:
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
Quoted 32 lines
-----Original Message-----
From: Nicolau, Radu <[email protected]>
Sent: Wednesday, February 1, 2023 8:08 PM
To: Akhil Goyal <[email protected]>
Cc: Anoob Joseph <[email protected]>; [email protected]; Tejasree Kondoj <[email protected]>
Subject: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to 16External Email
----------------------------------------------------------------------
HiQuoted 10 lines · Akhil Goyal
Hi Radu,
Quoted 7 lines
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 <[email protected]>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 <[email protected]>
Hi Tejasree, I think it will make more sense but I will let Akhil decide.
-----Original Message-----
From: Tejasree Kondoj <[email protected]>
Sent: Tuesday, February 21, 2023 4:38 PM
To: Nicolau, Radu <[email protected]>; Akhil Goyal <[email protected]>
Cc: Anoob Joseph <[email protected]>; [email protected]
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
Quoted 34 lines
-----Original Message-----
From: Nicolau, Radu <[email protected]>
Sent: Wednesday, February 1, 2023 8:08 PM
To: Akhil Goyal <[email protected]>
Cc: Anoob Joseph <[email protected]>; [email protected]; Tejasree Kondoj <[email protected]>
Subject: [EXT] Re: [PATCH v2] examples/ipsec-secgw: set AES-CTR IV length to
16External Email
----------------------------------------------------------------------
HiQuoted 11 lines · Akhil Goyal
Hi Radu,
Quoted 8 lines
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 <[email protected]>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 <[email protected]>
Quoted 8 lines
Hi Tejasree, I think it will make more sense but I will let Akhil decide.
Hi Radu,
Shall I change AES-128-CTR
iv_lenfield incipher_algosstruct ofsa.cfrom 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.
PATCH v3 1/1 examples/ipsec-secgw: set AES-CTR IV length to 16
In reply to Tejasree KondojSet AES-CTR IV length to 16 which includes
8B per packet IV, 4B nonce and 4B counter
as populated in datapath.
---
v3:
* Changed IV length in initialization.
v2:
* Rebased v1
examples/ipsec-secgw/sa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
examples/ipsec-secgw/sa.c +4 -1
@@ -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 },
Signature · 1 line
2.25.1
Quoted 7 lines
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 <[email protected]>
Applied to dpdk-next-crypto
Thanks.