]> git.ipfire.org Git - thirdparty/git.git/blob - sha1dc_git.c
is_ntfs_dotgit(): only verify the leading segment
[thirdparty/git.git] / sha1dc_git.c
1 /*
2 * This code is included at the end of sha1dc/sha1.c with the
3 * SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C macro.
4 */
5
6 void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
7 {
8 if (!SHA1DCFinal(hash, ctx))
9 return;
10 die("SHA-1 appears to be part of a collision attack: %s",
11 sha1_to_hex(hash));
12 }
13
14 void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
15 {
16 const char *data = vdata;
17 /* We expect an unsigned long, but sha1dc only takes an int */
18 while (len > INT_MAX) {
19 SHA1DCUpdate(ctx, data, INT_MAX);
20 data += INT_MAX;
21 len -= INT_MAX;
22 }
23 SHA1DCUpdate(ctx, data, len);
24 }