aboutsummaryrefslogtreecommitdiff
path: root/src/utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.cpp')
-rw-r--r--src/utility.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/utility.cpp b/src/utility.cpp
index bc51cff..e9688de 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -14,16 +14,16 @@
*/
#include "olm/utility.hh"
-#include "olm/crypto.hh"
+#include "olm/crypto.h"
olm::Utility::Utility(
-) : last_error(olm::ErrorCode::SUCCESS) {
+) : last_error(OlmErrorCode::OLM_SUCCESS) {
}
size_t olm::Utility::sha256_length() {
- return olm::SHA256_OUTPUT_LENGTH;
+ return SHA256_OUTPUT_LENGTH;
}
@@ -32,25 +32,25 @@ size_t olm::Utility::sha256(
std::uint8_t * output, std::size_t output_length
) {
if (output_length < sha256_length()) {
- last_error = olm::ErrorCode::OUTPUT_BUFFER_TOO_SMALL;
+ last_error = OlmErrorCode::OLM_OUTPUT_BUFFER_TOO_SMALL;
return std::size_t(-1);
}
- olm::sha256(input, input_length, output);
- return olm::SHA256_OUTPUT_LENGTH;
+ _olm_crypto_sha256(input, input_length, output);
+ return SHA256_OUTPUT_LENGTH;
}
size_t olm::Utility::ed25519_verify(
- Ed25519PublicKey const & key,
+ _olm_ed25519_public_key const & key,
std::uint8_t const * message, std::size_t message_length,
std::uint8_t const * signature, std::size_t signature_length
) {
- if (signature_length < olm::SIGNATURE_LENGTH) {
- last_error = olm::ErrorCode::BAD_MESSAGE_MAC;
+ if (signature_length < ED25519_SIGNATURE_LENGTH) {
+ last_error = OlmErrorCode::OLM_BAD_MESSAGE_MAC;
return std::size_t(-1);
}
- if (!olm::ed25519_verify(key, message, message_length, signature)) {
- last_error = olm::ErrorCode::BAD_MESSAGE_MAC;
+ if (!_olm_crypto_ed25519_verify(&key, message, message_length, signature)) {
+ last_error = OlmErrorCode::OLM_BAD_MESSAGE_MAC;
return std::size_t(-1);
}
return std::size_t(0);