Netdev List
 help / color / mirror / Atom feed
* [PATCH ipsec-next v3 0/2] xfrm: add ARIA algorithm support
@ 2026-11-27  2:04 Hong In-su
  2026-11-27  2:04 ` [PATCH ipsec-next v3 1/2] xfrm: add ARIA CBC and CTR support Hong In-su
  2026-11-27  2:04 ` [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support Hong In-su
  0 siblings, 2 replies; 5+ messages in thread
From: Hong In-su @ 2026-11-27  2:04 UTC (permalink / raw)
  To: steffen.klassert, herbert
  Cc: davem, edumazet, kuba, pabeni, horms, sd, netdev, ipsec,
	linux-kernel, his1415

The kernel crypto API already provides ARIA implementations, but XFRM
does not have the corresponding algorithm descriptors.

This series adds support for ARIA CBC, RFC3686 CTR and GCM modes in
XFRM, allowing them to be used for ESP.

Following the feedback on v2, the CBC compatibility alias has been
removed. ARIA GCM support has also been added as a separate patch
after completing testing with strongSwan.

CBC and CTR have been tested with strongSwan. GCM has been tested
with 256-bit ARIA keys and all three ICV lengths (64, 96 and 128 bits).

Both patches pass checkpatch with --strict, and xfrm_algo.o builds
successfully against ipsec-next.

Changes in v3:
- Rebase onto ipsec-next.
- Change the patch prefix from net-next to ipsec-next.
- Remove the CBC compatibility alias.
- Add ARIA GCM support as a separate patch.

Changes in v2:
- Remove the CTR compatibility alias.
- Change the CBC default key length to 128 bits.
- Add a comment explaining the 32-bit nonce in the CTR key length.

v2: https://lore.kernel.org/netdev/20260916023135.26043-1-his1415@pribit.com/
v1: https://lore.kernel.org/netdev/20260909054530.7861-1-his1415@pribit.com/

Hong In-su (2):
  xfrm: add ARIA CBC and CTR support
  xfrm: add ARIA GCM support

 net/xfrm/xfrm_algo.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)


base-commit: 4d12fa4df5c15cebc587644e84b8f972874e66f1
-- 
2.43.0




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

* [PATCH ipsec-next v3 1/2] xfrm: add ARIA CBC and CTR support
  2026-11-27  2:04 [PATCH ipsec-next v3 0/2] xfrm: add ARIA algorithm support Hong In-su
@ 2026-11-27  2:04 ` Hong In-su
  2026-11-28  2:33   ` netdev-bot+sashiko
  2026-11-27  2:04 ` [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support Hong In-su
  1 sibling, 1 reply; 5+ messages in thread
From: Hong In-su @ 2026-11-27  2:04 UTC (permalink / raw)
  To: steffen.klassert, herbert
  Cc: davem, edumazet, kuba, pabeni, horms, sd, netdev, ipsec,
	linux-kernel, his1415

The kernel crypto API already provides ARIA implementations, but XFRM
does not have algorithm descriptors for them. Consequently, ARIA cannot
be selected for ESP through XFRM.

Add XFRM algorithm descriptors for CBC and RFC3686 CTR modes using the
existing cbc(aria) and rfc3686(ctr(aria)) crypto algorithms.

The CBC and CTR modes have been tested with IPsec using strongSwan.

Signed-off-by: Hong In-su <his1415@pribit.com>
---
 net/xfrm/xfrm_algo.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 70434495f23f..98ef2c48982a 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -512,6 +512,32 @@ static struct xfrm_algo_desc ealg_list[] = {
 		.sadb_alg_maxbits = 256
 	}
 },
+{
+	.name = "cbc(aria)",
+
+	.uinfo = {
+		.encr = {
+			.geniv = "echainiv",
+			.blockbits = 128,
+			.defkeybits = 128,
+		}
+	},
+
+	.pfkey_supported = 0,
+},
+{
+	.name = "rfc3686(ctr(aria))",
+
+	.uinfo = {
+		.encr = {
+			.geniv = "seqiv",
+			.blockbits = 128,
+			.defkeybits = 160, /* 128-bit key + 32-bit nonce */
+		}
+	},
+
+	.pfkey_supported = 0,
+},
 {
 	.name = "cbc(twofish)",
 	.compat = "twofish",
-- 
2.43.0




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

* [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support
  2026-11-27  2:04 [PATCH ipsec-next v3 0/2] xfrm: add ARIA algorithm support Hong In-su
  2026-11-27  2:04 ` [PATCH ipsec-next v3 1/2] xfrm: add ARIA CBC and CTR support Hong In-su
