[GH-ISSUE #138] FTBFS on Linux 6.19 #86

Open
opened 2026-10-13 21:06:23 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @K900 on GitHub (Feb 9, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/138

cookie.c: In function 'precompute_key':
cookie.c:36:30: error: storage size of 'blake' isn't known
   36 |         struct blake2s_state blake;
      |                              ^~~~~
cookie.c:36:30: warning: unused variable 'blake' [-Wunused-variable]
cookie.c: In function 'compute_mac1':
cookie.c:80:23: error: passing argument 2 of 'blake2s' makes integer from pointer without a cast [-Wint-conversion]
   80 |         blake2s(mac1, message, key, COOKIE_LEN, len, NOISE_SYMMETRIC_KEY_LEN);
      |                       ^~~~~~~
      |                       |
      |                       const void *
In file included from messages.h:11,
                 from cookie.h:9,
                 from cookie.c:6:
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c>
  145 | static inline void blake2s(const u8 *key, size_t keylen,
      |                                           ~~~~~~~^~~~~~
cookie.c:80:49: error: passing argument 5 of 'blake2s' makes pointer from integer without a cast [-Wint-conversion]
   80 |         blake2s(mac1, message, key, COOKIE_LEN, len, NOISE_SYMMETRIC_KEY_LEN);
      |                                                 ^~~
      |                                                 |
      |                                                 size_t {aka long unsigned int}
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c>
  147 |                            u8 *out, size_t outlen)
      |                            ~~~~^~~
cookie.c: In function 'compute_mac2':
cookie.c:88:23: error: passing argument 2 of 'blake2s' makes integer from pointer without a cast [-Wint-conversion]
   88 |         blake2s(mac2, message, cookie, COOKIE_LEN, len, COOKIE_LEN);
      |                       ^~~~~~~
      |                       |
      |                       const void *
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c>
  145 | static inline void blake2s(const u8 *key, size_t keylen,
      |                                           ~~~~~~~^~~~~~
cookie.c:88:52: error: passing argument 5 of 'blake2s' makes pointer from integer without a cast [-Wint-conversion]
   88 |         blake2s(mac2, message, cookie, COOKIE_LEN, len, COOKIE_LEN);
      |                                                    ^~~
      |                                                    |
      |                                                    size_t {aka long unsigned int}
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c>
  147 |                            u8 *out, size_t outlen)
      |                            ~~~~^~~
cookie.c: In function 'make_cookie':
cookie.c:94:30: error: storage size of 'state' isn't known
   94 |         struct blake2s_state state;
      |                              ^~~~~
cookie.c:94:30: warning: unused variable 'state' [-Wunused-variable]
In file included from send.c:17:
././compat/simd/include/linux/simd.h: In function 'simd_put':
././compat/simd/include/linux/simd.h:37:17: error: too few arguments to function 'kernel_neon_end'; expected 1, have 0
   37 |                 kernel_neon_end();
      |                 ^~~~~~~~~~~~~~~
In file included from /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6>
                 from ././compat/simd/include/linux/simd.h:10:
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6>
   17 | void kernel_neon_end(struct user_fpsimd_state *);
      |      ^~~~~~~~~~~~~~~
././compat/simd/include/linux/simd.h: In function 'simd_use':
././compat/simd/include/linux/simd.h:63:9: error: too few arguments to function 'kernel_neon_begin'; expected 1, have 0
   63 |         kernel_neon_begin();
      |         ^~~~~~~~~~~~~~~~~
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6>
   16 | void kernel_neon_begin(struct user_fpsimd_state *);
      |      ^~~~~~~~~~~~~~~~~
In file included from receive.c:15:
././compat/simd/include/linux/simd.h: In function 'simd_put':
././compat/simd/include/linux/simd.h:37:17: error: too few arguments to function 'kernel_neon_end'; expected 1, have 0
   37 |                 kernel_neon_end();
      |                 ^~~~~~~~~~~~~~~
In file included from /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6>
                 from ././compat/simd/include/linux/simd.h:10:
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6>
   17 | void kernel_neon_end(struct user_fpsimd_state *);
      |      ^~~~~~~~~~~~~~~
././compat/simd/include/linux/simd.h: In function 'simd_use':
././compat/simd/include/linux/simd.h:63:9: error: too few arguments to function 'kernel_neon_begin'; expected 1, have 0
   63 |         kernel_neon_begin();
      |         ^~~~~~~~~~~~~~~~~
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6>
   16 | void kernel_neon_begin(struct user_fpsimd_state *);
      |      ^~~~~~~~~~~~~~~~~
make[3]: *** [/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/so>
make[3]: *** Waiting for unfinished jobs....
noise.c: In function 'wg_noise_init':
noise.c:39:30: error: storage size of 'blake' isn't known
   39 |         struct blake2s_state blake;
      |                              ^~~~~
noise.c:41:46: error: passing argument 2 of 'blake2s' makes integer from pointer without a cast [-Wint-conversion]
   41 |         blake2s(handshake_init_chaining_key, handshake_name, NULL,
      |                                              ^~~~~~~~~~~~~~
      |                                              |
      |                                              const u8 * {aka const unsigned char *}
In file included from messages.h:11,
                 from noise.h:8,
                 from noise.c:6:
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c>
  145 | static inline void blake2s(const u8 *key, size_t keylen,
      |                                           ~~~~~~~^~~~~~
noise.c:42:33: error: passing argument 5 of 'blake2s' makes pointer from integer without a cast [-Wint-conversion]
   42 |                 NOISE_HASH_LEN, sizeof(handshake_name), 0);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 long unsigned int
/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c>
  147 |                            u8 *out, size_t outlen)
      |                            ~~~~^~~
noise.c:39:30: warning: unused variable 'blake' [-Wunused-variable]
   39 |         struct blake2s_state blake;
      |                              ^~~~~
noise.c: In function 'hmac':
noise.c:310:30: error: storage size of 'state' isn't known
  310 |         struct blake2s_state state;
      |                              ^~~~~
noise.c:310:30: warning: unused variable 'state' [-Wunused-variable]
noise.c: In function 'mix_hash':
noise.c:437:30: error: storage size of 'blake' isn't known
  437 |         struct blake2s_state blake;
      |                              ^~~~~
noise.c:437:30: warning: unused variable 'blake' [-Wunused-variable]

Relevant upstream changes seem to be:

Originally created by @K900 on GitHub (Feb 9, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/138 ``` cookie.c: In function 'precompute_key': cookie.c:36:30: error: storage size of 'blake' isn't known 36 | struct blake2s_state blake; | ^~~~~ cookie.c:36:30: warning: unused variable 'blake' [-Wunused-variable] cookie.c: In function 'compute_mac1': cookie.c:80:23: error: passing argument 2 of 'blake2s' makes integer from pointer without a cast [-Wint-conversion] 80 | blake2s(mac1, message, key, COOKIE_LEN, len, NOISE_SYMMETRIC_KEY_LEN); | ^~~~~~~ | | | const void * In file included from messages.h:11, from cookie.h:9, from cookie.c:6: /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c> 145 | static inline void blake2s(const u8 *key, size_t keylen, | ~~~~~~~^~~~~~ cookie.c:80:49: error: passing argument 5 of 'blake2s' makes pointer from integer without a cast [-Wint-conversion] 80 | blake2s(mac1, message, key, COOKIE_LEN, len, NOISE_SYMMETRIC_KEY_LEN); | ^~~ | | | size_t {aka long unsigned int} /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c> 147 | u8 *out, size_t outlen) | ~~~~^~~ cookie.c: In function 'compute_mac2': cookie.c:88:23: error: passing argument 2 of 'blake2s' makes integer from pointer without a cast [-Wint-conversion] 88 | blake2s(mac2, message, cookie, COOKIE_LEN, len, COOKIE_LEN); | ^~~~~~~ | | | const void * /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c> 145 | static inline void blake2s(const u8 *key, size_t keylen, | ~~~~~~~^~~~~~ cookie.c:88:52: error: passing argument 5 of 'blake2s' makes pointer from integer without a cast [-Wint-conversion] 88 | blake2s(mac2, message, cookie, COOKIE_LEN, len, COOKIE_LEN); | ^~~ | | | size_t {aka long unsigned int} /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c> 147 | u8 *out, size_t outlen) | ~~~~^~~ cookie.c: In function 'make_cookie': cookie.c:94:30: error: storage size of 'state' isn't known 94 | struct blake2s_state state; | ^~~~~ cookie.c:94:30: warning: unused variable 'state' [-Wunused-variable] In file included from send.c:17: ././compat/simd/include/linux/simd.h: In function 'simd_put': ././compat/simd/include/linux/simd.h:37:17: error: too few arguments to function 'kernel_neon_end'; expected 1, have 0 37 | kernel_neon_end(); | ^~~~~~~~~~~~~~~ In file included from /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6> from ././compat/simd/include/linux/simd.h:10: /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6> 17 | void kernel_neon_end(struct user_fpsimd_state *); | ^~~~~~~~~~~~~~~ ././compat/simd/include/linux/simd.h: In function 'simd_use': ././compat/simd/include/linux/simd.h:63:9: error: too few arguments to function 'kernel_neon_begin'; expected 1, have 0 63 | kernel_neon_begin(); | ^~~~~~~~~~~~~~~~~ /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6> 16 | void kernel_neon_begin(struct user_fpsimd_state *); | ^~~~~~~~~~~~~~~~~ In file included from receive.c:15: ././compat/simd/include/linux/simd.h: In function 'simd_put': ././compat/simd/include/linux/simd.h:37:17: error: too few arguments to function 'kernel_neon_end'; expected 1, have 0 37 | kernel_neon_end(); | ^~~~~~~~~~~~~~~ In file included from /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6> from ././compat/simd/include/linux/simd.h:10: /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6> 17 | void kernel_neon_end(struct user_fpsimd_state *); | ^~~~~~~~~~~~~~~ ././compat/simd/include/linux/simd.h: In function 'simd_use': ././compat/simd/include/linux/simd.h:63:9: error: too few arguments to function 'kernel_neon_begin'; expected 1, have 0 63 | kernel_neon_begin(); | ^~~~~~~~~~~~~~~~~ /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/arch/arm6> 16 | void kernel_neon_begin(struct user_fpsimd_state *); | ^~~~~~~~~~~~~~~~~ make[3]: *** [/nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/so> make[3]: *** Waiting for unfinished jobs.... noise.c: In function 'wg_noise_init': noise.c:39:30: error: storage size of 'blake' isn't known 39 | struct blake2s_state blake; | ^~~~~ noise.c:41:46: error: passing argument 2 of 'blake2s' makes integer from pointer without a cast [-Wint-conversion] 41 | blake2s(handshake_init_chaining_key, handshake_name, NULL, | ^~~~~~~~~~~~~~ | | | const u8 * {aka const unsigned char *} In file included from messages.h:11, from noise.h:8, from noise.c:6: /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c> 145 | static inline void blake2s(const u8 *key, size_t keylen, | ~~~~~~~^~~~~~ noise.c:42:33: error: passing argument 5 of 'blake2s' makes pointer from integer without a cast [-Wint-conversion] 42 | NOISE_HASH_LEN, sizeof(handshake_name), 0); | ^~~~~~~~~~~~~~~~~~~~~~ | | | long unsigned int /nix/store/shikf79438n1f7975bfl0wjzp4k3n1zx-linux-aarch64-unknown-linux-gnu-6.19.0-dev/lib/modules/6.19.0/source/include/c> 147 | u8 *out, size_t outlen) | ~~~~^~~ noise.c:39:30: warning: unused variable 'blake' [-Wunused-variable] 39 | struct blake2s_state blake; | ^~~~~ noise.c: In function 'hmac': noise.c:310:30: error: storage size of 'state' isn't known 310 | struct blake2s_state state; | ^~~~~ noise.c:310:30: warning: unused variable 'state' [-Wunused-variable] noise.c: In function 'mix_hash': noise.c:437:30: error: storage size of 'blake' isn't known 437 | struct blake2s_state blake; | ^~~~~ noise.c:437:30: warning: unused variable 'blake' [-Wunused-variable] ``` Relevant upstream changes seem to be: - https://github.com/torvalds/linux/commit/50b8e36994a042103ea92b6d9f6d7de725f9ac5f - https://github.com/torvalds/linux/commit/5e0ec8e46d4d6488242bb39a4ce5c0276afa5f32 - https://github.com/torvalds/linux/commit/c0d597e01626a28598119570b29186c93f3aced3 and the rest of the scoped ksimd series
Author
Owner

@zerkalica commented on GitHub (Feb 10, 2026):

This patch worked for me

diff -ruN amneziawg-1.0.0-orig/compat/simd/include/linux/simd.h amneziawg-1.0.0/compat/simd/include/linux/simd.h
--- amneziawg-1.0.0-orig/compat/simd/include/linux/simd.h	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/compat/simd/include/linux/simd.h	2026-02-10 14:08:23.802552419 +0300
@@ -32,9 +32,6 @@
 #if defined(CONFIG_X86_64)
 	if (*ctx & HAVE_SIMD_IN_USE)
 		kernel_fpu_end();
-#elif defined(CONFIG_KERNEL_MODE_NEON)
-	if (*ctx & HAVE_SIMD_IN_USE)
-		kernel_neon_end();
 #endif
 	*ctx = HAVE_NO_SIMD;
 }
@@ -60,7 +57,7 @@
 #if defined(CONFIG_X86_64)
 	kernel_fpu_begin();
 #elif defined(CONFIG_KERNEL_MODE_NEON)
-	kernel_neon_begin();
+	scoped_ksimd();
 #endif
 	*ctx |= HAVE_SIMD_IN_USE;
 	return true;
diff -ruN amneziawg-1.0.0-orig/cookie.c amneziawg-1.0.0/cookie.c
--- amneziawg-1.0.0-orig/cookie.c	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/cookie.c	2026-02-10 13:52:50.772872569 +0300
@@ -33,7 +33,7 @@
 			   const u8 pubkey[NOISE_PUBLIC_KEY_LEN],
 			   const u8 label[COOKIE_KEY_LABEL_LEN])
 {
-	struct blake2s_state blake;
+	struct blake2s_ctx blake;
 
 	blake2s_init(&blake, NOISE_SYMMETRIC_KEY_LEN);
 	blake2s_update(&blake, label, COOKIE_KEY_LABEL_LEN);
@@ -77,7 +77,7 @@
 {
 	len = len - sizeof(struct message_macs) +
 	      offsetof(struct message_macs, mac1);
-	blake2s(mac1, message, key, COOKIE_LEN, len, NOISE_SYMMETRIC_KEY_LEN);
+	blake2s(key, NOISE_SYMMETRIC_KEY_LEN, message, len, mac1, COOKIE_LEN);
 }
 
 static void compute_mac2(u8 mac2[COOKIE_LEN], const void *message, size_t len,
@@ -85,13 +85,13 @@
 {
 	len = len - sizeof(struct message_macs) +
 	      offsetof(struct message_macs, mac2);
-	blake2s(mac2, message, cookie, COOKIE_LEN, len, COOKIE_LEN);
+	blake2s(cookie, COOKIE_LEN, message, len, mac2, COOKIE_LEN);
 }
 
 static void make_cookie(u8 cookie[COOKIE_LEN], struct sk_buff *skb,
 			struct cookie_checker *checker)
 {
-	struct blake2s_state state;
+	struct blake2s_ctx state;
 
 	if (wg_birthdate_has_expired(checker->secret_birthdate,
 				     COOKIE_SECRET_MAX_AGE)) {
diff -ruN amneziawg-1.0.0-orig/crypto/include/zinc/blake2s.h amneziawg-1.0.0/crypto/include/zinc/blake2s.h
--- amneziawg-1.0.0-orig/crypto/include/zinc/blake2s.h	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/crypto/include/zinc/blake2s.h	2026-02-10 13:55:35.150474863 +0300
@@ -16,7 +16,7 @@
 	BLAKE2S_KEY_SIZE = 32
 };
 
-struct blake2s_state {
+struct blake2s_ctx {
 	u32 h[8];
 	u32 t[2];
 	u32 f[2];
@@ -25,17 +25,17 @@
 	unsigned int outlen;
 };
 
-void blake2s_init(struct blake2s_state *state, const size_t outlen);
-void blake2s_init_key(struct blake2s_state *state, const size_t outlen,
+void blake2s_init(struct blake2s_ctx *state, const size_t outlen);
+void blake2s_init_key(struct blake2s_ctx *state, const size_t outlen,
 		      const void *key, const size_t keylen);
-void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen);
-void blake2s_final(struct blake2s_state *state, u8 *out);
+void blake2s_update(struct blake2s_ctx *state, const u8 *in, size_t inlen);
+void blake2s_final(struct blake2s_ctx *state, u8 *out);
 
-static inline void blake2s(u8 *out, const u8 *in, const u8 *key,
-			   const size_t outlen, const size_t inlen,
-			   const size_t keylen)
+static inline void blake2s(const u8 *key, const size_t keylen,
+	       const u8 *in, const size_t inlen,
+	       u8 *out, const size_t outlen)
 {
-	struct blake2s_state state;
+	struct blake2s_ctx state;
 
 	WARN_ON(IS_ENABLED(DEBUG) && ((!in && inlen > 0) || !out || !outlen ||
 		outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE ||
diff -ruN amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s.c amneziawg-1.0.0/crypto/zinc/blake2s/blake2s.c
--- amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s.c	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/crypto/zinc/blake2s/blake2s.c	2026-02-10 13:30:31.247260214 +0300
@@ -37,19 +37,19 @@
 	{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
 };
 
-static inline void blake2s_set_lastblock(struct blake2s_state *state)
+static inline void blake2s_set_lastblock(struct blake2s_ctx *state)
 {
 	state->f[0] = -1;
 }
 
-static inline void blake2s_increment_counter(struct blake2s_state *state,
+static inline void blake2s_increment_counter(struct blake2s_ctx *state,
 					     const u32 inc)
 {
 	state->t[0] += inc;
 	state->t[1] += (state->t[0] < inc);
 }
 
-static inline void blake2s_init_param(struct blake2s_state *state,
+static inline void blake2s_init_param(struct blake2s_ctx *state,
 				      const u32 param)
 {
 	int i;
@@ -60,14 +60,14 @@
 	state->h[0] ^= param;
 }
 
-void blake2s_init(struct blake2s_state *state, const size_t outlen)
+void blake2s_init(struct blake2s_ctx *state, const size_t outlen)
 {
 	WARN_ON(IS_ENABLED(DEBUG) && (!outlen || outlen > BLAKE2S_HASH_SIZE));
 	blake2s_init_param(state, 0x01010000 | outlen);
 	state->outlen = outlen;
 }
 
-void blake2s_init_key(struct blake2s_state *state, const size_t outlen,
+void blake2s_init_key(struct blake2s_ctx *state, const size_t outlen,
 		      const void *key, const size_t keylen)
 {
 	u8 block[BLAKE2S_BLOCK_SIZE] = { 0 };
@@ -88,7 +88,7 @@
 static void __init blake2s_fpu_init(void)
 {
 }
-static inline bool blake2s_compress_arch(struct blake2s_state *state,
+static inline bool blake2s_compress_arch(struct blake2s_ctx *state,
 					 const u8 *block, size_t nblocks,
 					 const u32 inc)
 {
@@ -96,7 +96,7 @@
 }
 #endif
 
-static inline void blake2s_compress(struct blake2s_state *state,
+static inline void blake2s_compress(struct blake2s_ctx *state,
 				    const u8 *block, size_t nblocks,
 				    const u32 inc)
 {
@@ -167,7 +167,7 @@
 	}
 }
 
-void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen)
+void blake2s_update(struct blake2s_ctx *state, const u8 *in, size_t inlen)
 {
 	const size_t fill = BLAKE2S_BLOCK_SIZE - state->buflen;
 
@@ -191,7 +191,7 @@
 	state->buflen += inlen;
 }
 
-void blake2s_final(struct blake2s_state *state, u8 *out)
+void blake2s_final(struct blake2s_ctx *state, u8 *out)
 {
 	WARN_ON(IS_ENABLED(DEBUG) && !out);
 	blake2s_set_lastblock(state);
@@ -206,7 +206,7 @@
 void blake2s_hmac(u8 *out, const u8 *in, const u8 *key, const size_t outlen,
 		  const size_t inlen, const size_t keylen)
 {
-	struct blake2s_state state;
+	struct blake2s_ctx state;
 	u8 x_key[BLAKE2S_BLOCK_SIZE] __aligned(__alignof__(u32)) = { 0 };
 	u8 i_hash[BLAKE2S_HASH_SIZE] __aligned(__alignof__(u32));
 	int i;
diff -ruN amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s-x86_64-glue.c amneziawg-1.0.0/crypto/zinc/blake2s/blake2s-x86_64-glue.c
--- amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s-x86_64-glue.c	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/crypto/zinc/blake2s/blake2s-x86_64-glue.c	2026-02-10 13:30:31.253524021 +0300
@@ -8,10 +8,10 @@
 #include <asm/processor.h>
 #include <asm/fpu/api.h>
 
-asmlinkage void blake2s_compress_ssse3(struct blake2s_state *state,
+asmlinkage void blake2s_compress_ssse3(struct blake2s_ctx *state,
 				       const u8 *block, const size_t nblocks,
 				       const u32 inc);
-asmlinkage void blake2s_compress_avx512(struct blake2s_state *state,
+asmlinkage void blake2s_compress_avx512(struct blake2s_ctx *state,
 					const u8 *block, const size_t nblocks,
 					const u32 inc);
 
@@ -34,7 +34,7 @@
 #endif
 }
 
-static inline bool blake2s_compress_arch(struct blake2s_state *state,
+static inline bool blake2s_compress_arch(struct blake2s_ctx *state,
 					 const u8 *block, size_t nblocks,
 					 const u32 inc)
 {
diff -ruN amneziawg-1.0.0-orig/crypto/zinc/selftest/blake2s.c amneziawg-1.0.0/crypto/zinc/selftest/blake2s.c
--- amneziawg-1.0.0-orig/crypto/zinc/selftest/blake2s.c	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/crypto/zinc/selftest/blake2s.c	2026-02-10 14:01:42.303009905 +0300
@@ -2072,7 +2072,7 @@
 		buf[i] = (u8)i;
 
 	for (i = 0; i < ARRAY_SIZE(blake2s_keyed_testvecs); ++i) {
-		blake2s(hash, buf, key, BLAKE2S_HASH_SIZE, i, BLAKE2S_KEY_SIZE);
+		blake2s(key, BLAKE2S_KEY_SIZE, buf, i, hash, BLAKE2S_HASH_SIZE);
 		if (memcmp(hash, blake2s_keyed_testvecs[i], BLAKE2S_HASH_SIZE)) {
 			pr_err("blake2s keyed self-test %zu: FAIL\n", i + 1);
 			success = false;
@@ -2080,7 +2080,7 @@
 	}
 
 	for (i = 0; i < ARRAY_SIZE(blake2s_testvecs); ++i) {
-		blake2s(hash, buf, NULL, BLAKE2S_HASH_SIZE, i, 0);
+		blake2s(NULL, 0, buf, i, hash, BLAKE2S_HASH_SIZE);
 		if (memcmp(hash, blake2s_testvecs[i], BLAKE2S_HASH_SIZE)) {
 			pr_err("blake2s unkeyed self-test %zu: FAIL\n", i + i);
 			success = false;
diff -ruN amneziawg-1.0.0-orig/noise.c amneziawg-1.0.0/noise.c
--- amneziawg-1.0.0-orig/noise.c	2026-02-10 13:16:00.000000000 +0300
+++ amneziawg-1.0.0/noise.c	2026-02-10 13:50:34.604973420 +0300
@@ -36,10 +36,10 @@
 
 void __init wg_noise_init(void)
 {
-	struct blake2s_state blake;
+	struct blake2s_ctx blake;
 
-	blake2s(handshake_init_chaining_key, handshake_name, NULL,
-		NOISE_HASH_LEN, sizeof(handshake_name), 0);
+	blake2s(NULL, 0,handshake_name, sizeof(handshake_name),
+		handshake_init_chaining_key, NOISE_HASH_LEN);
 	blake2s_init(&blake, NOISE_HASH_LEN);
 	blake2s_update(&blake, handshake_init_chaining_key, NOISE_HASH_LEN);
 	blake2s_update(&blake, identifier_name, sizeof(identifier_name));
@@ -307,7 +307,7 @@
 
 static void hmac(u8 *out, const u8 *in, const u8 *key, const size_t inlen, const size_t keylen)
 {
-	struct blake2s_state state;
+	struct blake2s_ctx state;
 	u8 x_key[BLAKE2S_BLOCK_SIZE] __aligned(__alignof__(u32)) = { 0 };
 	u8 i_hash[BLAKE2S_HASH_SIZE] __aligned(__alignof__(u32));
 	int i;
@@ -434,7 +434,7 @@
 
 static void mix_hash(u8 hash[NOISE_HASH_LEN], const u8 *src, size_t src_len)
 {
-	struct blake2s_state blake;
+	struct blake2s_ctx blake;
 
 	blake2s_init(&blake, NOISE_HASH_LEN);
 	blake2s_update(&blake, hash, NOISE_HASH_LEN);

<!-- gh-comment-id:3876984565 --> @zerkalica commented on GitHub (Feb 10, 2026): <details> <summary>This patch worked for me</summary> ```patch diff -ruN amneziawg-1.0.0-orig/compat/simd/include/linux/simd.h amneziawg-1.0.0/compat/simd/include/linux/simd.h --- amneziawg-1.0.0-orig/compat/simd/include/linux/simd.h 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/compat/simd/include/linux/simd.h 2026-02-10 14:08:23.802552419 +0300 @@ -32,9 +32,6 @@ #if defined(CONFIG_X86_64) if (*ctx & HAVE_SIMD_IN_USE) kernel_fpu_end(); -#elif defined(CONFIG_KERNEL_MODE_NEON) - if (*ctx & HAVE_SIMD_IN_USE) - kernel_neon_end(); #endif *ctx = HAVE_NO_SIMD; } @@ -60,7 +57,7 @@ #if defined(CONFIG_X86_64) kernel_fpu_begin(); #elif defined(CONFIG_KERNEL_MODE_NEON) - kernel_neon_begin(); + scoped_ksimd(); #endif *ctx |= HAVE_SIMD_IN_USE; return true; diff -ruN amneziawg-1.0.0-orig/cookie.c amneziawg-1.0.0/cookie.c --- amneziawg-1.0.0-orig/cookie.c 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/cookie.c 2026-02-10 13:52:50.772872569 +0300 @@ -33,7 +33,7 @@ const u8 pubkey[NOISE_PUBLIC_KEY_LEN], const u8 label[COOKIE_KEY_LABEL_LEN]) { - struct blake2s_state blake; + struct blake2s_ctx blake; blake2s_init(&blake, NOISE_SYMMETRIC_KEY_LEN); blake2s_update(&blake, label, COOKIE_KEY_LABEL_LEN); @@ -77,7 +77,7 @@ { len = len - sizeof(struct message_macs) + offsetof(struct message_macs, mac1); - blake2s(mac1, message, key, COOKIE_LEN, len, NOISE_SYMMETRIC_KEY_LEN); + blake2s(key, NOISE_SYMMETRIC_KEY_LEN, message, len, mac1, COOKIE_LEN); } static void compute_mac2(u8 mac2[COOKIE_LEN], const void *message, size_t len, @@ -85,13 +85,13 @@ { len = len - sizeof(struct message_macs) + offsetof(struct message_macs, mac2); - blake2s(mac2, message, cookie, COOKIE_LEN, len, COOKIE_LEN); + blake2s(cookie, COOKIE_LEN, message, len, mac2, COOKIE_LEN); } static void make_cookie(u8 cookie[COOKIE_LEN], struct sk_buff *skb, struct cookie_checker *checker) { - struct blake2s_state state; + struct blake2s_ctx state; if (wg_birthdate_has_expired(checker->secret_birthdate, COOKIE_SECRET_MAX_AGE)) { diff -ruN amneziawg-1.0.0-orig/crypto/include/zinc/blake2s.h amneziawg-1.0.0/crypto/include/zinc/blake2s.h --- amneziawg-1.0.0-orig/crypto/include/zinc/blake2s.h 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/crypto/include/zinc/blake2s.h 2026-02-10 13:55:35.150474863 +0300 @@ -16,7 +16,7 @@ BLAKE2S_KEY_SIZE = 32 }; -struct blake2s_state { +struct blake2s_ctx { u32 h[8]; u32 t[2]; u32 f[2]; @@ -25,17 +25,17 @@ unsigned int outlen; }; -void blake2s_init(struct blake2s_state *state, const size_t outlen); -void blake2s_init_key(struct blake2s_state *state, const size_t outlen, +void blake2s_init(struct blake2s_ctx *state, const size_t outlen); +void blake2s_init_key(struct blake2s_ctx *state, const size_t outlen, const void *key, const size_t keylen); -void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen); -void blake2s_final(struct blake2s_state *state, u8 *out); +void blake2s_update(struct blake2s_ctx *state, const u8 *in, size_t inlen); +void blake2s_final(struct blake2s_ctx *state, u8 *out); -static inline void blake2s(u8 *out, const u8 *in, const u8 *key, - const size_t outlen, const size_t inlen, - const size_t keylen) +static inline void blake2s(const u8 *key, const size_t keylen, + const u8 *in, const size_t inlen, + u8 *out, const size_t outlen) { - struct blake2s_state state; + struct blake2s_ctx state; WARN_ON(IS_ENABLED(DEBUG) && ((!in && inlen > 0) || !out || !outlen || outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE || diff -ruN amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s.c amneziawg-1.0.0/crypto/zinc/blake2s/blake2s.c --- amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s.c 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/crypto/zinc/blake2s/blake2s.c 2026-02-10 13:30:31.247260214 +0300 @@ -37,19 +37,19 @@ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, }; -static inline void blake2s_set_lastblock(struct blake2s_state *state) +static inline void blake2s_set_lastblock(struct blake2s_ctx *state) { state->f[0] = -1; } -static inline void blake2s_increment_counter(struct blake2s_state *state, +static inline void blake2s_increment_counter(struct blake2s_ctx *state, const u32 inc) { state->t[0] += inc; state->t[1] += (state->t[0] < inc); } -static inline void blake2s_init_param(struct blake2s_state *state, +static inline void blake2s_init_param(struct blake2s_ctx *state, const u32 param) { int i; @@ -60,14 +60,14 @@ state->h[0] ^= param; } -void blake2s_init(struct blake2s_state *state, const size_t outlen) +void blake2s_init(struct blake2s_ctx *state, const size_t outlen) { WARN_ON(IS_ENABLED(DEBUG) && (!outlen || outlen > BLAKE2S_HASH_SIZE)); blake2s_init_param(state, 0x01010000 | outlen); state->outlen = outlen; } -void blake2s_init_key(struct blake2s_state *state, const size_t outlen, +void blake2s_init_key(struct blake2s_ctx *state, const size_t outlen, const void *key, const size_t keylen) { u8 block[BLAKE2S_BLOCK_SIZE] = { 0 }; @@ -88,7 +88,7 @@ static void __init blake2s_fpu_init(void) { } -static inline bool blake2s_compress_arch(struct blake2s_state *state, +static inline bool blake2s_compress_arch(struct blake2s_ctx *state, const u8 *block, size_t nblocks, const u32 inc) { @@ -96,7 +96,7 @@ } #endif -static inline void blake2s_compress(struct blake2s_state *state, +static inline void blake2s_compress(struct blake2s_ctx *state, const u8 *block, size_t nblocks, const u32 inc) { @@ -167,7 +167,7 @@ } } -void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen) +void blake2s_update(struct blake2s_ctx *state, const u8 *in, size_t inlen) { const size_t fill = BLAKE2S_BLOCK_SIZE - state->buflen; @@ -191,7 +191,7 @@ state->buflen += inlen; } -void blake2s_final(struct blake2s_state *state, u8 *out) +void blake2s_final(struct blake2s_ctx *state, u8 *out) { WARN_ON(IS_ENABLED(DEBUG) && !out); blake2s_set_lastblock(state); @@ -206,7 +206,7 @@ void blake2s_hmac(u8 *out, const u8 *in, const u8 *key, const size_t outlen, const size_t inlen, const size_t keylen) { - struct blake2s_state state; + struct blake2s_ctx state; u8 x_key[BLAKE2S_BLOCK_SIZE] __aligned(__alignof__(u32)) = { 0 }; u8 i_hash[BLAKE2S_HASH_SIZE] __aligned(__alignof__(u32)); int i; diff -ruN amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s-x86_64-glue.c amneziawg-1.0.0/crypto/zinc/blake2s/blake2s-x86_64-glue.c --- amneziawg-1.0.0-orig/crypto/zinc/blake2s/blake2s-x86_64-glue.c 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/crypto/zinc/blake2s/blake2s-x86_64-glue.c 2026-02-10 13:30:31.253524021 +0300 @@ -8,10 +8,10 @@ #include <asm/processor.h> #include <asm/fpu/api.h> -asmlinkage void blake2s_compress_ssse3(struct blake2s_state *state, +asmlinkage void blake2s_compress_ssse3(struct blake2s_ctx *state, const u8 *block, const size_t nblocks, const u32 inc); -asmlinkage void blake2s_compress_avx512(struct blake2s_state *state, +asmlinkage void blake2s_compress_avx512(struct blake2s_ctx *state, const u8 *block, const size_t nblocks, const u32 inc); @@ -34,7 +34,7 @@ #endif } -static inline bool blake2s_compress_arch(struct blake2s_state *state, +static inline bool blake2s_compress_arch(struct blake2s_ctx *state, const u8 *block, size_t nblocks, const u32 inc) { diff -ruN amneziawg-1.0.0-orig/crypto/zinc/selftest/blake2s.c amneziawg-1.0.0/crypto/zinc/selftest/blake2s.c --- amneziawg-1.0.0-orig/crypto/zinc/selftest/blake2s.c 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/crypto/zinc/selftest/blake2s.c 2026-02-10 14:01:42.303009905 +0300 @@ -2072,7 +2072,7 @@ buf[i] = (u8)i; for (i = 0; i < ARRAY_SIZE(blake2s_keyed_testvecs); ++i) { - blake2s(hash, buf, key, BLAKE2S_HASH_SIZE, i, BLAKE2S_KEY_SIZE); + blake2s(key, BLAKE2S_KEY_SIZE, buf, i, hash, BLAKE2S_HASH_SIZE); if (memcmp(hash, blake2s_keyed_testvecs[i], BLAKE2S_HASH_SIZE)) { pr_err("blake2s keyed self-test %zu: FAIL\n", i + 1); success = false; @@ -2080,7 +2080,7 @@ } for (i = 0; i < ARRAY_SIZE(blake2s_testvecs); ++i) { - blake2s(hash, buf, NULL, BLAKE2S_HASH_SIZE, i, 0); + blake2s(NULL, 0, buf, i, hash, BLAKE2S_HASH_SIZE); if (memcmp(hash, blake2s_testvecs[i], BLAKE2S_HASH_SIZE)) { pr_err("blake2s unkeyed self-test %zu: FAIL\n", i + i); success = false; diff -ruN amneziawg-1.0.0-orig/noise.c amneziawg-1.0.0/noise.c --- amneziawg-1.0.0-orig/noise.c 2026-02-10 13:16:00.000000000 +0300 +++ amneziawg-1.0.0/noise.c 2026-02-10 13:50:34.604973420 +0300 @@ -36,10 +36,10 @@ void __init wg_noise_init(void) { - struct blake2s_state blake; + struct blake2s_ctx blake; - blake2s(handshake_init_chaining_key, handshake_name, NULL, - NOISE_HASH_LEN, sizeof(handshake_name), 0); + blake2s(NULL, 0,handshake_name, sizeof(handshake_name), + handshake_init_chaining_key, NOISE_HASH_LEN); blake2s_init(&blake, NOISE_HASH_LEN); blake2s_update(&blake, handshake_init_chaining_key, NOISE_HASH_LEN); blake2s_update(&blake, identifier_name, sizeof(identifier_name)); @@ -307,7 +307,7 @@ static void hmac(u8 *out, const u8 *in, const u8 *key, const size_t inlen, const size_t keylen) { - struct blake2s_state state; + struct blake2s_ctx state; u8 x_key[BLAKE2S_BLOCK_SIZE] __aligned(__alignof__(u32)) = { 0 }; u8 i_hash[BLAKE2S_HASH_SIZE] __aligned(__alignof__(u32)); int i; @@ -434,7 +434,7 @@ static void mix_hash(u8 hash[NOISE_HASH_LEN], const u8 *src, size_t src_len) { - struct blake2s_state blake; + struct blake2s_ctx blake; blake2s_init(&blake, NOISE_HASH_LEN); blake2s_update(&blake, hash, NOISE_HASH_LEN); ``` </details>
Author
Owner

@K900 commented on GitHub (Feb 10, 2026):

The problem is that this will break older kernels AFAICT... Someone needs to go through and actually fix up all the compat layers.

<!-- gh-comment-id:3876992730 --> @K900 commented on GitHub (Feb 10, 2026): The problem is that this will break older kernels AFAICT... Someone needs to go through and actually fix up all the compat layers.
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#86
No description provided.