1#include"cache.h" 2 3/* 4 * Same as SHA1DCFinal, but convert collision attack case into a verbose die(). 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 14/* 15 * Same as SHA1DCUpdate, but adjust types to match git's usual interface. 16 */ 17voidgit_SHA1DCUpdate(SHA1_CTX *ctx,const void*vdata,unsigned long len) 18{ 19const char*data = vdata; 20/* We expect an unsigned long, but sha1dc only takes an int */ 21while(len > INT_MAX) { 22SHA1DCUpdate(ctx, data, INT_MAX); 23 data += INT_MAX; 24 len -= INT_MAX; 25} 26SHA1DCUpdate(ctx, data, len); 27}