[PATCH ipsec-next v4 1/4] nfp: reject unsupported IPsec encryption algorithms

From: Hong In-su

Date: Mon Nov 30 2026 - 01:29:35 EST


The NFP IPsec offload driver uses SADB_EALG_NONE to identify
ChaCha20-Poly1305 by its algorithm name. Other algorithms without
a SADB algorithm ID fall through to the NULL cipher case.

Reject unrecognized encryption algorithms when an AEAD or encryption
algorithm is present, while preserving the existing handling of AH
and ChaCha20-Poly1305.

Return -EOPNOTSUPP to allow fallback to software crypto.

Compile-tested only.

Signed-off-by: Hong In-su <his1415@xxxxxxxxxx>
---
drivers/net/ethernet/netronome/nfp/crypto/ipsec.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c b/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
index 960d7513aa8d..5d861e5c4665 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;
+ }
fallthrough;
case SADB_EALG_NULL:
cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC;
--
2.43.0