summaryrefslogtreecommitdiff
path: root/service/SoftwareUpdater.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-07-06 16:11:11 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-07-06 16:11:11 -0700
commitd2415dee00914ab3fd7016758f4184d46bb407a5 (patch)
tree3e314c3464b1ddc86423cd1081cf65183e1a0fa4 /service/SoftwareUpdater.cpp
parent53728b79b45417bc8f36464e13121229858f6ca5 (diff)
downloadinfinitytier-d2415dee00914ab3fd7016758f4184d46bb407a5.tar.gz
infinitytier-d2415dee00914ab3fd7016758f4184d46bb407a5.zip
Cleanup.
Diffstat (limited to 'service/SoftwareUpdater.cpp')
-rw-r--r--service/SoftwareUpdater.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/service/SoftwareUpdater.cpp b/service/SoftwareUpdater.cpp
index e0519827..b4bf03ec 100644
--- a/service/SoftwareUpdater.cpp
+++ b/service/SoftwareUpdater.cpp
@@ -284,7 +284,7 @@ bool SoftwareUpdater::check(const uint64_t now)
if ((now - _lastCheckTime) >= ZT_SOFTWARE_UPDATE_CHECK_PERIOD) {
_lastCheckTime = now;
char tmp[512];
- const unsigned int len = Utils::ztsnprintf(tmp,sizeof(tmp),
+ const unsigned int len = OSUtils::ztsnprintf(tmp,sizeof(tmp),
"%c{\"" ZT_SOFTWARE_UPDATE_JSON_VERSION_MAJOR "\":%d,"
"\"" ZT_SOFTWARE_UPDATE_JSON_VERSION_MINOR "\":%d,"
"\"" ZT_SOFTWARE_UPDATE_JSON_VERSION_REVISION "\":%d,"
@@ -321,7 +321,8 @@ bool SoftwareUpdater::check(const uint64_t now)
// (1) Check the hash itself to make sure the image is basically okay
uint8_t sha512[ZT_SHA512_DIGEST_LEN];
SHA512::hash(sha512,_download.data(),(unsigned int)_download.length());
- if (Utils::hex(sha512,ZT_SHA512_DIGEST_LEN) == OSUtils::jsonString(_latestMeta[ZT_SOFTWARE_UPDATE_JSON_UPDATE_HASH],"")) {
+ char hexbuf[(ZT_SHA512_DIGEST_LEN * 2) + 2];
+ if (OSUtils::jsonString(_latestMeta[ZT_SOFTWARE_UPDATE_JSON_UPDATE_HASH],"") == Utils::hex(sha512,ZT_SHA512_DIGEST_LEN,hexbuf)) {
// (2) Check signature by signing authority
const std::string sig(OSUtils::jsonBinFromHex(_latestMeta[ZT_SOFTWARE_UPDATE_JSON_UPDATE_SIGNATURE]));
if (Identity(ZT_SOFTWARE_UPDATE_SIGNING_AUTHORITY).verify(_download.data(),(unsigned int)_download.length(),sig.data(),(unsigned int)sig.length())) {