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 6voidgit_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx) 7{ 8if(!SHA1DCFinal(hash, ctx)) 9return; 10die("SHA-1 appears to be part of a collision attack:%s", 11sha1_to_hex(hash)); 12} 13 14voidgit_SHA1DCUpdate(SHA1_CTX *ctx,const void*vdata,unsigned long len) 15{ 16const char*data = vdata; 17/* We expect an unsigned long, but sha1dc only takes an int */ 18while(len > INT_MAX) { 19SHA1DCUpdate(ctx, data, INT_MAX); 20 data += INT_MAX; 21 len -= INT_MAX; 22} 23SHA1DCUpdate(ctx, data, len); 24}