Skip to content

Commit 88e0118

Browse files
reubenhwkgitster
authored andcommitted
configure.ac: check for HMAC_CTX_cleanup
OpenSSL version 0.9.6b and before defined the function HMAC_cleanup. Newer versions define HMAC_CTX_cleanup. Check for HMAC_CTX_cleanup and fall back to HMAC_cleanup when the newer function is missing. Signed-off-by: Reuben Hawkins <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a6c3c63 commit 88e0118

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ all::
345345
# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
346346
#
347347
# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt.
348+
#
349+
# Define NO_HMAC_CTX_CLEANUP if your OpenSSL is version 0.9.6b or earlier to
350+
# cleanup the HMAC context with the older HMAC_cleanup function.
348351

349352
GIT-VERSION-FILE: FORCE
350353
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1077,6 +1080,9 @@ ifndef NO_OPENSSL
10771080
ifdef NEEDS_CRYPTO_WITH_SSL
10781081
OPENSSL_LIBSSL += -lcrypto
10791082
endif
1083+
ifdef NO_HMAC_CTX_CLEANUP
1084+
BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP
1085+
endif
10801086
else
10811087
BASIC_CFLAGS += -DNO_OPENSSL
10821088
BLK_SHA1 = 1

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,10 @@ AC_CHECK_LIB([iconv], [locale_charset],
947947
[CHARSET_LIB=-lcharset])])
948948
GIT_CONF_SUBST([CHARSET_LIB])
949949
#
950+
# Define NO_HMAC_CTX_CLEANUP=YesPlease if HMAC_CTX_cleanup is missing.
951+
AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup],
952+
[], [GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP], [YesPlease])])
953+
#
950954
# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
951955
GIT_CHECK_FUNC(clock_gettime,
952956
[HAVE_CLOCK_GETTIME=YesPlease],

git-compat-util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ extern char *gitbasename(char *);
214214
#ifndef NO_OPENSSL
215215
#include <openssl/ssl.h>
216216
#include <openssl/err.h>
217+
#ifdef NO_HMAC_CTX_CLEANUP
218+
#define HMAC_CTX_cleanup HMAC_cleanup
219+
#endif
217220
#endif
218221

219222
/* On most systems <netdb.h> would have given us this, but

0 commit comments

Comments
 (0)