[GH-ISSUE #263] Build failure on kernels < 5.5: missing/incompatible ChaCha API #147

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

Originally created by @saqie1393 on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/263

Build failure on kernels < 5.5: missing/incompatible ChaCha API

AWG 3.0 currently fails to build on older Linux kernels because the code assumes the following ChaCha library API:

struct chacha_state
chacha_init(...)
chacha20_crypt(...)
CHACHA_KEY_SIZE
CHACHA_KEY_WORDS

However, on kernels before 5.5, <crypto/chacha.h> is either unavailable or exposes a different/skcipher-oriented API such as:

struct chacha_ctx
crypto_chacha_init(...)

For example, on Linux 3.19:

fatal error: crypto/chacha.h: No such file or directory

The following AWG files depend on the missing API:

receive.c
socket.c
send.c
header_protection.c
header_protection.h

Examples:

struct chacha_state state;
chacha_init(state, ...);
chacha20_crypt(&state, ...);

and:

#include <crypto/chacha.h>

in header_protection.h and header_protection.c.

I also verified that the Linux 3.19 kernel headers do not provide:

CHACHA_KEY_SIZE
chacha20_crypt
chacha_init

Expected behavior

AWG 3.0 should either:

  1. provide a compatibility implementation for older kernels that exposes the required ChaCha library API, or
  2. use the appropriate old-kernel ChaCha API through a compatibility layer.

The compatibility layer would need to provide equivalents for:

struct chacha_state
chacha_init()
chacha20_crypt()
CHACHA_KEY_SIZE
CHACHA_KEY_WORDS

Environment

  • AWG: 3.0
  • Target kernel: Linux 3.10.100+ ARMv7

The current compat.h contains many old-kernel compatibility definitions, but there does not appear to be a compatibility implementation for the ChaCha library API required by the AWG 3.0 header-protection code.

Could you please advise whether a compatibility patch for ChaCha on kernels <5.5 is planned or provide the recommended implementation?

Originally created by @saqie1393 on GitHub (Oct 5, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/263 ### Build failure on kernels < 5.5: missing/incompatible ChaCha API AWG 3.0 currently fails to build on older Linux kernels because the code assumes the following ChaCha library API: ```c struct chacha_state chacha_init(...) chacha20_crypt(...) CHACHA_KEY_SIZE CHACHA_KEY_WORDS ``` However, on kernels before 5.5, `<crypto/chacha.h>` is either unavailable or exposes a different/skcipher-oriented API such as: ```c struct chacha_ctx crypto_chacha_init(...) ``` For example, on Linux 3.19: ```text fatal error: crypto/chacha.h: No such file or directory ``` The following AWG files depend on the missing API: ```text receive.c socket.c send.c header_protection.c header_protection.h ``` Examples: ```c struct chacha_state state; chacha_init(state, ...); chacha20_crypt(&state, ...); ``` and: ```c #include <crypto/chacha.h> ``` in `header_protection.h` and `header_protection.c`. I also verified that the Linux 3.19 kernel headers do not provide: ```text CHACHA_KEY_SIZE chacha20_crypt chacha_init ``` ### Expected behavior AWG 3.0 should either: 1. provide a compatibility implementation for older kernels that exposes the required ChaCha library API, or 2. use the appropriate old-kernel ChaCha API through a compatibility layer. The compatibility layer would need to provide equivalents for: ```c struct chacha_state chacha_init() chacha20_crypt() CHACHA_KEY_SIZE CHACHA_KEY_WORDS ``` ### Environment - AWG: 3.0 - Target kernel: Linux 3.10.100+ ARMv7 The current `compat.h` contains many old-kernel compatibility definitions, but there does not appear to be a compatibility implementation for the ChaCha library API required by the AWG 3.0 header-protection code. Could you please advise whether a compatibility patch for ChaCha on kernels <5.5 is planned or provide the recommended implementation?
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#147
No description provided.