]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: add options to disable SHA-512/256 hash algo
authorViktor Szakats <commit@vsz.me>
Sun, 1 Sep 2024 14:25:49 +0000 (16:25 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 1 Sep 2024 20:13:49 +0000 (22:13 +0200)
Existing C macro lacked build-level counterparts.
Add them in this patch.

- cmake: `-DCURL_DISABLE_SHA512_256=ON`
- autotools: `--disable-sha512-256`

Also drop the checker exception from `test1165.pl`.

Follow-up to cbe41d151d6a100c1f045eaf37ff06b2b2a7b382 #12897
Closes #14753

CMakeLists.txt
configure.ac
docs/CURL-DISABLE.md
lib/curl_config.h.cmake
tests/test1165.pl

index 3f639e94eb343d03dd45d3f76114cad07728f538..6bd2144186242c0a8307b778dcc530de4a361686 100644 (file)
@@ -314,6 +314,8 @@ mark_as_advanced(CURL_DISABLE_PROGRESS_METER)
 option(CURL_DISABLE_PROXY "Disable proxy support" OFF)
 mark_as_advanced(CURL_DISABLE_PROXY)
 option(CURL_DISABLE_RTSP "Disable RTSP" OFF)
+mark_as_advanced(CURL_DISABLE_SHA512_256)
+option(CURL_DISABLE_SHA512_256 "Disable SHA-512/256 hash algorithm" OFF)
 mark_as_advanced(CURL_DISABLE_RTSP)
 option(CURL_DISABLE_SHUFFLE_DNS "Disable shuffle DNS feature" OFF)
 mark_as_advanced(CURL_DISABLE_SHUFFLE_DNS)
index 4e71d5821a7a17bf594e648e07bc139caf4c4e40..6db5e6b5aff580797637bdafde6a4ab00f4767d1 100644 (file)
@@ -4646,6 +4646,25 @@ AS_HELP_STRING([--disable-progress-meter],[Disable progress-meter]),
     AC_MSG_RESULT(yes)
 )
 
+dnl ************************************************************
+dnl disable SHA-512/256 hash algorithm
+dnl
+AC_MSG_CHECKING([whether to support the SHA-512/256 hash algorithm])
+AC_ARG_ENABLE(sha512-256,
+AS_HELP_STRING([--enable-sha512-256],[Enable SHA-512/256 hash algorithm (default)])
+AS_HELP_STRING([--disable-sha512-256],[Disable SHA-512/256 hash algorithm]),
+[ case "$enableval" in
+  no)
+    AC_MSG_RESULT(no)
+    AC_DEFINE(CURL_DISABLE_SHA512_256, 1, [disable SHA-512/256 hash algorithm])
+    ;;
+  *)
+    AC_MSG_RESULT(yes)
+    ;;
+  esac ],
+    AC_MSG_RESULT(yes)
+)
+
 dnl ************************************************************
 dnl disable shuffle DNS support
 dnl
index 3409bec0183f6a6a7f12ecd83f340f25f7c3f8ae..6080851dd5e280b861ff73f632183f7e09d3489b 100644 (file)
@@ -144,6 +144,10 @@ Disable support for proxies
 
 Disable the RTSP protocol.
 
+## `CURL_DISABLE_SHA512_256`
+
+Disable the SHA-512/256 hash algorithm.
+
 ## `CURL_DISABLE_SHUFFLE_DNS`
 
 Disable the shuffle DNS feature
index cba9984552740c3090fa55e3e93c84f554022d72..0a895aaa6ec89dff84259fbfdb4a4e1b28ca7ab1 100644 (file)
 /* disables RTSP */
 #cmakedefine CURL_DISABLE_RTSP 1
 
+/* disables SHA-512/256 hash algorithm */
+#cmakedefine CURL_DISABLE_SHA512_256 1
+
 /* disabled shuffle DNS feature */
 #cmakedefine CURL_DISABLE_SHUFFLE_DNS 1
 
index d26a97f733f1734e4c49cbf13a213a6933639604..621a93537ea3a8db54a7e8e592a9621da1fbcf43 100755 (executable)
@@ -93,9 +93,7 @@ sub scan_file {
     while(<F>) {
         while(s/(CURL_DISABLE_[A-Z0-9_]+)//) {
             my ($sym)=($1);
-            if(not $sym =~ /^(CURL_DISABLE_SHA512_256)/) { # Skip this symbol, to be implemented
-                $file{$sym} = $source;
-            }
+            $file{$sym} = $source;
         }
     }
     close F;