new file mode 100644
@@ -0,0 +1,83 @@
+From 9056d5fc68c2a84bdbbf089fcbac9e2ba7d093cb Mon Sep 17 00:00:00 2001
+From: Andri Yngvason <andri@yngvason.is>
+Date: Sun, 17 May 2026 09:57:07 +0000
+Subject: [PATCH 1/4] Use nettle & hogweed version 4
+
+Upstream-Status: Backport [https://github.com/any1/neatvnc/commit/5b190f0fd9e6]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+---
+ meson.build | 6 ++++--
+ src/crypto/nettle/cipher.c | 8 ++++----
+ src/crypto/nettle/hash.c | 2 +-
+ 3 files changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index cf8d67423f9c..b79606729e94 100644
+--- a/meson.build
++++ b/meson.build
+@@ -61,8 +61,10 @@ libm = cc.find_library('m', required: false)
+ pixman = dependency('pixman-1')
+ libturbojpeg = dependency('libturbojpeg', required: get_option('jpeg'))
+ gnutls = dependency('gnutls', required: get_option('tls'))
+-nettle = dependency('nettle', required: get_option('nettle'))
+-hogweed = dependency('hogweed', required: get_option('nettle'))
++nettle = dependency('nettle', required: get_option('nettle'),
++ version: ['>=4.0', '<5.0'])
++hogweed = dependency('hogweed', required: get_option('nettle'),
++ version: ['>=4.0', '<5.0'])
+ gmp = dependency('gmp', required: get_option('nettle'))
+ zlib = dependency('zlib')
+ gbm = dependency('gbm', required: get_option('gbm'))
+diff --git a/src/crypto/nettle/cipher.c b/src/crypto/nettle/cipher.c
+index 0dd2262f09cc..6eb8770f2119 100644
+--- a/src/crypto/nettle/cipher.c
++++ b/src/crypto/nettle/cipher.c
+@@ -119,7 +119,7 @@ static bool crypto_cipher_aes_eax_encrypt(struct crypto_cipher* self,
+ (uint8_t*)dst->data + dst->len, src);
+ dst->len += src_len;
+
+- nettle_eax_aes128_digest(&self->enc_ctx.aes_eax.ctx, 16, mac);
++ nettle_eax_aes128_digest(&self->enc_ctx.aes_eax.ctx, mac);
+
+ return true;
+ }
+@@ -131,7 +131,7 @@ static ssize_t crypto_cipher_aes_eax_decrypt(struct crypto_cipher* self,
+ crypto_aes_eax_update_nonce(&self->dec_ctx.aes_eax);
+ nettle_eax_aes128_update(&self->dec_ctx.aes_eax.ctx, ad_len, ad);
+ nettle_eax_aes128_decrypt(&self->dec_ctx.aes_eax.ctx, len, dst, src);
+- nettle_eax_aes128_digest(&self->dec_ctx.aes_eax.ctx, 16, mac);
++ nettle_eax_aes128_digest(&self->dec_ctx.aes_eax.ctx, mac);
+ return len;
+ }
+
+@@ -179,7 +179,7 @@ static bool crypto_cipher_aes256_eax_encrypt(struct crypto_cipher* self,
+ (uint8_t*)dst->data + dst->len, src);
+ dst->len += src_len;
+
+- EAX_DIGEST(&self->enc_ctx.aes256_eax.ctx, aes256_encrypt, 16, mac);
++ EAX_DIGEST(&self->enc_ctx.aes256_eax.ctx, aes256_encrypt, mac);
+
+ return true;
+ }
+@@ -191,7 +191,7 @@ static ssize_t crypto_cipher_aes256_eax_decrypt(struct crypto_cipher* self,
+ crypto_aes256_eax_update_nonce(&self->dec_ctx.aes256_eax);
+ EAX_UPDATE(&self->dec_ctx.aes256_eax.ctx, aes256_encrypt, ad_len, ad);
+ EAX_DECRYPT(&self->dec_ctx.aes256_eax.ctx, aes256_encrypt, len, dst, src);
+- EAX_DIGEST(&self->dec_ctx.aes256_eax.ctx, aes256_encrypt, 16, mac);
++ EAX_DIGEST(&self->dec_ctx.aes256_eax.ctx, aes256_encrypt, mac);
+ return len;
+ }
+
+diff --git a/src/crypto/nettle/hash.c b/src/crypto/nettle/hash.c
+index 71318f4a1c0b..9fbfe5f7c717 100644
+--- a/src/crypto/nettle/hash.c
++++ b/src/crypto/nettle/hash.c
+@@ -21,7 +21,7 @@
+ #include <stdlib.h>
+ #include <nettle/md5.h>
+ #include <nettle/sha1.h>
+-#include <nettle/sha.h>
++#include <nettle/sha2.h>
+
+ struct crypto_hash {
+ union {
new file mode 100644
@@ -0,0 +1,160 @@
+From 11dc4a4ce000fd3de7699da939195726b147d5de Mon Sep 17 00:00:00 2001
+From: Andri Yngvason <andri@yngvason.is>
+Date: Tue, 19 May 2026 21:23:59 +0000
+Subject: [PATCH 2/4] crypto: Remove hash digest size argument
+
+This has been removed in nettle 4.
+
+Upstream-Status: Backport [https://github.com/any1/neatvnc/commit/f97805deaaea]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+---
+ include/crypto.h | 7 +++----
+ src/auth/apple-dh.c | 3 +--
+ src/auth/rsa-aes.c | 16 ++++++++--------
+ src/crypto/nettle/hash.c | 14 +++++++-------
+ src/stream/ws/handshake.c | 3 +--
+ 5 files changed, 20 insertions(+), 23 deletions(-)
+
+diff --git a/include/crypto.h b/include/crypto.h
+index 9a1aee415f12..1e5886f7b2fe 100644
+--- a/include/crypto.h
++++ b/include/crypto.h
+@@ -88,12 +88,11 @@ void crypto_hash_del(struct crypto_hash* self);
+
+ void crypto_hash_append(struct crypto_hash* self, const uint8_t* src,
+ size_t len);
+-void crypto_hash_digest(struct crypto_hash* self, uint8_t* dst,
+- size_t len);
++void crypto_hash_digest(struct crypto_hash* self, uint8_t* dst);
+
+-void crypto_hash_one(uint8_t* dst, size_t dst_len, enum crypto_hash_type type,
++void crypto_hash_one(uint8_t* dst, enum crypto_hash_type type,
+ const uint8_t* src, size_t src_len);
+-void crypto_hash_many(uint8_t* dst, size_t dst_len, enum crypto_hash_type type,
++void crypto_hash_many(uint8_t* dst, enum crypto_hash_type type,
+ const struct crypto_data_entry *src);
+
+ // RSA
+diff --git a/src/auth/apple-dh.c b/src/auth/apple-dh.c
+index 43833970892c..238561861155 100644
+--- a/src/auth/apple-dh.c
++++ b/src/auth/apple-dh.c
+@@ -78,8 +78,7 @@ int apple_dh_handle_response(struct nvnc_client* client)
+ crypto_key_del(shared_secret);
+
+ uint8_t hash[16] = {};
+- crypto_hash_one(hash, sizeof(hash), CRYPTO_HASH_MD5, shared_buf,
+- sizeof(shared_buf));
++ crypto_hash_one(hash, CRYPTO_HASH_MD5, shared_buf, sizeof(shared_buf));
+
+ struct crypto_cipher* cipher;
+ cipher = crypto_cipher_new(NULL, hash, CRYPTO_CIPHER_AES128_ECB);
+diff --git a/src/auth/rsa-aes.c b/src/auth/rsa-aes.c
+index dea2e7c84e2d..d2f217d4c501 100644
+--- a/src/auth/rsa-aes.c
++++ b/src/auth/rsa-aes.c
+@@ -154,8 +154,8 @@ static int on_rsa_aes_challenge(struct nvnc_client* client)
+
+ // ClientSessionKey = the first 16 bytes of SHA1(ServerRandom || ClientRandom)
+ uint8_t client_session_key[32];
+- crypto_hash_many(client_session_key, client_rsa_aes_hash_len(client),
+- client->rsa.hash_type, (const struct crypto_data_entry[]) {
++ crypto_hash_many(client_session_key, client->rsa.hash_type,
++ (const struct crypto_data_entry[]) {
+ { client->rsa.challenge, client->rsa.challenge_len },
+ { client_random, client->rsa.challenge_len },
+ {}
+@@ -163,8 +163,8 @@ static int on_rsa_aes_challenge(struct nvnc_client* client)
+
+ // ServerSessionKey = the first 16 bytes of SHA1(ClientRandom || ServerRandom)
+ uint8_t server_session_key[32];
+- crypto_hash_many(server_session_key, client_rsa_aes_hash_len(client),
+- client->rsa.hash_type, (const struct crypto_data_entry[]) {
++ crypto_hash_many(server_session_key, client->rsa.hash_type,
++ (const struct crypto_data_entry[]) {
+ { client_random, client->rsa.challenge_len },
+ { client->rsa.challenge, client->rsa.challenge_len },
+ {}
+@@ -195,8 +195,8 @@ static int on_rsa_aes_challenge(struct nvnc_client* client)
+ uint32_t client_key_len_be = htonl(client_key_len * 8);
+
+ uint8_t server_hash[32] = {};
+- crypto_hash_many(server_hash, client_rsa_aes_hash_len(client),
+- client->rsa.hash_type, (const struct crypto_data_entry[]) {
++ crypto_hash_many(server_hash, client->rsa.hash_type,
++ (const struct crypto_data_entry[]) {
+ { (uint8_t*)&server_key_len_be, 4 },
+ { server_modulus, server_key_len },
+ { server_exponent, server_key_len },
+@@ -249,8 +249,8 @@ static int on_rsa_aes_client_hash(struct nvnc_client* client)
+ uint32_t client_key_len_be = htonl(client_key_len * 8);
+
+ uint8_t client_hash[32] = {};
+- crypto_hash_many(client_hash, client_rsa_aes_hash_len(client),
+- client->rsa.hash_type, (const struct crypto_data_entry[]) {
++ crypto_hash_many(client_hash, client->rsa.hash_type,
++ (const struct crypto_data_entry[]) {
+ { (uint8_t*)&client_key_len_be, 4 },
+ { client_modulus, client_key_len },
+ { client_exponent, client_key_len },
+diff --git a/src/crypto/nettle/hash.c b/src/crypto/nettle/hash.c
+index 9fbfe5f7c717..832953305d44 100644
+--- a/src/crypto/nettle/hash.c
++++ b/src/crypto/nettle/hash.c
+@@ -31,7 +31,7 @@ struct crypto_hash {
+ } ctx;
+
+ void (*update)(void* ctx, size_t len, const uint8_t* src);
+- void (*digest)(void* ctx, size_t len, uint8_t* dst);
++ void (*digest)(void* ctx, uint8_t* dst);
+ };
+
+ struct crypto_hash* crypto_hash_new(enum crypto_hash_type type)
+@@ -75,27 +75,27 @@ void crypto_hash_append(struct crypto_hash* self, const uint8_t* src,
+ self->update(&self->ctx, len, src);
+ }
+
+-void crypto_hash_digest(struct crypto_hash* self, uint8_t* dst, size_t len)
++void crypto_hash_digest(struct crypto_hash* self, uint8_t* dst)
+ {
+- self->digest(&self->ctx, len, dst);
++ self->digest(&self->ctx, dst);
+ }
+
+-void crypto_hash_one(uint8_t* dst, size_t dst_len, enum crypto_hash_type type,
++void crypto_hash_one(uint8_t* dst, enum crypto_hash_type type,
+ const uint8_t* src, size_t src_len)
+ {
+ struct crypto_hash *hash = crypto_hash_new(type);
+ crypto_hash_append(hash, src, src_len);
+- crypto_hash_digest(hash, dst, dst_len);
++ crypto_hash_digest(hash, dst);
+ crypto_hash_del(hash);
+ }
+
+-void crypto_hash_many(uint8_t* dst, size_t dst_len, enum crypto_hash_type type,
++void crypto_hash_many(uint8_t* dst, enum crypto_hash_type type,
+ const struct crypto_data_entry *src)
+ {
+ struct crypto_hash *hash = crypto_hash_new(type);
+ for (int i = 0; src[i].data && src[i].len; ++i)
+ crypto_hash_append(hash, src[i].data, src[i].len);
+- crypto_hash_digest(hash, dst, dst_len);
++ crypto_hash_digest(hash, dst);
+ crypto_hash_del(hash);
+ }
+
+diff --git a/src/stream/ws/handshake.c b/src/stream/ws/handshake.c
+index 80881189236e..aa0db3f9f2c2 100644
+--- a/src/stream/ws/handshake.c
++++ b/src/stream/ws/handshake.c
+@@ -79,8 +79,7 @@ ssize_t ws_handshake(char* output, size_t output_maxlen, const char* input)
+ goto failure;
+
+ uint8_t hash[20];
+- crypto_hash_many(hash, sizeof(hash), CRYPTO_HASH_SHA1,
+- (struct crypto_data_entry[]){
++ crypto_hash_many(hash, sizeof(hash), (struct crypto_data_entry[]){
+ { (uint8_t*)challenge, strlen(challenge) },
+ { (uint8_t*)magic_uuid, strlen(magic_uuid) },
+ {}
new file mode 100644
@@ -0,0 +1,27 @@
+From 0c1a96814ac70ae59905cfbb013c3d6e3147b703 Mon Sep 17 00:00:00 2001
+From: Andri Yngvason <andri@yngvason.is>
+Date: Thu, 30 Jul 2026 10:35:25 +0000
+Subject: [PATCH 3/4] stream: ws: handshake: Fix crypto_hash_many argument
+ mixup
+
+This fixes mistake in f97805deaaea489a1c8c851324163a92a3125195.
+
+Upstream-Status: Backport [https://github.com/any1/neatvnc/commit/8e0d226064d0]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+---
+ src/stream/ws/handshake.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/stream/ws/handshake.c b/src/stream/ws/handshake.c
+index aa0db3f9f2c2..9cb6f1c58856 100644
+--- a/src/stream/ws/handshake.c
++++ b/src/stream/ws/handshake.c
+@@ -79,7 +79,7 @@ ssize_t ws_handshake(char* output, size_t output_maxlen, const char* input)
+ goto failure;
+
+ uint8_t hash[20];
+- crypto_hash_many(hash, sizeof(hash), (struct crypto_data_entry[]){
++ crypto_hash_many(hash, CRYPTO_HASH_SHA1, (struct crypto_data_entry[]){
+ { (uint8_t*)challenge, strlen(challenge) },
+ { (uint8_t*)magic_uuid, strlen(magic_uuid) },
+ {}
new file mode 100644
@@ -0,0 +1,29 @@
+From 556ea1d187a70c08c99d0871c8920e3f7874664f Mon Sep 17 00:00:00 2001
+From: Chad Voegele <chad@voegele.me>
+Date: Thu, 11 Jun 2026 12:41:03 +0000
+Subject: [PATCH 4/4] crypto: fix base16 decode buffer length
+
+Upstream-Status: Backport [https://github.com/any1/neatvnc/commit/8057ec4ad673]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+---
+ src/crypto/nettle/key.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/crypto/nettle/key.c b/src/crypto/nettle/key.c
+index 3b69de259436..45e53187fc22 100644
+--- a/src/crypto/nettle/key.c
++++ b/src/crypto/nettle/key.c
+@@ -91,7 +91,7 @@ static void initialise_p(mpz_t p)
+ "15728E5A8AACAA68FFFFFFFFFFFFFFFF";
+
+ char buf[256];
+- size_t len = 0;
++ size_t len = sizeof(buf);
+ struct base16_decode_ctx ctx;
+ nettle_base16_decode_init(&ctx);
+ nettle_base16_decode_update(&ctx, &len, (uint8_t*)buf, sizeof(s) - 1, s);
+@@ -174,4 +174,3 @@ struct crypto_key* crypto_derive_shared_secret(
+
+ return shared;
+ }
+-
@@ -4,7 +4,12 @@ HOMEPAGE = "https://github.com/any1/neatvnc"
LICENSE = "ISC"
LIC_FILES_CHKSUM = "file://COPYING;md5=94fc374e7174f41e3afe0f027ee59ff7"
-SRC_URI = "git://github.com/any1/neatvnc;branch=v1.0;protocol=https;tag=v${PV}"
+SRC_URI = "git://github.com/any1/neatvnc;branch=v1.0;protocol=https;tag=v${PV} \
+ file://0001-Use-nettle-hogweed-version-4.patch \
+ file://0002-crypto-Remove-hash-digest-size-argument.patch \
+ file://0003-stream-ws-handshake-Fix-crypto_hash_many-argument-mi.patch \
+ file://0004-crypto-fix-base16-decode-buffer-length.patch \
+ "
SRCREV = "ffce32d6d04e702d5d8055e28e038c7f68a0caf4"
neatvnc 1.0.4's nettle backend does not build against nettle 4.0, which oe-core now has. Upstream has ported it, and fixed two crashes the port introduced: the WebSocket handshake passed the hash size where the hash type belongs (a SIGSEGV on every connection), and nettle 4 aborts the Apple Diffie-Hellman login because base16_decode_update() now takes the output buffer's size. None of this is in a release yet. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> --- .../0001-Use-nettle-hogweed-version-4.patch | 83 +++++++++ ...pto-Remove-hash-digest-size-argument.patch | 160 ++++++++++++++++++ ...ake-Fix-crypto_hash_many-argument-mi.patch | 27 +++ ...ypto-fix-base16-decode-buffer-length.patch | 29 ++++ .../recipes-graphics/neatvnc/neatvnc_1.0.4.bb | 7 +- 5 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-graphics/neatvnc/neatvnc/0001-Use-nettle-hogweed-version-4.patch create mode 100644 meta-oe/recipes-graphics/neatvnc/neatvnc/0002-crypto-Remove-hash-digest-size-argument.patch create mode 100644 meta-oe/recipes-graphics/neatvnc/neatvnc/0003-stream-ws-handshake-Fix-crypto_hash_many-argument-mi.patch create mode 100644 meta-oe/recipes-graphics/neatvnc/neatvnc/0004-crypto-fix-base16-decode-buffer-length.patch