aboutsummaryrefslogtreecommitdiff
path: root/block-sha1
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-08-06 13:56:19 -0700
committerJunio C Hamano <gitster@pobox.com>2009-08-06 13:56:19 -0700
commitb26a9d50899a5d65bafcb521c5495f03b2e2e0e9 (patch)
treebb6686b1a6a3d2851d449eb54a536a60b0e7bdbf /block-sha1
parentd7c208a92e6b15cdcd159e30cd1fc0177fd967e9 (diff)
downloadgit-b26a9d50899a5d65bafcb521c5495f03b2e2e0e9.tar.gz
git-b26a9d50899a5d65bafcb521c5495f03b2e2e0e9.tar.xz
block-sha1: undo ctx->size change
Undo the change I picked up from the mailing list discussion suggested by Nico, not because it is wrong, but it will be done at the end of the follow-up series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'block-sha1')
-rw-r--r--block-sha1/sha1.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block-sha1/sha1.c b/block-sha1/sha1.c
index 50b2b42b0..eef32f785 100644
--- a/block-sha1/sha1.c
+++ b/block-sha1/sha1.c
@@ -31,7 +31,7 @@ void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *data, unsigned long len)
{
int lenW = ctx->lenW;
- ctx->size += len;
+ ctx->size += (unsigned long long) len << 3;
/* Read the data into W and process blocks as they get full
*/
@@ -68,8 +68,8 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
/* Pad with a binary 1 (ie 0x80), then zeroes, then length
*/
- padlen[0] = htonl(ctx->size >> (32 - 3));
- padlen[1] = htonl(ctx->size << 3);
+ padlen[0] = htonl(ctx->size >> 32);
+ padlen[1] = htonl(ctx->size);
blk_SHA1_Update(ctx, pad, 1+ (63 & (55 - ctx->lenW)));
blk_SHA1_Update(ctx, padlen, 8);