Skip to content

Commit e6b07da

Browse files
committed
Makefile: make DC_SHA1 the default
We used to use the SHA1 implementation from the OpenSSL library by default. As we are trying to be careful against collision attacks after the recent "shattered" announcement, switch the default to encourage people to use DC_SHA1 implementation instead. Those who want to use the implementation from OpenSSL can explicitly ask for it by OPENSSL_SHA1=YesPlease when running "make". Signed-off-by: Junio C Hamano <[email protected]>
1 parent f5f5e7f commit e6b07da

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ all::
146146
# algorithm. This is slower, but may detect attempted collision attacks.
147147
# Takes priority over other *_SHA1 knobs.
148148
#
149+
# Define OPENSSL_SHA1 environment variable when running make to link
150+
# with the SHA1 routine from openssl library.
151+
#
149152
# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
150153
# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
151154
# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
@@ -1390,10 +1393,9 @@ ifdef APPLE_COMMON_CRYPTO
13901393
SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
13911394
endif
13921395

1393-
ifdef DC_SHA1
1394-
LIB_OBJS += sha1dc/sha1.o
1395-
LIB_OBJS += sha1dc/ubc_check.o
1396-
BASIC_CFLAGS += -DSHA1_DC
1396+
ifdef OPENSSL_SHA1
1397+
EXTLIBS += $(LIB_4_CRYPTO)
1398+
BASIC_CFLAGS += -DSHA1_OPENSSL
13971399
else
13981400
ifdef BLK_SHA1
13991401
LIB_OBJS += block-sha1/sha1.o
@@ -1407,8 +1409,10 @@ ifdef APPLE_COMMON_CRYPTO
14071409
COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
14081410
BASIC_CFLAGS += -DSHA1_APPLE
14091411
else
1410-
EXTLIBS += $(LIB_4_CRYPTO)
1411-
BASIC_CFLAGS += -DSHA1_OPENSSL
1412+
DC_SHA1 := YesPlease
1413+
LIB_OBJS += sha1dc/sha1.o
1414+
LIB_OBJS += sha1dc/ubc_check.o
1415+
BASIC_CFLAGS += -DSHA1_DC
14121416
endif
14131417
endif
14141418
endif

0 commit comments

Comments
 (0)