aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmutility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/e2ee/qolmutility.cpp')
-rw-r--r--lib/e2ee/qolmutility.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/lib/e2ee/qolmutility.cpp b/lib/e2ee/qolmutility.cpp
index 84559085..22f9ec0d 100644
--- a/lib/e2ee/qolmutility.cpp
+++ b/lib/e2ee/qolmutility.cpp
@@ -40,23 +40,10 @@ QString QOlmUtility::sha256Utf8Msg(const QString &message) const
return sha256Bytes(message.toUtf8());
}
-QOlmExpected<bool> QOlmUtility::ed25519Verify(const QByteArray& key,
- const QByteArray& message,
- const QByteArray& signature)
+bool QOlmUtility::ed25519Verify(const QByteArray& key, const QByteArray& message,
+ QByteArray signature)
{
- QByteArray signatureBuf(signature.length(), '0');
- std::copy(signature.begin(), signature.end(), signatureBuf.begin());
-
- const auto ret = olm_ed25519_verify(m_utility, key.data(), key.size(),
- message.data(), message.size(), (void *)signatureBuf.data(), signatureBuf.size());
-
- if (ret == olm_error()) {
- auto error = lastError(m_utility);
- if (error == QOlmError::BadMessageMac) {
- return false;
- }
- return error;
- }
-
- return !ret; // ret == 0 means success
+ return olm_ed25519_verify(m_utility, key.data(), key.size(), message.data(),
+ message.size(), signature.data(), signature.size())
+ == 0;
}