summaryrefslogtreecommitdiff
path: root/sha1dc_git.c
diff options
context:
space:
mode:
authorLibravatar Takashi Iwai <tiwai@suse.de>2017-08-15 14:04:16 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-08-16 14:43:59 -0700
commit36f048c5e488005da0a9dfba6b617c7c9951c7cf (patch)
treeee859ed5ef5bfb9358967e87ce69a1f8ba84856a /sha1dc_git.c
parentGit 2.14-rc1 (diff)
downloadtgif-36f048c5e488005da0a9dfba6b617c7c9951c7cf.tar.xz
sha1dc: build git plumbing code more explicitly
The plumbing code between sha1dc and git is defined in sha1dc_git.[ch], but these aren't compiled / included directly but only via the indirect inclusion from sha1dc code. This is slightly confusing when you try to trace the build flow. This patch brings the following changes for simplification: - Make sha1dc_git.c stand-alone and build from Makefile - sha1dc_git.h is the common header to include further sha1.h depending on the build condition - Move comments for plumbing codes from the header to definitions This is also meant as a preliminary work for further plumbing with external sha1dc shlib. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1dc_git.c')
-rw-r--r--sha1dc_git.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sha1dc_git.c b/sha1dc_git.c
index 4d32b4f77e..79466414f8 100644
--- a/sha1dc_git.c
+++ b/sha1dc_git.c
@@ -1,8 +1,8 @@
+#include "cache.h"
+
/*
- * This code is included at the end of sha1dc/sha1.c with the
- * SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C macro.
+ * Same as SHA1DCFinal, but convert collision attack case into a verbose die().
*/
-
void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
{
if (!SHA1DCFinal(hash, ctx))
@@ -11,6 +11,9 @@ void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
sha1_to_hex(hash));
}
+/*
+ * Same as SHA1DCUpdate, but adjust types to match git's usual interface.
+ */
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
{
const char *data = vdata;