From: netdev-bot+sashiko@kernel.org
To: his1415@pribit.com
Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] xfrm: add ARIA CBC and CTR support
Date: Thu, 10 Sep 2026 06:44:57 +0000 [thread overview]
Message-ID: <178902269711.219967.15840470225546817223@kernel.org> (raw)
In-Reply-To: <20260909054530.7861-1-his1415@pribit.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 1 · Low: 1
- [Medium] Duplicated `.compat = "aria"` alias in `ealg_list[]` makes the
new `rfc3686(ctr(aria))` descriptor's legacy alias permanently…
- [Low] Inconsistent default key sizes (`defkeybits`) between CBC and CTR
modes for ARIA.
--
xfrm: add ARIA CBC and CTR support
This adds two XFRM encryption algorithm descriptors so ARIA can be
selected for ESP, one for cbc(aria) and one for rfc3686(ctr(aria)).
Both are marked pfkey_supported = 0, so they are reachable only through
the XFRM netlink interface.
> diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
> index 70434495f23f..16c70dc1a426 100644
> --- a/net/xfrm/xfrm_algo.c
> +++ b/net/xfrm/xfrm_algo.c
> @@ -512,6 +512,34 @@ static struct xfrm_algo_desc ealg_list[] = {
> .sadb_alg_maxbits = 256
> }
> },
> +{
> + .name = "cbc(aria)",
> + .compat = "aria",
> +
> + .uinfo = {
> + .encr = {
> + .geniv = "echainiv",
> + .blockbits = 128,
> + .defkeybits = 256,
> + }
> + },
> +
> + .pfkey_supported = 0,
> +},
> +{
> + .name = "rfc3686(ctr(aria))",
> + .compat = "aria",
[Severity: Low]
The two new entries advertise different ARIA key strengths: the
cbc(aria) entry sets .defkeybits = 256, while the rfc3686(ctr(aria))
entry sets 160, which - going by the "/* 128-bit key + 32-bit nonce */"
comment on the rfc3686(ctr(aes)) entry a few lines further down - means
a 128-bit ARIA key plus a 32-bit nonce. So the default for the CBC
variant is ARIA-256 and for the CTR variant ARIA-128. Was that
deliberate?
For comparison, every other cbc(...) entry in ealg_list[] (cbc(aes),
cbc(camellia), cbc(serpent), cbc(twofish), cbc(sm4)) uses 128, and the
AES CTR counterpart uses 128 + 32. If ARIA-256 is the intended default
here, should the CTR entry be 288 (256-bit key + 32-bit nonce) to keep
the two consistent? If not, should the CBC entry be 128 like its
siblings?
As far as I can tell nothing breaks either way: attach_crypt() derives
the key length from ualg->alg_key_len rather than from uinfo.encr, and
with .pfkey_supported = 0 there is no sadb_alg_minbits/maxbits pair to
disagree with, so defkeybits is effectively documentation for these two
entries. But since it is documentation, having two entries for the same
cipher in the same table imply different default key sizes is confusing
to read. Please also add the "128-bit key + 32-bit nonce" style comment
on the 160 if that is indeed what the value encodes.
^^^^^^^^^^^^^^^^^^
[Severity: Medium]
Should the CTR entry carry a .compat alias at all, given that the
cbc(aria) entry added just above already claims "aria"?
xfrm_alg_name_match() accepts either the name or the compat string, with
no distinction between modes:
net/xfrm/xfrm_algo.c:xfrm_alg_name_match() {
return name && (!strcmp(name, entry->name) ||
(entry->compat && !strcmp(name, entry->compat)));
}
and xfrm_find_algo() only ever acts on the first matching entry:
net/xfrm/xfrm_algo.c:xfrm_find_algo() {
for (i = 0; i < algo_list->entries; i++) {
if (!match(list + i, data))
continue;
if (list[i].available)
return &list[i];
if (!probe)
break;
status = algo_list->find(list[i].name, 0, 0);
if (!status)
break;
...
}
Since cbc(aria) comes first in ealg_list[], does a lookup of "aria"
ever reach the rfc3686(ctr(aria)) entry? It looks like the .compat
field on the CTR entry can never be used, so the CTR variant is only
selectable by its full name via
attach_crypt()->xfrm_ealg_get_byname(ualg->alg_name, 1).
There also seems to be a second effect in a build where ARIA and CTR are
enabled but CBC is not (CRYPTO_ARIA=y, CRYPTO_CTR=y, CRYPTO_CBC=n). The
probe of cbc(aria) fails, xfrm_find_algo() hits the break and returns
NULL, and attach_crypt() reports:
net/xfrm/xfrm_user.c:attach_crypt() {
algo = xfrm_ealg_get_byname(ualg->alg_name, 1);
if (!algo) {
NL_SET_ERR_MSG(extack, "Requested CRYPT algorithm not found");
return -ENOSYS;
}
...
}
so "enc aria" would fail with -ENOSYS even though a later entry
advertising the same alias is instantiable. Is that intended?
For comparison, the existing rfc3686(ctr(aes)) entry in the same table
sets no .compat because "aes" is owned by cbc(aes), and the other
pfkey_supported = 0 entries here (cmac(aes), rfc7539esp(...)) omit
.compat as well. Would dropping .compat from the rfc3686(ctr(aria))
entry match that convention?
> +
> + .uinfo = {
> + .encr = {
> + .geniv = "seqiv",
> + .blockbits = 128,
> + .defkeybits = 160,
> + }
> + },
> +
> + .pfkey_supported = 0,
> +},
> {
> .name = "cbc(twofish)",
> .compat = "twofish",
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260909054530.7861-1-his1415%40pribit.com
prev parent reply other threads:[~2026-09-10 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 5:45 Hong In-su
2026-09-10 6:44 ` 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=178902269711.219967.15840470225546817223@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=his1415@pribit.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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
all inboxes | Powered by JetHome®