X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/c31c1dded85ee1e88231a041aac7e507f2ed426c..15e1ed52a741ff82deb0a4cd6150cf10e23b7368:/apt-pkg/contrib/sha1.cc diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index 4b0552102..298a7799b 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -29,14 +29,12 @@ */ /*}}} */ // Include Files /*{{{*/ +#include + #include -#include -#include +#include #include -#include -#include -#include /*}}}*/ // SHA1Transform - Alters an existing SHA-1 hash /*{{{*/ @@ -74,10 +72,9 @@ static void SHA1Transform(uint32_t state[5],uint8_t const buffer[64]) uint32_t l[16]; } CHAR64LONG16; - CHAR64LONG16 *block; + CHAR64LONG16 workspace, *block; - uint8_t workspace[64]; - block = (CHAR64LONG16 *)workspace; + block = &workspace; memcpy(block,buffer,sizeof(workspace)); /* Copy context->state[] to working vars */ @@ -242,10 +239,12 @@ SHA1SumValue SHA1Summation::Result() // SHA1Summation::Add - Adds content of buffer into the checksum /*{{{*/ // --------------------------------------------------------------------- /* May not be called after Result() is called */ -bool SHA1Summation::Add(const unsigned char *data,unsigned long len) +bool SHA1Summation::Add(const unsigned char *data,unsigned long long len) { if (Done) return false; + if (len == 0) + return true; uint32_t *state = (uint32_t *)State; uint32_t *count = (uint32_t *)Count;