@ 2026-11-27  2:04 ` Hong In-su
  2026-11-28  2:33   ` netdev-bot+sashiko
  1 sibling, 1 reply; 5+ messages in thread
From: Hong In-su @ 2026-11-27  2:04 UTC (permalink / raw)
  To: steffen.klassert, herbert
  Cc: davem, edumazet, kuba, pabeni, horms, sd, netdev, ipsec,
	linux-kernel, his1415

The kernel crypto API already supports rfc4106(gcm(aria)), but XFRM
does not have the corresponding algorithm descriptors.

Add XFRM AEAD algorithm descriptors for ARIA GCM with 64-bit, 96-bit
and 128-bit ICV lengths.

Tested with strongSwan using 256-bit ARIA keys and all three
supported ICV lengths.

Signed-off-by: Hong In-su <his1415@pribit.com>
---
 net/xfrm/xfrm_algo.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 98ef2c48982a..d74f86d4e672 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -82,6 +82,42 @@ static struct xfrm_algo_desc aead_list[] = {
 		.sadb_alg_maxbits = 256
 	}
 },
+{
+	.name = "rfc4106(gcm(aria))",
+
+	.uinfo = {
+		.aead = {
+			.geniv = "seqiv",
+			.icv_truncbits = 64,
+		}
+	},
+
+	.pfkey_supported = 0,
+},
+{
+	.name = "rfc4106(gcm(aria))",
+
+	.uinfo = {
+		.aead = {
+			.geniv = "seqiv",
+			.icv_truncbits = 96,
+		}
+	},
+
+	.pfkey_supported = 0,
+},
+{
+	.name = "rfc4106(gcm(aria))",
+
+	.uinfo = {
+		.aead = {
+			.geniv = "seqiv",
+			.icv_truncbits = 128,
+		}
+	},
+
+	.pfkey_supported = 0,
+},
 {
 	.name = "rfc4309(ccm(aes))",
 
-- 
2.43.0




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

* Re: [PATCH ipsec-next v3 1/2] xfrm: add ARIA CBC and CTR support
  2026-11-27  2:04 ` [PATCH ipsec-next v3 1/2] xfrm: add ARIA CBC and CTR support Hong In-su
@ 2026-11-28  2:33   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-11-28  2:33 UTC (permalink / raw)
  To: his1415
  Cc: steffen.klassert, herbert, davem, edumazet, kuba, pabeni, horms,
	sd, netdev, ipsec, linux-kernel

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The new ealg_list entries for "cbc(aria)" and
  "rfc3686(ctr(aria))" in net/xfrm/xfrm_algo.c have no .desc block, so…
- [Low] This patch makes "rfc3686(ctr(aria))" selectable as an ESP
  encryption algorithm, but crypto/testmgr.c's alg_test_descs[] has no…

--

xfrm: add ARIA CBC and CTR support

This commit adds XFRM ealg_list descriptors for cbc(aria) and
rfc3686(ctr(aria)), so ARIA can be selected as an ESP encryption
algorithm. Neither entry is exposed through PF_KEY.

> diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
> index 70434495f23f5..98ef2c48982a2 100644
> --- a/net/xfrm/xfrm_algo.c
> +++ b/net/xfrm/xfrm_algo.c
> @@ -512,6 +512,32 @@ static struct xfrm_algo_desc ealg_list[] = {
>  		.sadb_alg_maxbits = 256
>  	}
>  },
> +{
> +	.name = "cbc(aria)",
> +
> +	.uinfo = {
> +		.encr = {
> +			.geniv = "echainiv",
> +			.blockbits = 128,
> +			.defkeybits = 128,
> +		}
> +	},
> +
> +	.pfkey_supported = 0,
> +},

[Severity: High]

Neither this entry nor the rfc3686(ctr(aria)) entry below has a .desc
block, so desc.sadb_alg_id is 0 (SADB_EALG_NONE). Before this patch,
every ealg_list entry had a non-zero sadb_alg_id. Even ecb(cipher_null)
uses SADB_EALG_NULL.

attach_one_algo() in net/xfrm/xfrm_user.c copies that value into the
state:

    x->props.ealgo = algo->desc.sadb_alg_id;

An ESP SA using either ARIA mode therefore ends up with props.ealgo == 0,
x->ealg set and x->aead == NULL.

Can this cause a NULL cipher to be programmed when the SA is offloaded
to an nfp device? Here is the encryption switch in
nfp_net_xfrm_add_state() in drivers/net/ethernet/netronome/nfp/crypto/ipsec.c:

	switch (x->props.ealgo) {
	case SADB_EALG_NONE:
		...
		if (x->aead && !strcmp(x->aead->alg_name, "rfc7539esp(chacha20,poly1305)")) {
			...
			break;
		}
		fallthrough;
	case SADB_EALG_NULL:
		cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC;
		cfg->ctrl_word.cipher = NFP_IPSEC_CIPHER_NULL;
		break;

x->aead is NULL here, so control falls through to SADB_EALG_NULL. Next,
the if (x->ealg) block copies the ARIA key into cfg->ciph_key. The SA is
sent to the NIC and the function returns success. xfrm_dev_state_add()
does not check the algorithm itself.

So an SA set up with something like "enc 'cbc(aria)' ... auth
'hmac(sha256)' ... offload dev <nfp> dir out" would be accepted for
crypto offload. The hardware would then apply a NULL cipher and send
the ESP payloads in plaintext. Inbound ARIA-encrypted traffic would be
passed up as if it had already been decrypted.

Until now, only AH or the chacha20-poly1305 AEAD reached the
SADB_EALG_NONE fallthrough in that driver. The follow-up "xfrm: add ARIA
GCM support" adds only aead_list entries, so the issue remains at the
end of the series.

Should nfp_net_xfrm_add_state() reject SADB_EALG_NONE when x->ealg is
set, or should these descriptors be identified some other way, so that
the offload path does not treat them as NULL encryption?

> +{
> +	.name = "rfc3686(ctr(aria))",

[Severity: Low]

Is a testmgr entry missing for this construction? alg_test_descs[] in
crypto/testmgr.c has entries for cbc(aria), ctr(aria), ecb(aria) and
gcm(aria), but none for rfc3686(ctr(aria)). The rfc3686(ctr(aes)) mode
that XFRM already exposes has one, using aes_ctr_rfc3686_tv_template.

When ESP instantiates this transform, alg_test() takes the notest path
and logs:

    alg: No test for rfc3686(ctr(aria)) (...)

As a result, no known-answer test covers the RFC3686 nonce/IV/counter
block layout combined with ARIA. Could test vectors be added for it?

> +
> +	.uinfo = {
> +		.encr = {
> +			.geniv = "seqiv",
> +			.blockbits = 128,
> +			.defkeybits = 160, /* 128-bit key + 32-bit nonce */
> +		}
> +	},
> +
> +	.pfkey_supported = 0,
> +},

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127020448.55891-1-his1415%40pribit.com

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

* Re: [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support
  2026-11-27  2:04 ` [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support Hong In-su
@ 2026-11-28  2:33   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-11-28  2:33 UTC (permalink / raw)
  To: his1415
  Cc: steffen.klassert, herbert, davem, edumazet, kuba, pabeni, horms,
	sd, netdev, ipsec, linux-kernel

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 1 · High: 0 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Critical] This patch adds rfc4106(gcm(aria)) AEAD descriptors to
  aead_list in net/xfrm/xfrm_algo.c (lines 85-120).

--

xfrm: add ARIA GCM support

This commit adds XFRM AEAD algorithm descriptors for rfc4106(gcm(aria))
with 64-bit, 96-bit and 128-bit ICV lengths. The kernel crypto API
already supports the algorithm.

> diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
> index 98ef2c48982a2..d74f86d4e6722 100644
> --- a/net/xfrm/xfrm_algo.c
> +++ b/net/xfrm/xfrm_algo.c
> @@ -82,6 +82,42 @@ static struct xfrm_algo_desc aead_list[] = {
>  		.sadb_alg_maxbits = 256
>  	}
>  },
> +{
> +	.name = "rfc4106(gcm(aria))",
> +
> +	.uinfo = {
> +		.aead = {
> +			.geniv = "seqiv",
> +			.icv_truncbits = 64,
> +		}
> +	},
> +
> +	.pfkey_supported = 0,
> +},

