X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/410ea6525d613fe91029d5a6526254739fc5880b..98b063439156595f74c89e923bf4d3fd51a3b36f:/apt-pkg/contrib/sha2.h?ds=sidebyside diff --git a/apt-pkg/contrib/sha2.h b/apt-pkg/contrib/sha2.h index 386225889..8b4bdd439 100644 --- a/apt-pkg/contrib/sha2.h +++ b/apt-pkg/contrib/sha2.h @@ -14,14 +14,18 @@ #ifndef APTPKG_SHA2_H #define APTPKG_SHA2_H -#include #include -#include -#include #include "sha2_internal.h" #include "hashsum_template.h" +#ifndef APT_10_CLEANER_HEADERS +#include +#include +#include +#endif + + typedef HashSumValue<512> SHA512SumValue; typedef HashSumValue<256> SHA256SumValue; @@ -30,7 +34,7 @@ class SHA2SummationBase : public SummationImplementation protected: bool Done; public: - bool Add(const unsigned char *inbuf, unsigned long len) = 0; + bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE = 0; void Result(); }; @@ -41,7 +45,7 @@ class SHA256Summation : public SHA2SummationBase unsigned char Sum[32]; public: - bool Add(const unsigned char *inbuf, unsigned long len) + bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE { if (Done) return false; @@ -60,10 +64,11 @@ class SHA256Summation : public SHA2SummationBase res.Set(Sum); return res; }; - SHA256Summation() + SHA256Summation() { SHA256_Init(&ctx); Done = false; + memset(&Sum, 0, sizeof(Sum)); }; }; @@ -73,7 +78,7 @@ class SHA512Summation : public SHA2SummationBase unsigned char Sum[64]; public: - bool Add(const unsigned char *inbuf, unsigned long len) + bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE { if (Done) return false; @@ -96,6 +101,7 @@ class SHA512Summation : public SHA2SummationBase { SHA512_Init(&ctx); Done = false; + memset(&Sum, 0, sizeof(Sum)); }; };