You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#5349. Implemented SHA256 checksum verification for downloaded missions.
Of course, it is done only if XML file with list of mission contains "sha256" attribute on "downloadLocation" or "localisationPack" element.
idlib/hashing/sha256.*
Since SHA256 is computed on-the-fly during download, and download itself is much slower anyway, I took simple standalone but unoptimized implementation of SHA256:
https://github.com/B-Con/crypto-algorithms
LICENSE.txt:
Since author wants acknowledgement, added it =)
game/Http/HttpRequest.*
Added EnableSha256 and GetSha256 methods.
Basically, if you call the first method, then checksum will be computed.
game/Missions/Download.*
Added method VerifySha256Checksum, which receives expected sha256 and enables its validation when download is over.
Added MALFORMED status for the case when checksum verification failed (want special error message).
Also removed excessive constructor.
game/Missions/MissionManager.*
LoadModListFromXml now reads and checks "sha256" field.
Validation is perhaps not necessary, but better let it be.
For that reason, LoadModListFromXml now returns bool (false if malformed XML).
Also added MALFORMED status for requests by external users.
game/DownloadMenu.cpp:
Enabled SHA256 verification for mission/localization packs in CDownloadMenu::StartDownload.
Print custom error message if mission has wrong checksum.
Print custom error message if missionlist XML is malformed.
(the other requests just use error message for FAILED, since they don't return MALFORMED)
git-svn-id: http://svn.thedarkmod.com/svn/darkmod_src/trunk@9022 49c82d7f-2e2a-0410-a16f-ae8f201b507f
0 commit comments