[Severity: Critical]
Can an ARIA-GCM SA end up offloaded to Netronome hardware with a NULL
cipher?

These descriptors have no .desc, so desc.sadb_alg_id is 0. attach_aead()
in net/xfrm/xfrm_user.c copies it straight into the state:

	x->props.ealgo = algo->desc.sadb_alg_id;

That leaves x->props.ealgo == SADB_EALG_NONE.

nfp_net_xfrm_add_state() in drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
assumes chacha20-poly1305 is the only AEAD with that id:

	case SADB_EALG_NONE:
		/* The xfrm descriptor for CHACAH20_POLY1305 does not set the algorithm id, which
		 * is the default value SADB_EALG_NONE. In the branch of SADB_EALG_NONE, driver
		 * uses algorithm name to identify CHACAH20_POLY1305's algorithm.
		 */
		if (x->aead && !strcmp(x->aead->alg_name, "rfc7539esp(chacha20,poly1305)")) {
			...
			break;
		}
		fallthrough;
	case SADB_EALG_NULL:
		cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC;
		cfg->ctrl_word.cipher = NFP_IPSEC_CIPHER_NULL;
		break;

"rfc4106(gcm(aria))" fails the strcmp, so the code falls through and
programs NFP_IPSEC_CIPHER_NULL.

