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>

Ævar Arnfjörð Bjarmason committed Jul 1, 2017 at 22:05 UTC 86cfd61e6bc12745751c43b4f69886b290cd85cb
4 files changed +21
.gitmodules new
+4
@@ -0,0 +1,4 @@
1 +[submodule "sha1collisiondetection"]
2 + path = sha1collisiondetection
3 + url = https://github.com/cr-marcstevens/sha1collisiondetection.git
4 + branch = master
Makefile
+12
@@ -144,6 +144,12 @@ all::
144 # algorithm. This is slower, but may detect attempted collision attacks.
145 # Takes priority over other *_SHA1 knobs.
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 +#
153 # Define OPENSSL_SHA1 environment variable when running make to link
154 # with the SHA1 routine from openssl library.
155 #
@@ -1412,8 +1418,14 @@ ifdef APPLE_COMMON_CRYPTO
1418 BASIC_CFLAGS += -DSHA1_APPLE
1419 else
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
1426 LIB_OBJS += sha1dc/sha1.o
1427 LIB_OBJS += sha1dc/ubc_check.o
1428 +endif
1429 BASIC_CFLAGS += \
1430 -DSHA1_DC \
1431 -DSHA1DC_NO_STANDARD_INCLUDES \
hash.h
+4
@@ -8,7 +8,11 @@
8 #elif defined(SHA1_OPENSSL)
9 #include <openssl/sha.h>
10 #elif defined(SHA1_DC)
11 +#ifdef DC_SHA1_SUBMODULE
12 +#include "sha1collisiondetection/lib/sha1.h"
13 +#else
14 #include "sha1dc/sha1.h"
15 +#endif
16 #else /* SHA1_BLK */
17 #include "block-sha1/sha1.h"
18 #endif
sha1collisiondetection new
+1
@@ -0,0 +1 @@
1 +Subproject commit 19d97bf5af05312267c2e874ee6bcf584d9e9681