[PR #244] compat: support header protection on kernels before 5.5 #257

Open
opened 2026-10-13 21:08:03 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/244
Author: @HeisLuka
Created: 9/14/2026
Status: 🔄 Open

Base: master ← Head: fix/compat-header-protection-chacha


📝 Commits (1)

  • 5a8acb6 compat: provide ChaCha API for old kernels

📊 Changes

2 files changed (+51 additions, -0 deletions)

View changed files

📝 src/compat/Kbuild.include (+4 -0)
➕ src/compat/crypto/chacha/include/crypto/chacha.h (+47 -0)

📄 Description

Summary

Provide the ChaCha library API required by AWG 3.x header protection on kernels older than 5.5.

The existing compatibility layer already adapts the Linux 5.5–6.15 u32 *state
ChaCha API to the newer struct chacha_state interface. On older kernels,
however, <crypto/chacha.h> either does not exist or exposes the older
skcipher-oriented API, so that compatibility layer cannot build.

For kernels before 5.5 this change shadows <crypto/chacha.h> with a small
compatibility header backed by the module's existing bundled Zinc ChaCha20
implementation. It exposes the chacha_init(u32 *state, ...) and
chacha20_crypt(u32 *state, ...) API expected by the existing compatibility
code.

The state layout is kept identical to the 16-word ChaCha state used by the
kernel library API, including the counter words, so the existing
header-protection receive path can rewind state.x[12] exactly as before.

Scope

  • Only kernels older than 5.5 select the new compatibility header.
  • Kernels 5.5 and newer keep using their existing/native path unchanged.
  • No packet-format or protocol behavior changes are intended.
  • The fallback reuses the module's already-built Zinc ChaCha20 implementation.

Fixes #210


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/244 **Author:** [@HeisLuka](https://github.com/HeisLuka) **Created:** 9/14/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/compat-header-protection-chacha` --- ### 📝 Commits (1) - [`5a8acb6`](https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/commit/5a8acb65f1b65a7f1addda916f5e45668ad15dca) compat: provide ChaCha API for old kernels ### 📊 Changes **2 files changed** (+51 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/compat/Kbuild.include` (+4 -0) ➕ `src/compat/crypto/chacha/include/crypto/chacha.h` (+47 -0) </details> ### 📄 Description ## Summary Provide the ChaCha library API required by AWG 3.x header protection on kernels older than 5.5. The existing compatibility layer already adapts the Linux 5.5–6.15 `u32 *state` ChaCha API to the newer `struct chacha_state` interface. On older kernels, however, `<crypto/chacha.h>` either does not exist or exposes the older skcipher-oriented API, so that compatibility layer cannot build. For kernels before 5.5 this change shadows `<crypto/chacha.h>` with a small compatibility header backed by the module's existing bundled Zinc ChaCha20 implementation. It exposes the `chacha_init(u32 *state, ...)` and `chacha20_crypt(u32 *state, ...)` API expected by the existing compatibility code. The state layout is kept identical to the 16-word ChaCha state used by the kernel library API, including the counter words, so the existing header-protection receive path can rewind `state.x[12]` exactly as before. ## Scope - Only kernels older than 5.5 select the new compatibility header. - Kernels 5.5 and newer keep using their existing/native path unchanged. - No packet-format or protocol behavior changes are intended. - The fallback reuses the module's already-built Zinc ChaCha20 implementation. Fixes #210 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-linux-kernel-module#257
No description provided.