The auth switch earlier in the same function doesn't reject it either.
With aalgo == SADB_AALG_NONE and x->aead set, it only does:

	case SADB_AALG_NONE:
		if (x->aead) {
			trunc_len = -1;

ctrl_word.hash stays at NFP_IPSEC_HASH_NONE. The x->aead block after that
just copies the ARIA key and salt into the config.

net/xfrm/xfrm_device.c doesn't check aead or ealgo before calling the
driver, and NFP registers no xdo_dev_offload_ok callback. So the call
chain attach_aead() -> xfrm_dev_state_add() -> nfp_net_xfrm_add_state()
returns success.

Userspace (for example strongSwan with hw_offload=auto) then reports an
ARIA-GCM SA, while the NIC applies no encryption and no ICV. Offloaded
outbound ESP payloads would go out in plaintext, and inbound SAs would
get no integrity check.

The companion commit "xfrm: add ARIA CBC and CTR support" appears to have
the same issue. cbc(aria) and rfc3686(ctr(aria)) are added to ealg_list
without a sadb id. Since x->aead is NULL for them, they would always fall
through to NFP_IPSEC_CIPHER_NULL, while any configured HMAC still applies.

Could the NFP driver return -EINVAL for any SADB_EALG_NONE algorithm it
doesn't recognize by name, instead of falling through to the NULL cipher,
before these descriptors are added? Another option is to give the new
algorithms an id that offload drivers can't mistake for NONE or NULL.

> +{
> +	.name = "rfc4106(gcm(aria))",

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127020448.55891-1-his1415%40pribit.com

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

end of thread, other threads:[~2026-11-28  2:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  2:04 [PATCH ipsec-next v3 0/2] xfrm: add ARIA algorithm support Hong In-su
2026-11-27  2:04 ` [PATCH ipsec-next v3 1/2] xfrm: add ARIA CBC and CTR support Hong In-su
2026-11-28  2:33   ` netdev-bot+sashiko
2026-11-27  2:04 ` [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support Hong In-su
2026-11-28  2:33   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox