Article View: linux.kernel.netdev
Article #12769[PATCH ipsec v2 0/7] xfrm: fix ESP IV generation and ESN authentication
From: Jérémy Jean
Date: Sun, 08 Nov 2026 14:26
Date: Sun, 08 Nov 2026 14:26
62 lines
12249 bytes
12249 bytes
Hello,
This series fixes nonce reuse in AES-GCM and ESN authentication errors
in the IPv4 and IPv6 ESP offload paths:
* 1/7 and 2/7: Save the current sequence number before incrementing it,
so that GCM IV construction prevents nonce reuse,
* 3/7: Use the current sequence for software AAD and hardware offload,
* 4/7: Give each early GSO segment a private secpath,
* 5/7: Use the packet sequence directly for mlx5 IV generation,
* 6/7: Segment untrusted GSO packets before allocating sequence numbers,
* 7/7: Keep the sequence counter unchanged after full ESN overflow.
Note that triggering the bug fixed by 7/7 is impractical: it requires
processing about 2^64 packets under a single key. Yet, I still believe
it's cleaner to fix it.
On the crypto side, as a reminder, reusing a nonce under the same GCM
key is catastrophic for security: it exposes the XOR of the plaintexts
and can reveal GCM authentication key, which opens the possibilty for
an adversary to forge ciphertexts without recovering the AES key.
This series combines and extends these two individual reports:
* https://lore.kernel.org/all/20260925095105.446269-2-Jeremy.Jean@oss.cyber.gouv.fr/
* https://lore.kernel.org/all/20260925095128.446450-2-Jeremy.Jean@oss.cyber.gouv.fr/
Recent discussion with Sabrina Dubroca may also be of interest:
https://lore.kernel.org/all/c443bad568f4e03d05b848b1b245707d@oss.cyber.gouv.fr/T/#u
Regards,
Jérémy
---
Changes in v2:
- Rebase onto ipsec/master.
- Clarify Patch 4's description and comment.
- Remove the duplicate mlx5 IV helper and callback in Patch 5.
Jérémy Jean (7):
xfrm: esp6: use the current sequence number for the IV
xfrm: esp4: use the current sequence number for the IV
xfrm: esp: use the current sequence number for AAD and offload
xfrm: prevent AES-GCM nonce reuse after early GSO
net/mlx5e: Use the packet sequence number for the IPsec IV
xfrm: segment untrusted GSO packets before sequence allocation
xfrm: leave the sequence counter unchanged on ESN overflow
.../mellanox/mlx5/core/en_accel/ipsec.c | 18 -----------
.../mellanox/mlx5/core/en_accel/ipsec.h | 2 --
.../mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 31 +++----------------
.../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 4 ---
net/ipv4/esp4.c | 13 +++-----
net/ipv4/esp4_offload.c | 7 +++--
net/ipv6/esp6.c | 13 +++-----
net/ipv6/esp6_offload.c | 7 +++--
net/xfrm/xfrm_output.c | 16 ++++++++--
net/xfrm/xfrm_replay.c | 1 -
10 files changed, 36 insertions(+), 76 deletions(-)
--
2.47.3
Technical Details
Message-ID:
<20261108142652.1330952-1-Jeremy.Jean@oss.cyber.gouv.fr>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358766-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358766-linux-kernel-netdev=dewy.ru From: Jeremy.Jean@oss.cyber.gouv.fr (Jérémy Jean) Newsgroups: linux.kernel.netdev Subject: [PATCH ipsec v2 0/7] xfrm: fix ESP IV generation and ESN authentication Date: Sun, 8 Nov 2026 14:26:45 +0000 Organization: Usenet Network Message-ID: <20261108142652.1330952-1-Jeremy.Jean@oss.cyber.gouv.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="140923"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8nlRJuK/N4t+qmLAYvF5MjlV4gw= sha256:W/Q3FE/gLEZUsegirOXkc8hfvHKNHsmtc/Cpxk+3f9s= sha1:zx/yKSzIGrWKKZmsID5iAk3ZnDM= sha256:1RdzYA9+Z5czYPFiNcJ4Mv7zGcg5WEUOU3mH2Xmx/K8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Source X-Source-Args X-Source-Dir X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id BE7991135A2; Sun, 8 Nov 2026 17:29:38 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.052 X-Spam-Status: No, score=-3.052 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fj8faw2AKavV; Sun, 8 Nov 2026 17:29:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-358766-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=oss.cyber.gouv.fr X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 4BA1C113591; Sun, 8 Nov 2026 17:29:25 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id AE5C5250C3; Sun, 8 Nov 2026 14:27:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794148021; b=VETWzlICOivtRKL9nbatQFjLboI7C8t4qhOyGpSBOtNptiThPKZ/0z36W5wx4WivnDsn r0xeYdTnW7NDIprRDVcVfaCs9nN9lmT2uLChsxbXRLdnXE2Qrj2ihNRsyyGBlXhuBdWTC V8EEjgKnlSKjIYRyrgyS5e2mLaeIsr3HZiePde/2mSIITNt+Ykc7hXBqAsGLEJhJmJJx5 ZfOp5jHiA9MT9UkUUnoyvdQB1OL0bLOqoqFMpyHBnObAwK2Bcx12Fg3zSz7KKbtrp/tAR xP5lax/2hSrSymEZVs3GTsLqbLTLhKm1HMgK9TjkbD/w1DJy9ZZbpCmxRVITZhr0O9g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794148021; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Transfer-Encoding:X-AntiAbuse: X-AntiAbuse:X-AntiAbuse:X-AntiAbuse:X-AntiAbuse: X-Get-Message-Sender-Via:X-Authenticated-Sender:X-Source: X-Source-Args:X-Source-Dir; bh=HFFMCIabuDJl1dk8Y6onVW1hr4NVtO/ZAth8uZTKrro=; b=eig0+0/OuGplxQyMr81wF/+w6rHy9gbKh9roqdiLRIrr9rcLms0UrZ4ID+SxQSkf+Jyo nuSRJw/ZFHSAcdcTmnwB+lpzPhHQyTn+ifLDsK4c/EZ0jJLWkEPZgk3tLG3WxLMaBgrzf 00vxoIPNhRefxOeg9VUSr5fA9E8329jFB01A0wez8vyrI66b6QVWvIbJ9LaG2w8+uk+Ch 20IinX0/FxO+nBdb5gCj5NGbVQFifbDZupGWhzJTICOqYvLMqnfsQD6+oL/8CS0Dj+UXC sqV69Fpb61+n0DZwZEkYUDk9/oJLAIeFJBuPH4G8wcYNm3jQ1Bpb68buQmki27lni1g== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.a=rsa-sha256 header.s=default header.b=euB1lDC4; dmarc=pass header.from=oss.cyber.gouv.fr; spf=pass smtp.mailfrom=oss.cyber.gouv.fr; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82714606D817; Sun, 8 Nov 2026 14:27:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.a=rsa-sha256 header.s=default header.b=euB1lDC4 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=51.159.188.251 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794148020; b=EGA0hCk0EySh0LxlVjgbw8QlU6TBDzufd1q3yFFHk3W+jp+ob1maSgxuFw3QkcYLLm// l4u16g9lSQ9MQsuirQSLs1cXwOoKq1MF9KJ1+aGHDzweHasIR1tTBw2fKlYkdFSfbzbhB oBcWno7dDOG5ys6zGhcXfPCuu0gdf2y/PD5n7NT4MoRa4vBJb+62laO2Zw36tmEpCoRb9 6Kl1p8QTKLpcOIK+1g6Vvj3nQ5VVZ8NCnAmGbeN71hkPgQz81Vx64fL0pwKIpoUStABBb prebzjJjYhQfwPAEKqTQA1CH2g/nAj+iIOFmQ0jkG8KxXdNzky786QjwofUMNXNxxrg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794148020; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding:X-AntiAbuse:X-AntiAbuse:X-AntiAbuse: X-AntiAbuse:X-AntiAbuse:X-Get-Message-Sender-Via: X-Authenticated-Sender:X-Source:X-Source-Args:X-Source-Dir; bh=HFFMCIabuDJl1dk8Y6onVW1hr4NVtO/ZAth8uZTKrro=; b=BV+7Xni0IvgcWLCgT/kMcucZqmhvtOB4U+mctQr2cCoxug+CruPWKEY3PAwiVCDB0dbQ bkPMyAWlI6ijkbXoFEddq9BO0fvScMQY8j7XGpmN8x77zijR4oCgItKRSrGL+15isyUNY OgSKg6dvoTs1igeKNCroEBhLproy3w9VcLMt9ItYdgR+vuyIuoyW8m9fz41Z5chOTcu0i XJx4s+6WIWyJfBDGWxrV5VopdZ6jc/DgWCWzY7vBEuZjpY93P4GpI/M6xLlTFqAyIkFDy YODw44NwBIuU/AGFNHiLESAXLuZetcN/K7yFo0aW1MyR4PapoSAf6xmqL4rIsuYhEFA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.cyber.gouv.fr; spf=pass smtp.mailfrom=oss.cyber.gouv.fr; dkim=pass header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.a=rsa-sha256 header.s=default header.b=euB1lDC4; arc=none smtp.remote-ip=51.159.188.251 X-Received: from oss.cyber.gouv.fr (oss.cyber.gouv.fr [51.159.188.251]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21C8E606A31C; Sun, 8 Nov 2026 14:26:58 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 21C8E606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.cyber.gouv.fr X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.cyber.gouv.fr X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=oss.cyber.gouv.fr; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Sender:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=HFFMCIabuDJl1dk8Y6onVW1hr4NVtO/ZAth8uZTKrro=; b=euB1lDC40g1yzMKrSGjk35dwQ0 VKyG0Aiszyex5H/P+P3iHUmxpchzph01kDndlrCxLAzgnaS+0VIGs6zxRCymeCaE3/9MuotjplSuT fB8ntYhOOAgVW/zZKr5eGemFqPu+bAgiLOPkyiCbOBwX3AfxoQsakw10v9BgGrGJAsi2fQPQDyvuE xLUMkUHZK0akgl6FmAaaD3ZK7hnceBjEWlh4LyZBMB+xa0RGBxRKfn24FACy5hIXhdAxW3IoMWk+w YJXoWKQyyKGuD+qPPBqJG5CjnX7oGOkp8XUCmwhCL1Qck5gbX9oRRnfuRsA4Q90Id6rV6tro+chvL X7VDpU5w==; X-Received: from [151.115.150.205] (port=49652 helo=gepetto..) by pf-012.whm.fr-par.scw.cloud with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from <Jeremy.Jean@oss.cyber.gouv.fr>) id 1xQ3rF-00000008IcJ-06wZ; Sun, 08 Nov 2026 15:26:57 +0100 X-Cc: "David S. Miller" <davem@davemloft.net>, Boris Pismenny <borisp@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leonro@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr> X-Mailer: git-send-email 2.47.3 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - pf-012.whm.fr-par.scw.cloud X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - oss.cyber.gouv.fr X-Get-Message-Sender-Via: pf-012.whm.fr-par.scw.cloud: authenticated_id: jeremy.jean@oss.cyber.gouv.fr X-Authenticated-Sender: pf-012.whm.fr-par.scw.cloud: jeremy.jean@oss.cyber.gouv.fr