convert: add SAFE_CRLF_KEEP_CRLF
[alt-git.git] / sha1dc_git.c
blob4d32b4f77e042f0da2b5181f753d0933ad438567
1 /*
2 * This code is included at the end of sha1dc/sha1.c with the
3 * SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C macro.
4 */
6 void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
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));
14 void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
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;
23 SHA1DCUpdate(ctx, data, len);