diff mbox series

[meta-multimedia,1/2] librtmp: add a patch to fix build with nettle-4

Message ID 20260624133044.1093352-1-f_l_k@t-online.de
State New
Headers show
Series [meta-multimedia,1/2] librtmp: add a patch to fix build with nettle-4 | expand

Commit Message

Markus Volk June 24, 2026, 1:30 p.m. UTC
This was taken from Archlinux:
https://gitlab.archlinux.org/archlinux/packaging/packages/rtmpdump/-/blob/main/nettle-4.patch

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 .../rtmpdump/rtmpdump/nettle-4.patch          | 78 +++++++++++++++++++
 .../rtmpdump/rtmpdump_2.6.bb                  |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump/nettle-4.patch
diff mbox series

Patch

diff --git a/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump/nettle-4.patch b/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump/nettle-4.patch
new file mode 100644
index 0000000000..8850b35d5c
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump/nettle-4.patch
@@ -0,0 +1,78 @@ 
+This patch was taken from Archlinux
+
+Upstream-Status: Inappropriate [https://gitlab.archlinux.org/archlinux/packaging/packages/rtmpdump/-/blob/main/nettle-4.patch]
+
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+
+diff --git a/librtmp/handshake.h b/librtmp/handshake.h
+index ac38c88..53301c7 100644
+--- a/librtmp/handshake.h
++++ b/librtmp/handshake.h
+@@ -45,6 +45,7 @@ typedef arc4_context *	RC4_handle;
+ #elif defined(USE_GNUTLS)
+ #include <nettle/hmac.h>
+ #include <nettle/arcfour.h>
++#include <nettle/version.h>
+ #ifndef SHA256_DIGEST_LENGTH
+ #define SHA256_DIGEST_LENGTH	32
+ #endif
+@@ -52,7 +53,11 @@ typedef arc4_context *	RC4_handle;
+ #define HMAC_CTX	struct hmac_sha256_ctx
+ #define HMAC_setup(ctx, key, len)	hmac_sha256_set_key(&ctx, len, key)
+ #define HMAC_crunch(ctx, buf, len)	hmac_sha256_update(&ctx, len, buf)
++#if NETTLE_VERSION_MAJOR > 3
++#define HMAC_finish(ctx, dig, dlen)	dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, dig)
++#else
+ #define HMAC_finish(ctx, dig, dlen)	dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig)
++#endif
+ #define HMAC_close(ctx)
+ 
+ typedef struct arcfour_ctx*	RC4_handle;
+diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c
+index fc5f824..3ab1d3f 100644
+--- a/librtmp/hashswf.c
++++ b/librtmp/hashswf.c
+@@ -44,6 +44,7 @@
+ #define HMAC_close(ctx)
+ #elif defined(USE_GNUTLS)
+ #include <nettle/hmac.h>
++#include <nettle/version.h>
+ #ifndef SHA256_DIGEST_LENGTH
+ #define SHA256_DIGEST_LENGTH	32
+ #endif
+@@ -51,7 +52,11 @@
+ #define HMAC_CTX	struct hmac_sha256_ctx
+ #define HMAC_setup(ctx, key, len)	hmac_sha256_set_key(&ctx, len, key)
+ #define HMAC_crunch(ctx, buf, len)	hmac_sha256_update(&ctx, len, buf)
++#if NETTLE_VERSION_MAJOR > 3
++#define HMAC_finish(ctx, dig, dlen)	dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, dig)
++#else
+ #define HMAC_finish(ctx, dig, dlen)	dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig)
++#endif
+ #define HMAC_close(ctx)
+ #else	/* USE_OPENSSL */
+ #include <openssl/ssl.h>
+diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
+index cf1de70..a53ed9f 100644
+--- a/librtmp/rtmp.c
++++ b/librtmp/rtmp.c
+@@ -57,6 +57,7 @@ static const char *my_dhm_G = "4";
+ #define MD5_DIGEST_LENGTH 16
+ #include <nettle/base64.h>
+ #include <nettle/md5.h>
++#include <nettle/version.h>
+ #else	/* USE_OPENSSL */
+ #include <openssl/ssl.h>
+ #include <openssl/rc4.h>
+@@ -2492,7 +2493,11 @@ b64enc(const unsigned char *input, int length, char *output, int maxsize)
+ typedef struct md5_ctx	MD5_CTX;
+ #define MD5_Init(ctx)	md5_init(ctx)
+ #define MD5_Update(ctx,data,len)	md5_update(ctx,len,data)
++#if NETTLE_VERSION_MAJOR > 3
++#define MD5_Final(dig,ctx)	md5_digest(ctx,dig)
++#else
+ #define MD5_Final(dig,ctx)	md5_digest(ctx,MD5_DIGEST_LENGTH,dig)
++#endif
+ #else
+ #endif
+ 
diff --git a/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump_2.6.bb b/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump_2.6.bb
index c02b45054f..d6c5886b95 100644
--- a/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump_2.6.bb
+++ b/meta-multimedia/recipes-multimedia/rtmpdump/rtmpdump_2.6.bb
@@ -11,6 +11,7 @@  PV .= "+git"
 SRCREV = "6f6bb1353fc84f4cc37138baa99f586750028a01"
 SRC_URI = " \
     git://git.ffmpeg.org/rtmpdump;branch=master \
+    file://nettle-4.patch \
 "