From b47f509ba59df5bd9a780745ca710272c6dd175b Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 19 Jun 2006 09:25:16 +1000 Subject: Fix PPC SHA1 routine for large input buffers The PPC SHA1 routine had an overflow which meant that it gave incorrect results for input buffers >= 512MB. This fixes it by ensuring that the update of the total length in bits is done using 64-bit arithmetic. Signed-off-by: Paul Mackerras Signed-off-by: Junio C Hamano --- ppc/sha1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ppc/sha1.c') diff --git a/ppc/sha1.c b/ppc/sha1.c index 5ba4fc5259..0820398b00 100644 --- a/ppc/sha1.c +++ b/ppc/sha1.c @@ -30,7 +30,7 @@ int SHA1_Update(SHA_CTX *c, const void *ptr, unsigned long n) unsigned long nb; const unsigned char *p = ptr; - c->len += n << 3; + c->len += (uint64_t) n << 3; while (n != 0) { if (c->cnt || n < 64) { nb = 64 - c->cnt; -- cgit v1.2.3