-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sha1dc from the latest version by the upstream maintainer[1]. This version includes a commit of mine which allows for replacing the local modifications done to the upstream files in git.git with macro definitions to monkeypatch it in place. It also brings in a change[2] upstream made for the breakage 2.13.0 introduced on SPARC and other platforms that forbid unaligned access[3]. This means that the code customizations done since the initial import in commit 28dc98e ("sha1dc: add collision-detecting sha1 implementation", 2017-03-16) can be done purely via Makefile definitions and by including the content of our own sha1dc_git.[ch] in sha1dc/sha1.c via a macro. 1. cr-marcstevens/sha1collisiondetection@cc46554 2. cr-marcstevens/sha1collisiondetection@33a694a 3. "Git 2.13.0 segfaults on Solaris SPARC due to DC_SHA1=YesPlease being on by default" (https://public-inbox.org/git/CACBZZX6nmKK8af0-UpjCKWV4R+hV-uk2xWXVA5U+_UQ3VXU03g@mail.gmail.com/) Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
- Loading branch information
Showing
7 changed files
with
172 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* This code is included at the end of sha1dc/sha1.c with the | ||
* SHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C macro. | ||
*/ | ||
|
||
void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx) | ||
{ | ||
if (!SHA1DCFinal(hash, ctx)) | ||
return; | ||
die("SHA-1 appears to be part of a collision attack: %s", | ||
sha1_to_hex(hash)); | ||
} | ||
|
||
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len) | ||
{ | ||
const char *data = vdata; | ||
/* We expect an unsigned long, but sha1dc only takes an int */ | ||
while (len > INT_MAX) { | ||
SHA1DCUpdate(ctx, data, INT_MAX); | ||
data += INT_MAX; | ||
len -= INT_MAX; | ||
} | ||
SHA1DCUpdate(ctx, data, len); | ||
} |
Oops, something went wrong.