aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-06-15 15:10:47 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-06-15 15:10:47 -0500
commit94dbf179d5dcf7501d1e27f673dabb6f5cce61cb (patch)
treed85a385478ce00e693fcef75bec7837387e000ff
parent7deecbfdf698bd62512e391bf9870abe745400d3 (diff)
parentff4de8e8f74a641d3cc31303f3b172ea7b1be17f (diff)
downloadmonzero-gui-94dbf179d5dcf7501d1e27f673dabb6f5cce61cb.tar.gz
monzero-gui-94dbf179d5dcf7501d1e27f673dabb6f5cce61cb.tar.xz
monzero-gui-94dbf179d5dcf7501d1e27f673dabb6f5cce61cb.zip
Merge pull request #2942
ff4de8e updater: use monero tools::sha256sum (xiphon)
-rw-r--r--monero-wallet-gui.pro7
-rw-r--r--src/qt/updater.cpp9
2 files changed, 12 insertions, 4 deletions
diff --git a/monero-wallet-gui.pro b/monero-wallet-gui.pro
index c2a9ea4a..092c6645 100644
--- a/monero-wallet-gui.pro
+++ b/monero-wallet-gui.pro
@@ -421,6 +421,13 @@ macx {
INCLUDEPATH += /usr/local/include
}
+ SODIUM_DIR = $$system(brew --prefix libsodium, lines, EXIT_CODE)
+ equals(EXIT_CODE, 0) {
+ INCLUDEPATH += $$SODIUM_DIR/include
+ } else {
+ INCLUDEPATH += /usr/local/include
+ }
+
QT += macextras
OBJECTIVE_SOURCES += src/qt/macoshelper.mm
LIBS+= -Wl,-dead_strip
diff --git a/src/qt/updater.cpp b/src/qt/updater.cpp
index 17d6eddb..b8afc761 100644
--- a/src/qt/updater.cpp
+++ b/src/qt/updater.cpp
@@ -28,6 +28,8 @@
#include "updater.h"
+#include <common/util.h>
+
#include <openpgp/hash.h>
#include "network.h"
@@ -111,10 +113,9 @@ QPair<QString, QString> Updater::verifySignaturesAndHashSum(
QByteArray Updater::getHash(const void *data, size_t size) const
{
- openpgp::hash hasher(openpgp::hash::algorithm::sha256);
- hasher << epee::span<const uint8_t>(reinterpret_cast<const uint8_t *>(data), size);
- const std::vector<uint8_t> hash = hasher.finish();
- return QByteArray(reinterpret_cast<const char *>(&hash[0]), hash.size());
+ QByteArray hash(sizeof(crypto::hash), 0);
+ tools::sha256sum(static_cast<const uint8_t *>(data), size, *reinterpret_cast<crypto::hash *>(hash.data()));
+ return hash;
}
QByteArray Updater::parseShasumOutput(const QString &message, const QString &filename) const