mirror of https://lore.kernel.org/lkml/
 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,
	andrew+netdev@lunn.ch, csh0052@gmail.com,
	oss-drivers@corigine.com, linux-crypto@vger.kernel.org,
	netdev@vger.kernel.org, ipsec@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH ipsec-next v4 1/4] nfp: reject unsupported IPsec encryption algorithms
Date: Tue, 01 Dec 2026 06:30:20 +0000	[thread overview]
Message-ID: <179610662054.3146.46804203861944222@kernel.org> (raw)
In-Reply-To: <20261130062722.7504-2-his1415@pribit.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The patch makes nfp_net_xfrm_add_state()
  (drivers/net/ethernet/netronome/nfp/crypto/ipsec.c) handle…

--

nfp: reject unsupported IPsec encryption algorithms

This patch makes nfp_net_xfrm_add_state() reject an SA whose
props.ealgo is SADB_EALG_NONE when an aead or ealg other than
ChaCha20-Poly1305 is attached. Before, such an SA fell through to the
NULL cipher case. The new branch returns -EOPNOTSUPP so the xfrm core
can fall back to software crypto.

> diff --git a/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c b/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
> index 960d7513aa8dd..5d861e5c46659 100644
> --- a/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
> +++ b/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
> @@ -405,6 +405,11 @@ static int nfp_net_xfrm_add_state(struct net_device *dev,
>  			cfg->ctrl_word.cipher = NFP_IPSEC_CIPHER_CHACHA20;
>  			break;
>  		}
> +		if (x->aead || x->ealg) {
> +			NL_SET_ERR_MSG_MOD(extack,
> +					   "Unsupported encryption algorithm for offload");
> +			return -EOPNOTSUPP;
> +		}

[Severity: Low]
Should the other sites in nfp_net_xfrm_add_state() that set this same
extack message also return -EOPNOTSUPP?

Three older sites in the function use the same message but return
-EINVAL. The first is ChaCha20-Poly1305 on a device that is not
NFP3800:

    if (nn->pdev->device != PCI_DEVICE_ID_NFP3800) {
        NL_SET_ERR_MSG_MOD(extack,
                           "Unsupported encryption algorithm for offload");
        return -EINVAL;
    }

The second is 3DES on NFP3800, under case SADB_EALG_3DESCBC:

    if (nn->pdev->device == PCI_DEVICE_ID_NFP3800) {
        NL_SET_ERR_MSG_MOD(extack, "Unsupported encryption algorithm for offload");
        return -EINVAL;
    }

The third is the switch default:

    default:
        NL_SET_ERR_MSG_MOD(extack, "Unsupported encryption algorithm for offload");
        return -EINVAL;

For crypto offload, xfrm_dev_state_add() in net/xfrm/xfrm_device.c
treats these two errnos differently:

    if ((err != -EOPNOTSUPP && !is_packet_offload) || is_packet_offload) {
        NL_SET_ERR_MSG_WEAK(extack, "Device failed to offload this state");
        return err;
    }

On -EOPNOTSUPP the core clears the offload state and the SA is
installed with software crypto. Any other errno fails the whole
XFRM_MSG_NEWSA. nfp rejects every offload type except
XFRM_DEV_OFFLOAD_CRYPTO, so this split always applies.

As a result, algorithms with no SADB ID (such as the ARIA modes, once
the rest of the series lands) now fall back to software. Other
unsupported algorithms that do have a SADB ID still fail the SA add with
the same message. Examples are rfc4309(ccm(aes)), rfc3686(ctr(aes)),
cbc(camellia), cbc(serpent), cbc(twofish) and cbc(sm4).

Before this patch, all of these sites returned -EINVAL. The commit
message says "Return -EOPNOTSUPP to allow fallback to software crypto",
so should the peer sites be changed to -EOPNOTSUPP as well? The other
option is for the new site to match them.

>  		fallthrough;
>  	case SADB_EALG_NULL:
>  		cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC;

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

  reply	other threads:[~2026-12-01  6:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  6:27 [PATCH ipsec-next v4 0/4] xfrm: add ARIA CBC, CTR and GCM support Hong In-su
2026-11-30  6:27 ` [PATCH ipsec-next v4 1/4] nfp: reject unsupported IPsec encryption algorithms Hong In-su
2026-12-01  6:30   ` netdev-bot+sashiko [this message]
2026-11-30  6:27 ` [PATCH ipsec-next v4 2/4] crypto: testmgr - add ARIA RFC3686 and RFC4106 test vectors Hong In-su
2026-11-30  6:27 ` [PATCH ipsec-next v4 3/4] xfrm: add ARIA CBC and CTR support Hong In-su
2026-11-30  6:27 ` [PATCH ipsec-next v4 4/4] xfrm: add ARIA GCM support Hong In-su
2026-12-01  6:30   ` netdev-bot+sashiko
2026-11-30  7:46 ` [PATCH ipsec-next v4 0/4] xfrm: add ARIA CBC, CTR and " Antony Antony
2026-11-30  8:18   ` Hong In-su
2026-12-01  6:57 ` Eric Biggers
2026-12-01  9:09   ` Hong In-su

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=179610662054.3146.46804203861944222@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=csh0052@gmail.com \
    --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-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --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

all inboxes | Powered by JetHome®