]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
configure: check for nettle_memeql_sec()
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 5 May 2025 12:17:26 +0000 (14:17 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 12 May 2025 09:21:06 +0000 (11:21 +0200)
This fixes build with nettle versions before 3.3.

configure
util.c

index eaa41a08f1953ca5fff93226125da888f79699e6..bcd69449bcd01d7f5490ad1361c0d73e101dd7ff 100755 (executable)
--- a/configure
+++ b/configure
@@ -898,6 +898,13 @@ if [ $feat_sechash = "1" ] && [ "x$HASH_LINK" = "x" ]  && [ $try_nettle = "1" ];
       EXTRA_OBJECTS="$EXTRA_OBJECTS cmac_nettle.o"
       EXTRA_CLI_OBJECTS="$EXTRA_CLI_OBJECTS cmac_nettle.o"
     fi
+
+    if test_code 'nettle_memeql_sec()' 'nettle/memops.h' \
+      "$test_cflags" "$test_link" \
+      'return nettle_memeql_sec("", "", 0);'
+    then
+      add_def HAVE_NETTLE_MEMEQL
+    fi
   fi
 fi
 
diff --git a/util.c b/util.c
index b278da697083092af2d213afde83f8d7f205705a..26eaa35f573ed343b2762b39aa764d58951c15e3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -29,7 +29,7 @@
 
 #include "sysincl.h"
 
-#if defined(HAVE_NETTLE)
+#if defined(HAVE_NETTLE_MEMEQL)
 #include <nettle/memops.h>
 #elif defined(HAVE_GNUTLS)
 #include <gnutls/gnutls.h>
@@ -1660,7 +1660,7 @@ UTI_SplitString(char *string, char **words, int max_saved_words)
 int
 UTI_IsMemoryEqual(const void *s1, const void *s2, unsigned int len)
 {
-#if defined(HAVE_NETTLE)
+#if defined(HAVE_NETTLE_MEMEQL)
   return nettle_memeql_sec(s1, s2, len);
 #elif defined(HAVE_GNUTLS)
   return gnutls_memcmp(s1, s2, len) == 0;