Git fork

sha1dc: optionally use sha1collisiondetection as a submodule

Add an option to use the sha1collisiondetection library from the
submodule in sha1collisiondetection/ instead of in the copy in the
sha1dc/ directory.

This allows us to try out the submodule in sha1collisiondetection
without breaking the build for anyone who's not expecting them as we
work out any kinks.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Ævar Arnfjörð Bjarmason and committed by
Junio C Hamano
86cfd61e 9936c1b5

+20
+4
.gitmodules
··· 1 + [submodule "sha1collisiondetection"] 2 + path = sha1collisiondetection 3 + url = https://github.com/cr-marcstevens/sha1collisiondetection.git 4 + branch = master
+12
Makefile
··· 144 144 # algorithm. This is slower, but may detect attempted collision attacks. 145 145 # Takes priority over other *_SHA1 knobs. 146 146 # 147 + # Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the 148 + # sha1collisiondetection shipped as a submodule instead of the 149 + # non-submodule copy in sha1dc/. This is an experimental option used 150 + # by the git project to migrate to using sha1collisiondetection as a 151 + # submodule. 152 + # 147 153 # Define OPENSSL_SHA1 environment variable when running make to link 148 154 # with the SHA1 routine from openssl library. 149 155 # ··· 1412 1418 BASIC_CFLAGS += -DSHA1_APPLE 1413 1419 else 1414 1420 DC_SHA1 := YesPlease 1421 + ifdef DC_SHA1_SUBMODULE 1422 + LIB_OBJS += sha1collisiondetection/lib/sha1.o 1423 + LIB_OBJS += sha1collisiondetection/lib/ubc_check.o 1424 + BASIC_CFLAGS += -DDC_SHA1_SUBMODULE 1425 + else 1415 1426 LIB_OBJS += sha1dc/sha1.o 1416 1427 LIB_OBJS += sha1dc/ubc_check.o 1428 + endif 1417 1429 BASIC_CFLAGS += \ 1418 1430 -DSHA1_DC \ 1419 1431 -DSHA1DC_NO_STANDARD_INCLUDES \
+4
hash.h
··· 8 8 #elif defined(SHA1_OPENSSL) 9 9 #include <openssl/sha.h> 10 10 #elif defined(SHA1_DC) 11 + #ifdef DC_SHA1_SUBMODULE 12 + #include "sha1collisiondetection/lib/sha1.h" 13 + #else 11 14 #include "sha1dc/sha1.h" 15 + #endif 12 16 #else /* SHA1_BLK */ 13 17 #include "block-sha1/sha1.h" 14 18 #endif