@matheusbsbs / matheus-bagliano / commits / b26a9d5089
Fork 0

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>

Junio C Hamano committed Aug 6, 2009 at 13:56 UTC b26a9d50899a5d65bafcb521c5495f03b2e2e0e9
1 file changed +3 -3
block-sha1/sha1.c
+3 -3
@@ -31,7 +31,7 @@ void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *data, unsigned long len)
31 {
32 int lenW = ctx->lenW;
33
34 - ctx->size += len;
34 + ctx->size += (unsigned long long) len << 3;
35
36 /* Read the data into W and process blocks as they get full
37 */
@@ -68,8 +68,8 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
68
69 /* Pad with a binary 1 (ie 0x80), then zeroes, then length
70 */
71 - padlen[0] = htonl(ctx->size >> (32 - 3));
72 - padlen[1] = htonl(ctx->size << 3);
71 + padlen[0] = htonl(ctx->size >> 32);
72 + padlen[1] = htonl(ctx->size);
73
74 blk_SHA1_Update(ctx, pad, 1+ (63 & (55 - ctx->lenW)));
75 blk_SHA1_Update(ctx, padlen, 8);