Commit Diff


commit - 40d5394383d9283d2c0b04b41ba26bb6e2105a9e
commit + d9b944c72df6401d9aa2cdf40a196bb1b6066113
blob - be26d081db0ae9ef990cfe3fafadbd46337b736e
blob + dad5fcb98cc7b3a2dc39d03f637954f92afe40b3
--- .github/README.md
+++ .github/README.md
@@ -21,9 +21,7 @@ DEPENDENCIES
 Linux:
 
 * `libncurses` (for tog(1))
-* `libmd` (BSD's digest routines)
 * `libbsd` (BSD's arc4random routines)
-* `libcrypto` (often via 'libssl-dev' for SHA1 routines)
 * `libuuid` (for UUID generation)
 * `libz` (for Z compression)
 * `pkg-config` (for searching libraries)
blob - c612b7e2cdf7dea489c8e26de1b168b5d2958a1a
blob + 981a29186eea0c1f61680ed8b09cc15f74a8b751
--- .github/ci/before-install.sh
+++ .github/ci/before-install.sh
@@ -7,7 +7,6 @@ if [ "$CIRRUS_OS" = "linux" ]; then
 				libncurses5-dev \
 				pkg-config \
 				build-essential \
-				libmd-dev \
 				libssl-dev \
 				libbsd-dev \
 				libevent-dev \
blob - 06090a1df9cf568ce45b18b1094ccd331ed26ae3
blob + e0e9d23e0c2104f89033c503dd06d89e2ee67007
--- README.portable
+++ README.portable
@@ -18,9 +18,7 @@ DEPENDENCIES
 Linux:
 
 * `libncurses` (for tog(1))
-* `libmd` (BSD's digest routines)
 * `libbsd` (BSD's arc4random routines)
-* `libcrypto` (often via 'libssl-dev' for SHA1 routines)
 * `libuuid` (for UUID generation)
 * `libz` (for Z compression)
 * `pkg-config` (for searching libraries)
blob - 74bf0048c37b744fb7da933a0adcd8fd7b57117c
blob + 4d5435146b078dba61a63b7037b38b5338634cb7
--- configure.ac
+++ configure.ac
@@ -59,6 +59,7 @@ fi
 AC_CHECK_HEADERS([ \
 	fcntl.h \
 	langinfo.h \
+	libutil.h \
 	limits.h \
 	linux/landlock.h \
 	locale.h \
@@ -78,6 +79,7 @@ AC_CHECK_HEADERS([ \
 	sys/param.h \
 	sys/poll.h \
 	sys/queue.h \
+	sys/select.h \
 	sys/socket.h \
 	sys/time.h \
 	sys/tree.h \
@@ -86,23 +88,57 @@ AC_CHECK_HEADERS([ \
 	wchar.h \
 ])
 
+AC_HEADER_DIRENT
+AC_CHECK_DECL([F_CLOSEM],
+	      HAVE_FCNTL_CLOSEM
+	      AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
+			[Use F_CLOSEM fcntl for closefrom]),
+			[],
+			[#include <limits.h>
+			 #include <fcntl.h>
+			]
+)
+
+AC_MSG_CHECKING([for /proc/pid/fd directory])
+if test -d "/proc/$$/fd" ; then
+	AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
+	AC_MSG_RESULT([yes])
+else
+	AC_MSG_RESULT([no])
+fi
+
+AC_MSG_CHECKING([whether program_invocation_short_name is defined])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+	#include <argp.h>
+]], [[
+	program_invocation_short_name = "test";
+]])], [
+	AC_MSG_RESULT([yes])
+	AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
+		[Define if program_invocation_short_name is defined])
+], [
+	AC_MSG_RESULT([no])
+])
+
+# Look for prctl(PR_SET_NAME).
+AC_CHECK_DECL(
+	[PR_SET_NAME],
+	[AC_DEFINE([HAVE_PR_SET_NAME], [1], [Define if PR_SET_NAME is defined])],
+	[],
+	[#include <sys/prctl.h>]
+)
+
 AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
 
-# Check for SHA1_DIGEST_LENGTH
-AC_CHECK_DECL([SHA1_DIGEST_LENGTH],
-	[AC_DEFINE([HAVE_SHA1_AS_SHA1], [1], [SHA support is using SHA1])],
-	[
-		dnl maybe sha.h is available
-		AC_CHECK_DECL([SHA_DIGEST_LENGTH],
-			[AC_DEFINE([HAVE_SHA_AS_SHA1], [1],
-				   [SHA support is using SHA])],
-			[],
-			[#include <sha.h>])
-	],
-	[
-	#include <sys/types.h>
-	#include <sha1.h>
-	])
+AC_CHECK_MEMBERS([struct pollfd.fd], [], [], [[
+#include <sys/types.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
+#include <sys/poll.h>
+#endif
+]])
 
 # Checks for typ edefs, structures, and compiler characteristics.
 AC_CHECK_HEADER_STDBOOL
@@ -163,6 +199,9 @@ AC_FUNC_REALLOC
 AC_FUNC_STRERROR_R
 AC_FUNC_STRNLEN
 AC_CHECK_FUNCS([ \
+	SHA256Update \
+	SHA384Update \
+	SHA512Update \
 	dup2 \
 	flock \
 	getcwd \
@@ -194,12 +233,15 @@ AC_CHECK_FUNCS([ \
 	strstr \
 	strtol \
 	strtoul \
+	sysconf \
 	wcwidth \
 ])
 
 AM_CONDITIONAL([HAVE_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" = xyes])
-AM_CONDITIONAL([HAVE_SETRESGID], [test "x$ac_cv_func_setresgid" = xyes])
-AM_CONDITIONAL([HAVE_SETRESUID], [test "x$ac_cv_func_setresuid" = xyes])
+
+if test "x$ac_cv_func_sysconf" = xyes; then
+	AC_DEFINE([HAVE_SYSCONF], [1], [Define to 1 if sysconf() present])
+fi
 
 # Siphash support.
 AC_CHECK_FUNCS([SipHash])
@@ -220,6 +262,7 @@ AC_REPLACE_FUNCS([ \
 	strlcat \
 	strlcpy \
 	strndup \
+	strnlen \
 	strsep \
 	strtonum \
 ])
@@ -412,11 +455,9 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM(
 AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
 AM_CONDITIONAL([HAVE_IMSG], [test "x$found_imsg_init" = "xyes"])
 if test "x$found_imsg_init" = "xyes"; then
+	AC_DEFINE([HAVE_IMSG], [1], [Define to 1 if imsg is declared in libutil])
 	libutil_LIBS="$ac_cv_search_imsg_init"
 	AC_SUBST(libutil_LIBS)
-else
-	AC_LIBOBJ(imsg)
-	AC_LIBOBJ(imsg-buffer)
 fi
 
 # libevent (for gotwebd).  Lifted from tmux.
@@ -479,26 +520,6 @@ fi
 
 if test "x$found_libevent" = xno; then
 	AC_MSG_ERROR("libevent not found")
-fi
-
-# libcrypto (via libssl for SHA information)
-PKG_CHECK_MODULES(
-	LIBCRYPTO,
-	libcrypto,
-	[
-		libcrypto_CFLAGS="$LIBCRYPTO_CORE_CFLAGS"
-		libcrypto_LIBS="$LIBCRYPTO_LIBS"
-		AC_SUBST(libcrypto_CFLAGS)
-		AC_SUBST(libcrypto_LIBS)
-		found_libcrypto=yes
-	],
-	[
-	 	found_libcrypto=no
-	]
-)
-
-if test "x$found_libcrypto" = "xyes"; then
-	AC_DEFINE([HAVE_LIBCRYPTO], [1], [libcrypto])
 fi
 
 AC_CHECK_FUNC([uuid_create], [found_uuid=yes], [found_uuid=no])
@@ -564,19 +585,6 @@ fi
 
 if test "$PLATFORM" = "linux"; then
 	PKG_CHECK_MODULES(
-		LIBMD,
-		libmd,
-		[
-			libmd_CFLAGS="$LIBMD_CFLAGS"
-			libmd_LIBS="$LIBMD_LIBS"
-			AC_SUBST(libmd_CFLAGS)
-			AC_SUBST(libmd_LIBS)
-		],
-		[
-			AC_MSG_ERROR("*** couldn't find libmd via pkg-config")
-		]
-	)
-	PKG_CHECK_MODULES(
 		LIBBSD,
 		libbsd-overlay,
 		[
blob - 1c15d7ae3f47aa1f84dc41b33db1978bcb41aa6d
blob + 00dcf879b5bf73d17a7cb2b944f71ea6763a4ad2
--- include/got_compat2.h
+++ include/got_compat2.h
@@ -216,10 +216,10 @@ typedef struct _SHA2_CTX {
 #endif
 
 #ifndef __APPLE__
-#ifdef HAVE_SHA_AS_SHA1
+#ifdef HAVE_SHA_H
 #  include <sha.h>
 #endif
-#ifdef HAVE_SHA1_AS_SHA1
+#ifdef HAVE_SHA1_H
 #      include <sha1.h>
 #endif
 #ifdef HAVE_SHA2_H
blob - d3e15704eff350d9b4d1e84aae6c744a1c3f1f50
blob + f42a90c04863d0eab79b0081e400a893398b95c3
--- libexec/got-fetch-pack/Makefile.am
+++ libexec/got-fetch-pack/Makefile.am
@@ -18,9 +18,9 @@ got_fetch_pack_SOURCES = \
 got_fetch_pack_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
 
 LDADD = -L$(top_builddir)/compat -lopenbsd-compat
-LDADD += $(zlib_LIBS) $(libbsd_LIBS) $(libutil_LIBS) $(libcrypto_LIBS)
+LDADD += $(zlib_LIBS) $(libbsd_LIBS)
 if HOST_FREEBSD
 LDADD += -lmd
 endif
 
-AM_CPPFLAGS += $(zlib_CFLAGS) $(libbsd_CFLAGS) $(libcrypto_CFLAGS)
+AM_CPPFLAGS += $(zlib_CFLAGS) $(libbsd_CFLAGS)
blob - 63dce0af78fc0d4bad7b4c00ac61e3e82e915df7
blob + 33229996cb6bb8c8db24c52a6631b833be22b3a5
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/types.h>
 #include <sys/queue.h>
@@ -32,8 +34,6 @@
 #include <unistd.h>
 #include <zlib.h>
 #include <err.h>
-
-#include "got_compat.h"
 
 #include "got_error.h"
 #include "got_object.h"