Re: [PATCH ipsec-next v3 2/2] xfrm: add ARIA GCM support

From: netdev-bot+sashiko

Date: Fri Nov 27 2026 - 21:33:23 EST


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