]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: update --with-nettle detection (#1708)
authorAmos Jeffries <yadij@users.noreply.github.com>
Thu, 29 Feb 2024 05:11:03 +0000 (05:11 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 29 Feb 2024 19:00:28 +0000 (19:00 +0000)
Update to latest pkg-config requirement and
usage style.

Fix bug with header detect when library is
located in a custom location.

Drop outdated base64 API compatability check
not needed with Nettle 3.4 or later.

acinclude/nettle.m4 [deleted file]
configure.ac
include/base64.h
lib/base64.c

diff --git a/acinclude/nettle.m4 b/acinclude/nettle.m4
deleted file mode 100644 (file)
index 1532ec2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-## Copyright (C) 1996-2023 The Squid Software Foundation and contributors
-##
-## Squid software is distributed under GPLv2+ license and includes
-## contributions from numerous individuals and organizations.
-## Please see the COPYING and CONTRIBUTORS files for details.
-##
-
-dnl check whether libnettle Base64 uses the nettle 3.4 API
-dnl which matters on 64-bit systems
-dnl Defines HAVE_NETTLE34_BASE64 based on the result
-dnl
-AC_DEFUN([SQUID_CHECK_NETTLE_BASE64],[
-  AC_CHECK_HEADERS(nettle/base64.h)
-  AC_MSG_CHECKING([for Nettle 3.4 API compatibility])
-  AH_TEMPLATE(HAVE_NETTLE34_BASE64,[set to 1 if Nettle 3.4 API will link])
-  SQUID_STATE_SAVE(squid_nettle_base64_state)
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#   include <cstddef>
-#   include <cstdint>
-#   include <nettle/base64.h>
-  ]],[[
-    char inData[10]; inData[0] = '\0';
-    size_t srcLen = 0;
-    struct base64_decode_ctx ctx;
-    base64_decode_init(&ctx);
-    uint8_t outData[10];
-    size_t dstLen = 0;
-    if (!base64_decode_update(&ctx, &dstLen, outData, srcLen, inData) ||
-            !base64_decode_final(&ctx)) {
-        return 1;
-    }
-  ]])],[AC_MSG_RESULT(yes)
-    AC_DEFINE(HAVE_NETTLE34_BASE64,1,[set to 1 if Nettle 3.4 API will link])
-  ],[AC_MSG_RESULT(no)])
-  SQUID_STATE_ROLLBACK(squid_nettle_base64_state)
-])
index 1658fabf39419971460e18b6d87f89e9ac5228c4..1122c774de604e692e229478c02373472e759e35 100644 (file)
@@ -22,7 +22,6 @@ m4_include([acinclude/compiler-flags.m4])
 m4_include([acinclude/os-deps.m4])
 m4_include([acinclude/krb5.m4])
 m4_include([acinclude/ldap.m4])
-m4_include([acinclude/nettle.m4])
 m4_include([acinclude/pam.m4])
 m4_include([acinclude/pkg.m4])
 m4_include([acinclude/tdb.m4])
@@ -1059,12 +1058,10 @@ AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
 SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
 SQUID_CHECK_LIB_WORKS(nettle,[
   SQUID_STATE_SAVE(squid_nettle_state)
-  PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[],[
+  PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[
     CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
-    AC_CHECK_LIB(nettle,[nettle_md5_init],[LIBNETTLE_LIBS="-lnettle"])
-  ])
-  AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h)
-  SQUID_CHECK_NETTLE_BASE64
+    AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h)
+  ],[:])
   SQUID_STATE_ROLLBACK(squid_nettle_state)
 ])
 
index 182ef324d19b3129b6ec68e6ef89ff118aab16ba..a5b6d38311f0cdc371de13bc1babc9b6e6a3d89f 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef SQUID_INCLUDE_BASE64_H
 #define SQUID_INCLUDE_BASE64_H
 
-#if HAVE_NETTLE_BASE64_H && HAVE_NETTLE34_BASE64
+#if HAVE_NETTLE_BASE64_H
 #include <nettle/base64.h>
 
 #else /* Base64 functions copied from Nettle 3.4 under GPLv2, with adjustments */
@@ -162,11 +162,11 @@ base64_decode_final(struct base64_decode_ctx *ctx);
 }
 #endif
 
-#endif /* HAVE_NETTLE_BASE64_H && HAVE_NETTLE34_BASE64 */
+#endif /* HAVE_NETTLE_BASE64_H */
 
 /// Calculate the buffer size required to hold the encoded form of
 /// a string of length 'decodedLen' including all terminator bytes.
-#   define base64_encode_len(length) (BASE64_ENCODE_LENGTH(length)+BASE64_ENCODE_FINAL_LENGTH+1)
+#define base64_encode_len(length) (BASE64_ENCODE_LENGTH(length)+BASE64_ENCODE_FINAL_LENGTH+1)
 
 #endif /* SQUID_INCLUDE_BASE64_H */
 
index 2f177820d287124bd58144ab0d594c26107abc5c..98f6b77b453f7cbfd5bcb6e26145ce397e0e2e78 100644 (file)
@@ -13,7 +13,7 @@
 #include "squid.h"
 #include "base64.h"
 
-#if !HAVE_NETTLE_BASE64_H || !HAVE_NETTLE34_BASE64
+#if !HAVE_NETTLE_BASE64_H
 
 /* base64-encode.c
 
@@ -324,5 +324,5 @@ base64_encode_final(struct base64_encode_ctx *ctx,
     return done;
 }
 
-#endif /* !HAVE_NETTLE_BASE64_H || !HAVE_NETTLE34_BASE64 */
+#endif /* !HAVE_NETTLE_BASE64_H */