Commit Diff


commit - 8d2e954c7b9ef33d7c66d022729aa30d16e2aa84
commit + 4c2c912121116761d73fbb528b89d7dc65aa3d32
blob - 85388401d79a99a4c57efd98b3b0248899f82379
blob + 6a3a18faaabe47a9862b32e195875fbf9e8f139d
--- configure.ac
+++ configure.ac
@@ -151,7 +151,8 @@ AC_CHECK_DECL(
 	[#include <sys/prctl.h>]
 )
 
-AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes])
+AM_CONDITIONAL([HAVE_SHA2], [test "x$ac_cv_header_sha2_h" = xyes || \
+	test "x$ac_cv_header_sha256_h" = xyes])
 
 AC_CACHE_CHECK([whether getopt has optreset support],
 		ac_cv_have_getopt_optreset, [
blob - 1fb7f5aa239b2f0e1d8ad7b472878d612d9c446a
blob + 23e55e160026e0f10989876b0bbe7f97bc3e1804
--- include/got_compat2.h
+++ include/got_compat2.h
@@ -211,22 +211,13 @@ void uuid_to_string(uuid_t *, char **, uint32_t *);
 #if defined(__APPLE__)
 #define COMMON_DIGEST_FOR_OPENSSL
 #include <CommonCrypto/CommonDigest.h>
-
-#define SHA512_BLOCK_LENGTH		128
-typedef struct _SHA2_CTX {
-	union {
-		u_int32_t	st32[8];
-		u_int64_t	st64[8];
-	} state;
-	u_int64_t	bitcount[2];
-	u_int8_t	buffer[SHA512_BLOCK_LENGTH];
-} SHA2_CTX;
 #endif
 
-#if defined(__APPLE__) || defined(__NetBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
 #define SHA256Init SHA256_Init
 #define SHA256Update SHA256_Update
 #define SHA256Final SHA256_Final
+#define SHA2_CTX SHA256_CTX
 #endif
 
 #ifndef __APPLE__
@@ -238,8 +229,6 @@ typedef struct _SHA2_CTX {
 #endif
 #ifdef HAVE_SHA2_H
 #    include <sha2.h>
-#else
-#    include "sha2.h"
 #endif
 #ifdef HAVE_SHA256_H
 #    include <sha256.h>