From: Amos Jeffries Date: Thu, 29 Feb 2024 05:11:03 +0000 (+0000) Subject: Maintenance: update --with-nettle detection (#1708) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=deb19890f8fd3401b5e73d6862bdda2e445aeef7;p=thirdparty%2Fsquid.git Maintenance: update --with-nettle detection (#1708) 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. --- diff --git a/acinclude/nettle.m4 b/acinclude/nettle.m4 deleted file mode 100644 index 1532ec2e85..0000000000 --- a/acinclude/nettle.m4 +++ /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 -# include -# include - ]],[[ - 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) -]) diff --git a/configure.ac b/configure.ac index 1658fabf39..1122c774de 100644 --- a/configure.ac +++ b/configure.ac @@ -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) ]) diff --git a/include/base64.h b/include/base64.h index 182ef324d1..a5b6d38311 100644 --- a/include/base64.h +++ b/include/base64.h @@ -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 #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 */ diff --git a/lib/base64.c b/lib/base64.c index 2f177820d2..98f6b77b45 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -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 */