]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support Nettle 4.0 md5_digest API (#2424)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Fri, 29 May 2026 16:08:42 +0000 (16:08 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 30 May 2026 08:47:28 +0000 (08:47 +0000)
    error: no matching function for call to nettle_md5_digest

Nettle v4.x md5_digest() function does not have a length parameter
present in Nettle v3.

configure.ac
include/md5.h

index 6b4cac554f597e5ac5ffa13dc55a00e2eb3b152f..8fa781e4dbe58b51602d29534c62be2e22068b07 100644 (file)
@@ -1022,7 +1022,7 @@ SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
 SQUID_CHECK_LIB_WORKS(nettle,[
   PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[
     CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
-    AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h)
+    AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h nettle/version.h)
   ],[:])
 ])
 
index 8b52ab493855cb2963cc8e9e701a8688b816022c..907d40c21f8b47fff6ef39b93bb07d57bd2542b3 100644 (file)
 #if HAVE_NETTLE_MD5_H
 #include <nettle/md5.h>
 
+#if HAVE_NETTLE_VERSION_H
+#include <nettle/version.h>
+#endif
+
 typedef struct md5_ctx SquidMD5_CTX;
 
 #define SquidMD5Init(c)       md5_init((c))
 #define SquidMD5Update(c,b,l) md5_update((c), (l), (const uint8_t *)(b))
+
+#if NETTLE_VERSION_MAJOR >= 4
+#define SquidMD5Final(d,c)    md5_digest((c), (uint8_t *)(d))
+#else
 #define SquidMD5Final(d,c)    md5_digest((c), MD5_DIGEST_SIZE, (uint8_t *)(d))
+#endif
 
 #define SQUID_MD5_DIGEST_LENGTH MD5_DIGEST_SIZE