aboutsummaryrefslogtreecommitdiff
path: root/ppc/sha1.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-06-19 09:25:16 +1000
committerJunio C Hamano <junkio@cox.net>2006-06-18 20:12:20 -0700
commitb47f509ba59df5bd9a780745ca710272c6dd175b (patch)
treeadc485fcd2024dcdb0b7043f26d845b98cfed4e1 /ppc/sha1.c
parent476a4dfc05f8d67406af277a00f7079b5d6d51e1 (diff)
downloadgit-b47f509ba59df5bd9a780745ca710272c6dd175b.tar.gz
git-b47f509ba59df5bd9a780745ca710272c6dd175b.tar.xz
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 <paulus@samba.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'ppc/sha1.c')
-rw-r--r--ppc/sha1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ppc/sha1.c b/ppc/sha1.c
index 5ba4fc525..0820398b0 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;