summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-23 16:54:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-24 23:54:59 +0200
commit23397c9d7d4d455461176600bb45c81185493504 (patch)
treed31bba61b1c04aa66f9a17dca19127dd94d8f65d /ftparchive
parent10e100e59a96ea7b6834a139beab5d9d70180633 (diff)
promote filesize to a hashstring
It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve.
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/cachedb.cc4
-rw-r--r--ftparchive/writer.cc4
2 files changed, 7 insertions, 1 deletions
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index da45eb8d2..df5eb1451 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -473,6 +473,10 @@ bool CacheDB::GetHashes(bool const GenOnly, unsigned int const DoHashes)
hex2bytes(CurStat.MD5, hs->HashValue().data(), sizeof(CurStat.MD5));
CurStat.Flags |= FlMD5;
}
+ else if (strcasecmp(hs->HashType().c_str(), "Checksum-FileSize") == 0)
+ {
+ // we store it in a different field already
+ }
else
return _error->Error("Got unknown unrequested hashtype %s", hs->HashType().c_str());
}
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index db617e92a..ded8715f8 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -471,6 +471,8 @@ bool PackagesWriter::DoPackage(string FileName)
{
if (hs->HashType() == "MD5Sum")
Changes.push_back(SetTFRewriteData("MD5sum", hs->HashValue().c_str()));
+ else if (hs->HashType() == "Checksum-FileSize")
+ continue;
else
Changes.push_back(SetTFRewriteData(hs->HashType().c_str(), hs->HashValue().c_str()));
}
@@ -785,7 +787,7 @@ bool SourcesWriter::DoPackage(string FileName)
for (HashStringList::const_iterator hs = Db.HashesList.begin(); hs != Db.HashesList.end(); ++hs)
{
- if (hs->HashType() == "MD5Sum")
+ if (hs->HashType() == "MD5Sum" || hs->HashType() == "Checksum-FileSize")
continue;
char const * fieldname;
std::ostream * out;