THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

39 lignes
889 B

  1. #include "cache.h"
  2. #ifdef DC_SHA1_EXTERNAL
  3. /*
  4. * Same as SHA1DCInit, but with default save_hash=0
  5. */
  6. void git_SHA1DCInit(SHA1_CTX *ctx)
  7. {
  8. SHA1DCInit(ctx);
  9. SHA1DCSetSafeHash(ctx, 0);
  10. }
  11. #endif
  12. /*
  13. * Same as SHA1DCFinal, but convert collision attack case into a verbose die().
  14. */
  15. void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
  16. {
  17. if (!SHA1DCFinal(hash, ctx))
  18. return;
  19. die("SHA-1 appears to be part of a collision attack: %s",
  20. hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1]));
  21. }
  22. /*
  23. * Same as SHA1DCUpdate, but adjust types to match git's usual interface.
  24. */
  25. void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
  26. {
  27. const char *data = vdata;
  28. /* We expect an unsigned long, but sha1dc only takes an int */
  29. while (len > INT_MAX) {
  30. SHA1DCUpdate(ctx, data, INT_MAX);
  31. data += INT_MAX;
  32. len -= INT_MAX;
  33. }
  34. SHA1DCUpdate(ctx, data, len);
  35. }