Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: his1415@pribit.com
Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, sd@queasysnail.net,
	netdev@vger.kernel.org, ipsec@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support
Date: Sat, 28 Nov 2026 02:33:10 +0000	[thread overview]
Message-ID: <179583319029.3135.1719122173893517950@kernel.org> (raw)
In-Reply-To: <20261127020448.55891-3-his1415@pribit.com>

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

      reply	other threads:[~2026-11-28  2:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=179583319029.3135.1719122173893517950@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=his1415@pribit.com \
    --cc=horms@kernel.org \
    --cc=ipsec@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=steffen.klassert@secunet.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