summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog4
-rw-r--r--ftparchive/writer.cc34
2 files changed, 11 insertions, 27 deletions
diff --git a/debian/changelog b/debian/changelog
index 9aeb2f809..7b1ca1df0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,13 +7,15 @@ apt (0.8.16~exp3) UNRELEASEDexperimental; urgency=low
* apt-pkg/acquire*.{cc,h}:
- try even harder to support really big files in the fetcher by
converting (hopefully) everything to 'long long' (Closes: #632271)
+ * ftparchive/writer.cc:
+ - generate all checksums in one run over the file for Release
[ Michael Vogt ]
* merge fixes from the debian/unstable upload
* merge lp:~mvo/apt/sha512-template to get fixes for the
sha1/md5 verifiation (closes: #632520)
- -- David Kalnischkies <kalnischkies@gmail.com> Tue, 05 Jul 2011 15:56:42 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Wed, 13 Jul 2011 23:22:14 +0200
apt (0.8.16~exp2) experimental; urgency=low
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index c43e8f4b4..60db8b990 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -19,8 +19,7 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/md5.h>
-#include <apt-pkg/sha1.h>
-#include <apt-pkg/sha2.h>
+#include <apt-pkg/hashes.h>
#include <apt-pkg/deblistparser.h>
#include <sys/types.h>
@@ -1040,35 +1039,18 @@ bool ReleaseWriter::DoPackage(string FileName)
CheckSums[NewFileName].size = fd.Size();
+ Hashes hs;
+ hs.AddFD(fd.Fd(), 0, DoMD5, DoSHA1, DoSHA256, DoSHA512);
if (DoMD5 == true)
- {
- MD5Summation MD5;
- MD5.AddFD(fd.Fd(), fd.Size());
- CheckSums[NewFileName].MD5 = MD5.Result();
- fd.Seek(0);
- }
+ CheckSums[NewFileName].MD5 = hs.MD5.Result();
if (DoSHA1 == true)
- {
- SHA1Summation SHA1;
- SHA1.AddFD(fd.Fd(), fd.Size());
- CheckSums[NewFileName].SHA1 = SHA1.Result();
- fd.Seek(0);
- }
+ CheckSums[NewFileName].SHA1 = hs.SHA1.Result();
if (DoSHA256 == true)
- {
- SHA256Summation SHA256;
- SHA256.AddFD(fd.Fd(), fd.Size());
- CheckSums[NewFileName].SHA256 = SHA256.Result();
- }
-
+ CheckSums[NewFileName].SHA256 = hs.SHA256.Result();
if (DoSHA512 == true)
- {
- SHA512Summation SHA512;
- SHA512.AddFD(fd.Fd(), fd.Size());
- CheckSums[NewFileName].SHA512 = SHA512.Result();
- }
+ CheckSums[NewFileName].SHA512 = hs.SHA512.Result();
fd.Close();
-
+
return true;
}