Skip to content

Commit

Permalink
Fix PPC SHA1 routine for large input buffers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
paulusmack authored and Junio C Hamano committed Jun 19, 2006
1 parent 476a4df commit b47f509
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ppc/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b47f509

Please sign in to comment.