path: root/sha1dc_git.c
diff options
authorTakashi Iwai <>2017-08-15 12:04:17 (GMT)
committerJunio C Hamano <>2017-08-16 21:44:25 (GMT)
commit3964cbbb5c30609ebd795a979074251cf59436c3 (patch)
tree28229c037201ab52741cefa13fb4756d5054ae7d /sha1dc_git.c
parent36f048c5e488005da0a9dfba6b617c7c9951c7cf (diff)
sha1dc: allow building with the external sha1dc library
Some distros provide SHA1 collision-detect code as a shared library. It's the same code as we have in git tree (but may be with a different init default for hash), and git can link with it as well; at least, it may make maintenance easier, according to our security guys. This patch allows user to build git linking with the external sha1dc library instead of the built-in code. User needs to define DC_SHA1_EXTERNAL explicitly. As default without it, the built-in sha1dc code is used like before. Signed-off-by: Takashi Iwai <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'sha1dc_git.c')
1 files changed, 11 insertions, 0 deletions
diff --git a/sha1dc_git.c b/sha1dc_git.c
index 7946641..e0cc9d9 100644
--- a/sha1dc_git.c
+++ b/sha1dc_git.c
@@ -1,5 +1,16 @@
#include "cache.h"
+ * Same as SHA1DCInit, but with default save_hash=0
+ */
+void git_SHA1DCInit(SHA1_CTX *ctx)
+ SHA1DCInit(ctx);
+ SHA1DCSetSafeHash(ctx, 0);
* Same as SHA1DCFinal, but convert collision attack case into a verbose die().